Exemplo n.º 1
0
 protected void ValidarCampos()
 {
     Idioma = (DataTable)ViewState["TablaIdioma"];
     ViewState["Validar"] = "S";
     if (TxtNuevoPass.Text.Trim().Equals(""))
     {
         DataRow[] Result = Idioma.Select("Objeto= 'MensAcc02'");
         foreach (DataRow row in Result)
         {
             ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "IdntificadorBloqueScript", "alert('" + row["Texto"].ToString() + "');", true);
         }
         ViewState["Validar"] = "N"; TxtNuevoPass.Focus(); return;
     }
     if (TxtConfirmarPass.Text.Trim().Equals(""))
     {
         DataRow[] Result = Idioma.Select("Objeto= 'MensAcc03'");
         foreach (DataRow row in Result)
         {
             ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "IdntificadorBloqueScript", "alert('" + row["Texto"].ToString() + "');", true);
         }                                                                                                                                                                    //Debe ingresar la confirmarción');", true);
         ViewState["Validar"] = "N"; TxtConfirmarPass.Focus(); return;
     }
     if (!TxtNuevoPass.Text.Trim().Equals(TxtConfirmarPass.Text))
     {
         DataRow[] Result = Idioma.Select("Objeto= 'MensAcc04'");
         foreach (DataRow row in Result)
         {
             ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "IdntificadorBloqueScript", "alert('" + row["Texto"].ToString() + "');", true);
         }                                                                                                                                                                    //Las contraseñas son diferentes');", true);
         ViewState["Validar"] = "N"; TxtNuevoPass.Focus(); return;
     }
 }
Exemplo n.º 2
0
 protected void TbnIngresar_Click(object sender, EventArgs e)
 {
     Cnx.SelecBD();
     using (SqlConnection sqlCon = new SqlConnection(Cnx.GetConex()))
     {
         Idioma = (DataTable)ViewState["TablaIdioma"];
         string     LtxtSql = " EXEC SP_ConfiguracionV2_ 2,@H77,@H775,'','','',@PI,0,0, @ICC,'01-01-1','02-01-1','03-01-1'";
         SqlCommand Comando = new SqlCommand(LtxtSql, sqlCon);
         Comando.Parameters.AddWithValue("@H77", TxtUsuario.Text);
         Comando.Parameters.AddWithValue("@H775", TxtClave.Text);
         Comando.Parameters.AddWithValue("@PI", Session["77IDM"].ToString().Trim());
         Comando.Parameters.AddWithValue("@ICC", Session["!dC!@"]);
         sqlCon.Open();
         SqlDataReader registro = Comando.ExecuteReader();
         if (registro.Read())
         {
             TbnIngresar.Visible      = false;
             TxtClave.Visible         = false;
             TxtNuevoPass.Visible     = true;
             TxtConfirmarPass.Visible = true;
             BtnCambioPass.Visible    = true;
         }
         else
         {
             DataRow[] Result4 = Idioma.Select("Objeto= 'MensAcc01'");
             foreach (DataRow row in Result4)
             {
                 ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "IdntificadorBloqueScript", "alert('" + row["Texto"].ToString() + "');", true);
             }
         }
     }
 }
