protected void GrdDatos_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("AddNew")) { if (DdlForm.Text.Equals("-1")) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Debe seleccionar un formulario');", true); DdlForm.Focus(); return; } TextBox TxtObjPP = (GrdDatos.FooterRow.FindControl("TxtObjPP") as TextBox); TextBox TxtDescPP = (GrdDatos.FooterRow.FindControl("TxtDescPP") as TextBox); TextBox TxtEspaPP = (GrdDatos.FooterRow.FindControl("TxtEspaPP") as TextBox); TextBox TxtInglPP = (GrdDatos.FooterRow.FindControl("TxtInglPP") as TextBox); if (TxtObjPP.Text.Equals("")) { TxtObjPP.Focus(); return; } if (TxtDescPP.Text.Equals("")) { TxtDescPP.Focus(); return; } if (TxtEspaPP.Text.Equals("")) { TxtEspaPP.Focus(); return; } if (TxtInglPP.Text.Equals("")) { TxtInglPP.Focus(); return; } using (SqlConnection sqlCon = new SqlConnection(Cnx.BaseDatosPrmtr())) { sqlCon.Open(); string VBQuery = "EXEC SP_Configuracion 4, @Es,@En, @Obj,@Desc, @Usu, @Id,0,0,0,'01-01-1','02-01-1','03-01-1'"; using (SqlCommand SC = new SqlCommand(VBQuery, sqlCon)) { SC.Parameters.AddWithValue("@Es", TxtEspaPP.Text.Trim()); SC.Parameters.AddWithValue("@En", TxtInglPP.Text.Trim()); SC.Parameters.AddWithValue("@Obj", TxtObjPP.Text.Trim()); SC.Parameters.AddWithValue("@Desc", TxtDescPP.Text.Trim()); SC.Parameters.AddWithValue("@Usu", Session["C77U"].ToString().Trim()); SC.Parameters.AddWithValue("@Id", DdlForm.Text.Trim()); try { var Mensj = SC.ExecuteScalar(); if (!Mensj.ToString().Trim().Equals("")) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + Mensj + "');", true); return; } SC.ExecuteNonQuery(); BindData("UPD"); } catch (Exception) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Incovenientes con la creación');", true); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Login77"] == null) { if (Cnx.GetProduccion().Trim().Equals("Y")) { Response.Redirect("~/FrmAcceso.aspx"); } } ViewState["PFileName"] = System.IO.Path.GetFileNameWithoutExtension(Request.PhysicalPath); // Nombre del archivo Page.Title = string.Format("Idioma"); if (Session["C77U"] == null) { Session["C77U"] = ""; if (Cnx.GetProduccion().Trim().Equals("N")) { Session["C77U"] = Cnx.GetUsr(); //00000082|00000133 Session["D[BX"] = Cnx.GetBD(); //|DbNeoDempV2 |DbNeoAda | DbNeoHCT Session["$VR"] = Cnx.GetSvr(); Session["V$U@"] = Cnx.GetUsSvr(); Session["P@$"] = Cnx.GetPas(); Session["N77U"] = Session["D[BX"]; Session["Nit77Cia"] = Cnx.GetNit(); // 811035879-1 TwoGoWo |800019344-4 DbNeoAda | 860064038-4 DbNeoHCT Session["!dC!@"] = Cnx.GetIdCia(); Session["77IDM"] = Cnx.GetIdm(); } } if (!IsPostBack) { ViewState["PageTit"] = ""; TitForm.Text = "Idioma"; using (SqlConnection sqlCon = new SqlConnection(Cnx.BaseDatosPrmtr())) { DataTable DT = new DataTable(); string VbTxtSql = " EXEC SP_Configuracion 2,'','','','','DDL',0,0,0,0,'01-01-1','02-01-1','03-01-1'"; sqlCon.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlCon)) { SqlDataAdapter SDA = new SqlDataAdapter(); SDA.SelectCommand = SC; SDA.Fill(DT); DdlForm.DataSource = DT; DdlForm.DataTextField = "Nombre"; DdlForm.DataValueField = "IdFormulario"; DdlForm.DataBind(); DdlForm.Text = "0"; } } BindData("UPD"); if (Session["C77U"].ToString().Trim().Equals("00000082")) { TxtIdCia.Visible = true; TxtPassCia.Visible = true; IbtCambioPassCia.Visible = true; } } ScriptManager.RegisterClientScriptBlock(this, GetType(), "none", "<script>myFuncionddl();</script>", false); }