Ejemplo n.º 1
0
 protected void BindSn(string PN)
 {
     Cnx.SelecBD();
     using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex()))
     {
         string VbTxtSql = "EXEC SP_PANTALLA_ADVICE 16, @P,'','','SN',0,0,0,@ICC,'01-1-2009','01-01-1900','01-01-1900'";
         sqlConB.Open();
         using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB))
         {
             SC.Parameters.AddWithValue("@P", PN.Trim());
             SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]);
             using (SqlDataAdapter SDA = new SqlDataAdapter())
             {
                 using (DataSet DSTDdl = new DataSet())
                 {
                     SDA.SelectCommand = SC;
                     SDA.Fill(DSTDdl);
                     DdlSN.DataSource     = DSTDdl.Tables[0];
                     DdlSN.DataTextField  = "SN";
                     DdlSN.DataValueField = "Codigo";
                     DdlSN.DataBind();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        protected void DdlPN_TextChanged(object sender, EventArgs e)
        {
            Cnx.SelecBD();
            using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex()))
            {
                string VbTxtSql = "EXEC SP_PANTALLA_ADVICE 16, @P,'','','SN',0,0,0,@ICC,'01-1-2009','01-01-1900','01-01-1900'";
                sqlConB.Open();
                using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB))
                {
                    SC.Parameters.AddWithValue("@P", DdlPN.Text);
                    SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]);
                    using (SqlDataAdapter SDA = new SqlDataAdapter())
                    {
                        using (DataSet DSTDdl = new DataSet())
                        {
                            SDA.SelectCommand = SC;
                            SDA.Fill(DSTDdl);

                            DdlSN.DataSource     = DSTDdl.Tables[0];
                            DdlSN.DataTextField  = "SN";
                            DdlSN.DataValueField = "Codigo";
                            DdlSN.DataBind();

                            DdlModel.DataSource     = DSTDdl.Tables[1];
                            DdlModel.DataTextField  = "Descripcion";
                            DdlModel.DataValueField = "CodModelo";
                            DdlModel.DataBind();
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected void BindSn(string PN)
        {
            string LtxtSql = string.Format("EXEC SP_PANTALLA_ADVICE 16,'{0}','','','SN',0,0,0,{1},'01-1-2009','01-01-1900','01-01-1900'", PN.Trim(), Session["!dC!@"]);

            DdlSN.DataSource     = Cnx.DSET(LtxtSql);
            DdlSN.DataTextField  = "SN";
            DdlSN.DataValueField = "Codigo";
            DdlSN.DataBind();
        }
 protected void BindBDdlSN(string Pn, string Sn)
 {
     DSTPSL = (DataSet)ViewState["DSTPSL"];
     if (DSTPSL.Tables["SN"].Rows.Count > 0)
     {
         DdlSN.DataSource     = DSTPSL.Tables[1];
         DdlSN.DataTextField  = "SN";
         DdlSN.DataValueField = "Codigo";
         DdlSN.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();
                            }
                        }
                    }
                }
            }
        }