Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/11/2010, 13:44
katyhdzm
 
Fecha de Ingreso: octubre-2010
Mensajes: 3
Antigüedad: 13 años, 6 meses
Puntos: 0
Información Guardar la informacion de un asp en mi BD

Hola a todos tengo un problema lo que pasa es que al quere guardar la informacion de mi asp en mi tb de mi bd solo me toma o una u otra y quiero que me guarde todo lo que tengo dentro de un detalle este es mi asp y mi store para guardar de mi sql:

ASP


public partial class Abasto_Opciones_TraspasoAlmacenes : System.Web.UI.Page
{
VetecUtils objUtils;
DataTable objDTDetalle;
Articulo objArticulo;
ArticuloBO objArticuloBO;
//DataTable objDT;

protected void Page_Load(object sender, EventArgs e)
{
objUtils = new VetecUtils();

if (!IsPostBack && !IsCallback){
adeFecha.Date = DateTime.Now;

objDTDetalle = new DataTable();
objDTDetalle.Columns.Add("intPartida", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("intArticulo", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strNombreCorto", Type.GetType("System.String"));
objDTDetalle.Columns.Add("strArticulo", Type.GetType("System.String"));
objDTDetalle.Columns.Add("intAlmacenOrigen", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strAlmacenOrigen", Type.GetType("System.String"));
objDTDetalle.Columns.Add("intSubAlmacenOrigen", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strSubAlmacenOrigen", Type.GetType("System.String"));
objDTDetalle.Columns.Add("intAlmacenDestino", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strAlmacenDestino", Type.GetType("System.String"));
objDTDetalle.Columns.Add("intSubAlmacenDestino", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strSubAlmacenDestino", Type.GetType("System.String"));
objDTDetalle.Columns.Add("dblCantidad", Type.GetType("System.Double"));
Session["detalle"] = objDTDetalle;
}

else
{
objDTDetalle = (DataTable)Session["detalle"];
}
if (objDTDetalle == null)
{

objDTDetalle = new DataTable();
objDTDetalle.Columns.Add("intPartida", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("intArticulo", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strNombreCorto", Type.GetType("System.String"));
objDTDetalle.Columns.Add("strArticulo", Type.GetType("System.String"));
objDTDetalle.Columns.Add("intAlmacenOrigen", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strAlmacenOrigen", Type.GetType("System.String"));
objDTDetalle.Columns.Add("intSubAlmacenOrigen", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strSubAlmacenOrigen", Type.GetType("System.String"));
objDTDetalle.Columns.Add("intAlmacenDestino", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strAlmacenDestino", Type.GetType("System.String"));
objDTDetalle.Columns.Add("intSubAlmacenDestino", Type.GetType("System.Int32"));
objDTDetalle.Columns.Add("strSubAlmacenDestino", Type.GetType("System.String"));
objDTDetalle.Columns.Add("dblCantidad", Type.GetType("System.Double"));
Session["detalle"] = objDTDetalle;
}

}


protected void btnAgregar_ServerClick(object sender, EventArgs e) {

DataRow objDR;
objDR = objDTDetalle.NewRow();

if (btnAgregar.Value == "Actualizar")
{
btnAgregar.Value = " + ";
objDTDetalle.Select("intPartida=" + txtFilaEditar.Text)[0].Delete();
objDR["intPartida"] = txtFilaEditar.Text;
txtFilaEditar.Text = String.Empty;
}
else {
if (objDTDetalle.Compute("MAX(intPartida)+1", "") == System.DBNull.Value)
objDR["intPartida"] = 1;
else
objDR["intPartida"] = objDTDetalle.Compute("MAX(intPartida)+1", "");
}

objDR["intArticulo"] = txtArticulo.Text;
objDR["strNombreCorto"] = txtNombreCorto.Text;
objDR["strArticulo"] = txtDescripcion.Text;
objDR["intAlmacenOrigen"] = txtAlmacenInt.Text;
objDR["strAlmacenOrigen"] = txtAlmacen.Text;
objDR["intSubAlmacenOrigen"] = txtSubAlmacenInt.Text;
objDR["strSubAlmacenOrigen"] = txtSubAlmacen.Text;
objDR["intAlmacenDestino"] = txtAlmacenDestinoInt.Text;
objDR["strAlmacenDestino"] = txtAlmacenDestino.Text;
objDR["intSubAlmacenDestino"] = txtSubAlmacenDestinoInt.Text;
objDR["strSubAlmacenDestino"] = txtSubAlmacenDestino.Text;
objDR["dblCantidad"] = txtCantidad.Text;

objDTDetalle.Rows.Add(objDR);
objUtils.limpiarCampos(this, "txtNombreCorto,txtDescripcion,txtAlmacenInt,txtAl macen,txtSubAlmacenInt,txtSubAlmacen,txtAlmacenDes tinoInt,txtAlmacenDestino,txtSubAlmacenDestinoInt, txtSubAlmacenDestino,txtCantidad");

//ColocarFocoControles();
//txtFoco.Text = "0";

BindTable();

}


private void BindTable()
{
DataView dv;
dv = new DataView(objDTDetalle, "", "intPartida", DataViewRowState.CurrentRows);
ASPxGridView2.DataSource = dv;
ASPxGridView2.DataBind();
Session["detalle"] = objDTDetalle;
}



protected void btnSave_ServerClick(object sender, EventArgs e){
try
{
ArticuloBO objArticuloBO;
//Constructor con la empresa y sucursal actual
objArticuloBO = new ArticuloBO();
objUtils = new VetecUtils();


string strDetalle;
strDetalle = string.Empty;
DataView dv;
dv = new DataView(objDTDetalle, "", "intPartida", DataViewRowState.CurrentRows);

foreach (DataRowView row in dv)
{
if (row.Row.RowState != DataRowState.Deleted)
{
strDetalle = (strDetalle + ("(LISTITEM)(ITEM)"
+ (row["intArticulo"].ToString() + "(/ITEM)")));
//strDetalle = (strDetalle + ("(ITEM)"
// + (row["strNombreCorto"].ToString() + "(/ITEM)")));
//strDetalle = (strDetalle + ("(ITEM)"
// + (row["strArticulo"].ToString() + "(/ITEM)")));
strDetalle = (strDetalle + ("(LISTITEM)(ITEM)"
+ (row["intAlmacenOrigen"].ToString() + "(/ITEM)")));
//strDetalle = (strDetalle + ("(ITEM)"
// + (row["strAlmacenOrigen"].ToString() + "(/ITEM)")));
strDetalle = (strDetalle + ("(LISTITEM)(ITEM)"
+ (row["intSubAlmacenOrigen"].ToString() + "(/ITEM)")));
//strDetalle = (strDetalle + ("(ITEM)"
// + (row["strSubAlmacenOrigen"].ToString() + "(/ITEM)")));
strDetalle = (strDetalle + ("(LISTITEM)(ITEM)"
+ (row["intAlmacenDestino"].ToString() + "(/ITEM)")));
//strDetalle = (strDetalle + ("(ITEM)"
// + (row["strAlmacenDestino"].ToString() + "(/ITEM)")));
strDetalle = (strDetalle + ("(LISTITEM)(ITEM)"
+ (row["intSubAlmacenDestino"].ToString() + "(/ITEM)")));
//strDetalle = (strDetalle + ("(ITEM)"
// + (row["strSubAlmacenDestino"].ToString() + "(/ITEM)")));
strDetalle = (strDetalle + ("(ITEM)"
+ (row["dblCantidad"].ToString() + "(/ITEM)")));

}
}



string strResult = objArticuloBO.TraspasoAlmacen(Int32.Parse(txtAlmac enInt.Text.Trim()), Int32.Parse(txtSubAlmacenInt.Text.Trim()),
Int32.Parse(txtAlmacenDestinoInt.Text.Trim()), Int32.Parse(txtSubAlmacenDestinoInt.Text.Trim()),
Int32.Parse(txtArticulo.Text.Trim()), double.Parse(txtCantidad.Text.Trim()), adeFecha.Text);
//string strResult = objArticuloBO.TraspasoAlmacen(adeFecha.Text);
// se agrego el +strResult
objUtils.mostrarAlerta(this, "El traspaso se registro exitosamente" + strResult);
objUtils.limpiarPagina(this);
objArticuloBO = null;
}

//objUtils.limpiarPagina(this);

catch (Exception ex)
{
objUtils.mostrarError(this, ex.Message);
}
}




protected void btnList_ServerClick(object sender, EventArgs e){
ArticuloBO objArticuloBO;
//Constructor con la empresa y sucursal actual
objArticuloBO = new ArticuloBO();
ASPxGridView1.DataSource = objArticuloBO.ConsultaTraspasoAlmacen(ddlFechaInic ial.Text, ddlFechaFinal.Text);
ASPxGridView1.DataBind();
objArticuloBO = null;

}


protected void btnNew_ServerClick(object sender, EventArgs e)
{

}


}