//*************************************** Detalle Reserva *************************************** protected void BindDataPpal(string NumRv, string Accion) { if (Accion.Equals("UPD")) { Cnx.SelecBD(); using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = "EXEC SP_PANTALLA_Reserva 6,'','','','',@NR,0,0,@ICC,'01-1-2009','01-01-1900','01-01-1900'"; sqlConB.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB)) { SC.Parameters.AddWithValue("@NR", NumRv); SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]); using (SqlDataAdapter SDA = new SqlDataAdapter()) { using (DataSet DS = new DataSet()) { SDA.SelectCommand = SC; SDA.Fill(DS); DS.Tables[0].TableName = "DetRva"; DS.Tables[1].TableName = "Stock"; DS.Tables[2].TableName = "DetREcibo"; DS.Tables[3].TableName = "Usuario"; ViewState["DS"] = DS; } } } } } DS = (DataSet)ViewState["DS"]; DataRow[] DR; if (!TxtNumRva.Text.Trim().Equals("")) { if (DS.Tables["DetRva"].Rows.Count > 0) { DataTable DT = new DataTable(); DT = DS.Tables["DetRva"].Clone(); DR = DS.Tables["DetRva"].Select("Pn LIKE '%" + TxtConsltPN.Text.Trim() + "%'"); if (IsIENumerableLleno(DR)) { DT = DR.CopyToDataTable(); } if (DT.Rows.Count > 0) { DataView DV = DT.DefaultView; DV.Sort = "NumeroPosicion"; DT = DV.ToTable(); GrdReserva.DataSource = DT; } else { GrdReserva.DataSource = null; } } else { GrdReserva.DataSource = null; } } else { GrdReserva.DataSource = null; } GrdReserva.DataBind(); }
protected void BindBusPn(string PN) { DSTPSL = (DataSet)ViewState["DSTPSL"]; DataRow[] DR; DataTable DT = new DataTable(); GrdAlterno.DataSource = null; GrdAlterno.DataBind(); GrdStokAlma.DataSource = null; GrdStokAlma.DataBind(); GrdMvtos.DataSource = null; GrdMvtos.DataBind(); DR = DSTPSL.Tables[0].Select("Codigo ='" + PN + "'"); if (Cnx.ValidaDataRowVacio(DR)) { DT = DR.CopyToDataTable(); TxtTipo.Text = DT.Rows[0]["DescTipo"].ToString().Trim(); TxtDescrPn.Text = DT.Rows[0]["Descripcion"].ToString().Trim(); ViewState["CodReferencia"] = DT.Rows[0]["CodReferencia"].ToString().Trim(); LblTitAlterno.Text = ViewState["IdimaPnALter"].ToString().Trim() + " [" + ViewState["CodReferencia"] + "]"; switch (DT.Rows[0]["Identf"].ToString().Trim()) { case "SN": DR = DSTPSL.Tables[1].Select("PN ='" + PN + "' OR Codigo = ''"); if (Cnx.ValidaDataRowVacio(DR)) { DT = DR.CopyToDataTable(); DdlSN.DataSource = DT; DdlSN.DataTextField = "SN"; DdlSN.DataValueField = "Codigo"; } else { DdlSN.DataSource = null; } DdlSN.DataBind(); DR = DSTPSL.Tables[2].Select("Codigo = ''"); if (Cnx.ValidaDataRowVacio(DR)) { DT = DR.CopyToDataTable(); DdlLote.DataSource = DT; DdlLote.DataTextField = "LOTE"; DdlLote.DataValueField = "Codigo"; DdlLote.DataBind(); } break; case "LOTE": DR = DSTPSL.Tables[2].Select("PN ='" + PN + "' OR Codigo = ''"); if (Cnx.ValidaDataRowVacio(DR)) { DT = DR.CopyToDataTable(); DdlLote.DataSource = DT; DdlLote.DataTextField = "LOTE"; DdlLote.DataValueField = "Codigo"; } else { DdlLote.DataSource = null; } DdlLote.DataBind(); DR = DSTPSL.Tables[1].Select("Codigo = ''"); if (Cnx.ValidaDataRowVacio(DR)) { DT = DR.CopyToDataTable(); DdlSN.DataSource = DT; DdlSN.DataTextField = "SN"; DdlSN.DataValueField = "Codigo"; DdlSN.DataBind(); } break; default: DR = DSTPSL.Tables[2].Select("Codigo = ''"); if (Cnx.ValidaDataRowVacio(DR)) { DT = DR.CopyToDataTable(); DdlLote.DataSource = DT; DdlLote.DataTextField = "LOTE"; DdlLote.DataValueField = "Codigo"; DdlLote.DataBind(); } DR = DSTPSL.Tables[1].Select("Codigo = ''"); if (Cnx.ValidaDataRowVacio(DR)) { DT = DR.CopyToDataTable(); DdlSN.DataSource = DT; DdlSN.DataTextField = "SN"; DdlSN.DataValueField = "Codigo"; DdlSN.DataBind(); } break; } Cnx.SelecBD(); using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = "EXEC SP_PANTALLA_ConsultaMovimiento 14,@CRf,'','','',0,0,@Idm,@ICC,'01-1-2009','01-01-1900','01-01-1900'"; sqlConB.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB)) { SC.Parameters.AddWithValue("@CRf", ViewState["CodReferencia"]); SC.Parameters.AddWithValue("@Idm", Session["77IDM"]); SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]); using (SqlDataAdapter SDA = new SqlDataAdapter()) { using (DataTable DTA = new DataTable()) { SDA.SelectCommand = SC; SDA.Fill(DTA); GrdAlterno.DataSource = DTA; GrdAlterno.DataBind(); } } } } } }
protected void BindBDatos(string Accion) { if (Accion.Equals("UPD")) { Cnx.SelecBD(); using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = "EXEC PNTLL_Ingenieria 1,'','','','','','',0,0,0,@Idm,@ICC,'01-01-01','02-01-01','03-01-01'"; sqlConB.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB)) { SC.Parameters.AddWithValue("@Idm", Session["77IDM"]); SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]); using (SqlDataAdapter SDA = new SqlDataAdapter()) { using (DataSet DSTDdl = new DataSet()) { SDA.SelectCommand = SC; SDA.Fill(DSTPpl); DSTPpl.Tables[0].TableName = "Tipo"; DSTPpl.Tables[1].TableName = "ProxVence"; DSTPpl.Tables[2].TableName = "SinConfig"; ViewState["DSTPpl"] = DSTPpl; } } } } } DSTPpl = (DataSet)ViewState["DSTPpl"]; DataRow[] DR; DataTable DT = new DataTable(); DT = DSTPpl.Tables[1].Clone(); if (DdlTipo.Text.Trim().Equals("")) { DR = DSTPpl.Tables[1].Select("CodTipoElemento <>'05'"); if (IsIENumerableLleno(DR)) { DT = DR.CopyToDataTable(); } } else { DR = DSTPpl.Tables[1].Select("CodTipoElemento ='" + DdlTipo.Text.Trim() + "'"); if (IsIENumerableLleno(DR)) { DT = DR.CopyToDataTable(); } } if (DT.Rows.Count > 0) { GrdProxVenc.DataSource = DT; } else { GrdProxVenc.DataSource = null; } GrdProxVenc.DataBind(); DataTable DT2 = new DataTable(); DT2 = DSTPpl.Tables[2].Clone(); if (DdlTipo.Text.Trim().Equals("")) { DR = DSTPpl.Tables[2].Select("CodTipoElemento <>'05'"); if (IsIENumerableLleno(DR)) { DT2 = DR.CopyToDataTable(); } } else { DR = DSTPpl.Tables[2].Select("CodTipoElemento ='" + DdlTipo.Text.Trim() + "'"); if (IsIENumerableLleno(DR)) { DT2 = DR.CopyToDataTable(); } } if (DT2.Rows.Count > 0) { GrdSinConfg.DataSource = DT2; } else { GrdSinConfg.DataSource = null; } GrdSinConfg.DataBind(); }