Exemplo n.º 3
0
        protected void AsignarValores()
        {
            Session["VldrElem"] = "S";
            Idioma = (DataTable)ViewState["TablaIdioma"];
            if (DdlPN.Text == String.Empty)
            {
                DataRow[] Result = Idioma.Select("Objeto= 'Mens03Elem'");
                foreach (DataRow row in Result)
                {
                    ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "alert", "alert('" + row["Texto"].ToString().Trim() + "');", true);
                }                                                                                                                                                       //Debe ingresar el P/N')", true);
                Session["VldrElem"] = "N";
                return;
            }
            if (ViewState["IdentificadorE"].Equals("SN") && TxtSN.Text.Equals(""))
            {
                DataRow[] Result = Idioma.Select("Objeto= 'Mens04Elem'");
                foreach (DataRow row in Result)
                {
                    ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "alert", "alert('" + row["Texto"].ToString().Trim() + "');", true);
                }                                                                                                                                                       //Debe ingresar una S/N')", true);
                Session["VldrElem"] = "N";
                return;
            }
            string VBQuery;

            Cnx.SelecBD();
            using (SqlConnection sqlCon = new SqlConnection(Cnx.GetConex()))
            {
                sqlCon.Open();
                VBQuery = "EXEC SP_PANTALLA_Elemento 11, @CE,@PN,@SN,'VALIDA',0,0,0,@ICC,'01-1-2009','01-01-1900','01-01-1900'";
                SqlCommand SC = new SqlCommand(VBQuery, sqlCon);
                SC.Parameters.AddWithValue("@CE", TxtCod.Text.Trim());
                SC.Parameters.AddWithValue("@PN", DdlPN.Text.Trim());
                SC.Parameters.AddWithValue("@SN", TxtSN.Text.Trim());
                SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]);
                SqlDataReader SDR = SC.ExecuteReader();
                if (SDR.Read())
                {
                    string    Mensj  = SDR["Mensj"].ToString().Trim();
                    DataRow[] Result = Idioma.Select("Objeto= '" + Mensj + "'");
                    foreach (DataRow row in Result)
                    {
                        Mensj = row["Texto"].ToString().Trim();
                    }

                    ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "alert", "alert('" + Mensj + "');", true);
                    Session["VldrElem"] = "N";
                    return;
                }
            }
        }
