protected void BindBDdlBusq() { string LtxtSql = string.Format("EXEC SP_TablasGeneral 7,'','','','','','','','CatgrMel','DdlBus',0,0,0,0,0,{0},'01-01-1','02-01-1','03-01-1'", Session["!dC!@"]); DdlBusq.DataSource = Cnx.DSET(LtxtSql); DdlBusq.DataMember = "Datos"; DdlBusq.DataTextField = "NomModelo"; DdlBusq.DataValueField = "CodModelo"; DdlBusq.DataBind(); }
protected void BindBDdl(string Accion) { if (Accion.Equals("UPD")) { Cnx.SelecBD(); using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = "EXEC SP_TablasGeneral 17,'','','','','','','','','',0,0,0,0,@Idm,@ICC,'01-01-1','02-01-1','03-01-1'"; 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(DSTDdl); DSTDdl.Tables[0].TableName = "Consul"; DSTDdl.Tables[1].TableName = "TipoUbGeo"; DSTDdl.Tables[2].TableName = "UbicSup"; DSTDdl.Tables[3].TableName = "Datos"; ViewState["DSTDdl"] = DSTDdl; } } } } } DSTDdl = (DataSet)ViewState["DSTDdl"]; string VbCodAnt = ""; VbCodAnt = DdlBusq.Text.Trim(); DdlBusq.DataSource = DSTDdl.Tables[0]; DdlBusq.DataTextField = "Nombre"; DdlBusq.DataValueField = "IdUbicaGeogr"; DdlBusq.DataBind(); DdlBusq.Text = VbCodAnt; VbCodAnt = DdlTipoUbc.Text.Trim(); DdlTipoUbc.DataSource = DSTDdl.Tables[1]; DdlTipoUbc.DataTextField = "Descripcion"; DdlTipoUbc.DataValueField = "TipoUbicaGeogr"; DdlTipoUbc.DataBind(); DdlTipoUbc.Text = VbCodAnt; VbCodAnt = DdlUbicaSupr.Text.Trim(); DdlUbicaSupr.DataSource = DSTDdl.Tables[2]; DdlUbicaSupr.DataTextField = "Nombre"; DdlUbicaSupr.DataValueField = "CodUbicaGeogr"; DdlUbicaSupr.DataBind(); DdlUbicaSupr.Text = VbCodAnt; }
protected void Traerdatos(string Prmtr, string Accion) { Idioma = (DataTable)ViewState["TablaIdioma"]; if (Accion.Equals("UPDATE")) { Cnx.SelecBD(); using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = "EXEC SP_PANTALLA_Bodega 4,'','','','SELECT',@Prmtr,0,0,@ICC,'01-1-2009','01-01-1900','01-01-1900'"; sqlConB.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB)) { SC.Parameters.AddWithValue("@Prmtr", Prmtr); SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]); using (SqlDataAdapter SDA = new SqlDataAdapter()) { using (DataSet DSTDet = new DataSet()) { SDA.SelectCommand = SC; SDA.Fill(DSTDet); DSTDet.Tables[0].TableName = "Bodega"; DSTDet.Tables[1].TableName = "Tercero"; DSTDet.Tables[2].TableName = "Consult"; ViewState["DSTDet"] = DSTDet; } } } } } DSTDet = (DataSet)ViewState["DSTDet"]; string VbCodAnt = DdlBusq.Text.Trim(); DdlBusq.DataSource = DSTDet.Tables[0]; DdlBusq.DataTextField = "CodBodega"; DdlBusq.DataValueField = "CodidBodega"; DdlBusq.DataBind(); DdlBusq.Text = VbCodAnt.Equals("0") ? @Prmtr : VbCodAnt; DdlCliente.DataSource = DSTDet.Tables[1]; DdlCliente.DataTextField = "RazonSocial"; DdlCliente.DataValueField = "IdTercero"; DdlCliente.DataBind(); DataRow[] Result = DSTDet.Tables[2].Select("CodidBodega = " + DdlBusq.Text.Trim()); foreach (DataRow DR in Result) { TxtCod.Text = HttpUtility.HtmlDecode(DR["CodBodega"].ToString().Trim()); TxtNombre.Text = HttpUtility.HtmlDecode(DR["Nombre"].ToString().Trim()); DdlCliente.Text = HttpUtility.HtmlDecode(DR["CodTercero"].ToString().Trim()); } }
protected void BindDdl(string CodUG, string Accion) { if (Accion.Equals("UPD")) { Cnx.SelecBD(); using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = " EXEC SP_TablasGeneral 16,'CodUB','','','','','','','','',0,0,0,0,0,@ICC,'01-01-1','02-01-1','03-01-1'"; sqlConB.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB)) { SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]); SC.Parameters.AddWithValue("@CdUb", CodUG.Trim()); using (SqlDataAdapter SDA = new SqlDataAdapter()) { using (DataSet DSTDdl = new DataSet()) { SDA.SelectCommand = SC; SDA.Fill(DSTDdl); DSTDdl.Tables[0].TableName = "Busq"; DSTDdl.Tables[1].TableName = "Ubica"; DSTDdl.Tables[2].TableName = "DatosBase"; ViewState["DSTDdl"] = DSTDdl; } } } } } DSTDdl = (DataSet)ViewState["DSTDdl"]; DataRow[] Result; string VbCodAnt = ""; VbCodAnt = CodUG.Equals("") ? "0" : DdlBusq.Text.Trim(); DdlBusq.DataSource = DSTDdl.Tables[0]; DdlBusq.DataTextField = "NomBase"; DdlBusq.DataValueField = "IdBase"; DdlBusq.DataBind(); DdlBusq.Text = VbCodAnt; DataTable DT = new DataTable(); VbCodAnt = CodUG.Trim(); DT = DSTDdl.Tables[1].Clone(); Result = DSTDdl.Tables[1].Select("CodUbicaGeogr='" + CodUG.Trim() + "'");// trae el codigo actual por si esta inactivo foreach (DataRow Row in Result) { DT.ImportRow(Row); } Result = DSTDdl.Tables[1].Select("Activa=1"); foreach (DataRow Row in Result) { DT.ImportRow(Row); } DdlUbica.DataSource = DT; DdlUbica.DataTextField = "Nombre"; DdlUbica.DataValueField = "CodUbicaGeogr"; DdlUbica.DataBind(); DdlUbica.Text = VbCodAnt; }