Exemplo n.º 4
0
        protected void BtnModificar_Click(object sender, EventArgs e)
        {
            Idioma = (DataTable)ViewState["TablaIdioma"];
            if (RdbInactivo.Checked == true)
            {
                if (DdlGrupo.SelectedValue.Equals("03"))
                {
                    string vlabee = ViewState["CodBodegaE"].ToString();
                    if (ViewState["CodBodegaE"].Equals("") || ViewState["CodBodegaE"].Equals("PREC-") || ViewState["CodBodegaE"].Equals("--") || ViewState["CodBodegaE"].Equals("Limbo") || ViewState["CodBodegaE"].Equals("BAJA"))
                    {
                        DataRow[] Result = Idioma.Select("Objeto= 'Mens01Elem'");
                        foreach (DataRow row in Result)
                        {
                            ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "alert", "alert('" + row["Texto"].ToString().Trim() + "');", true);
                        }                                                                                                                                                       // El elemento se encuentra inactivo
                        return;
                    }
                }
                else
                {
                    DataRow[] Result = Idioma.Select("Objeto= 'Mens01Elem'");
                    foreach (DataRow row in Result)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "alert", "alert('" + row["Texto"].ToString().Trim() + "');", true);
                    }                                                                                                                                                       // El elemento se encuentra inactivo')", true);
                    return;
                }
            }
            if (ViewState["Accion"].ToString().Trim().Equals(""))
            {
                if (!ViewState["FechaVenceE"].Equals("S"))
                {
                    if (!ViewState["IdentificadorE"].Equals("SN"))
                    {
                        DataRow[] Result = Idioma.Select("Objeto= 'Mens02Elem'");
                        foreach (DataRow row in Result)
                        {
                            ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "alert", "alert('" + row["Texto"].ToString().Trim() + "');", true);
                        }                                                                                                                                                       // Sólo aplica a elementos configurados con fecha de vencimiento')", true);
                        return;
                    }
                }
                ActivarBotones(false, true, false, false, false);
                ViewState["Accion"] = "Aceptar";
                DataRow[] Result1 = Idioma.Select("Objeto= 'BotonIngOk'");
                foreach (DataRow row in Result1)
                {
                    BtnModificar.Text = row["Texto"].ToString().Trim();
                }                                                 //Aceptar
                ActivarCampos(false, true, "Modificar");
                Result1 = Idioma.Select("Objeto= 'MensConfMod'"); //MensConfIng |MensConfMod
                foreach (DataRow row in Result1)
                {
                    BtnModificar.OnClientClick = string.Format("return confirm('" + row["Texto"].ToString().Trim() + "');");
                }                                                                                                           //Desea realizar la actualización
                BindDataDdl("UPDATE");
                DdlPN.Text    = ViewState["PNAntEle"].ToString();
                DdlGrupo.Text = ViewState["GrupoEle"].ToString();
            }
            else
            {
                AsignarValores();
                if (Session["VldrElem"].ToString() == "N")
                {
                    return;
                }

                string VbMnsj = Cnx.ValidarFechas2(TxtFecRec.Text.Trim(), TxtFecShelfLife.Text.Trim(), 2);
                if (!VbMnsj.ToString().Trim().Equals(""))
                {
                    DataRow[] Result = Idioma.Select("Objeto= '" + VbMnsj.ToString().Trim() + "'");
                    foreach (DataRow row in Result)
                    {
                        VbMnsj = row["Texto"].ToString().Trim();
                    }
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + VbMnsj + "');", true);
                    Page.Title = ViewState["PageTit"].ToString(); TxtFecShelfLife.Focus();
                    return;
                }

                Cnx.SelecBD();
                using (SqlConnection sqlCon = new SqlConnection(Cnx.GetConex()))
                {
                    sqlCon.Open();
                    using (SqlTransaction Transac = sqlCon.BeginTransaction())
                    {
                        string VBQuery = string.Format("EXEC SP_TablasIngenieria 3,'{0}',@PN,@SN,'{1}','{2}','','','','',@Act,0,0,0,0,@ICC,@FecSL,'02-01-1','03-01-1'",
                                                       TxtCod.Text, Session["C77U"].ToString(), TxtRef.Text);
                        using (SqlCommand SC = new SqlCommand(VBQuery, sqlCon, Transac))
                        {
                            try
                            {
                                SC.Parameters.AddWithValue("@PN", DdlPN.SelectedValue);
                                SC.Parameters.AddWithValue("@SN", TxtSN.Text.Trim());
                                SC.Parameters.AddWithValue("@Act", RdbActivo.Checked == true ? 1 : 0);
                                SC.Parameters.AddWithValue("@FecSL", Convert.ToDateTime(TxtFecShelfLife.Text));
                                SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]);
                                SC.ExecuteNonQuery();
                                Transac.Commit();
                                ViewState["Accion"] = "";
                                DataRow[] Result1 = Idioma.Select("Objeto= 'BtnModificar'");
                                foreach (DataRow row in Result1)
                                {
                                    BtnModificar.Text = row["Texto"].ToString().Trim();
                                }                                                      //Modificar
                                ActivarBotones(true, true, true, true, true);
                                ActivarCampos(false, false, "");
                                BtnModificar.OnClientClick = "";
                                ViewState["PNAntEle"]      = DdlPN.Text.Trim();
                                ViewState["SNAntEle"]      = TxtSN.Text.Trim();
                                ViewState["GrupoEle"]      = DdlGrupo.Text.Trim();
                                BIndDataCntdr(TxtCod.Text);
                                BindDataDdl("");
                                DdlPN.Text    = ViewState["PNAntEle"].ToString();
                                DdlGrupo.Text = ViewState["GrupoEle"].ToString();
                            }
                            catch (Exception ex)
                            {
                                Transac.Rollback();

                                DataRow[] Result = Idioma.Select("Objeto= 'MensErrMod'");
                                foreach (DataRow row in Result)
                                {
                                    ScriptManager.RegisterClientScriptBlock(this.UpPnlCampos, UpPnlCampos.GetType(), "alert", "alert('" + row["Texto"].ToString() + "');", true);
                                }                                                                                                                                                //
                                Cnx.UpdateErrorV2(Session["C77U"].ToString(), "FrmElemento", "UPDATE", ex.StackTrace.Substring(ex.StackTrace.Length - 300, 300), ex.Message, Session["77Version"].ToString(), Session["77Act"].ToString());
                            }
                        }
                        TraerDatos("UPD");
                    }
                }
            }
        }