protected void btnCanMP_Click(object sender, EventArgs e) { pnlMPB.Visible = false; MpUp_AB.Hide(); pnlMpBA.Visible = true; MpUp_MA.Show(); }
protected void lbtnId_Click(object sender, EventArgs e) { pnlMPB.Visible = false; MpUp_AB.Hide(); pnlMpBA.Visible = true; MpUp_MA.Show(); var id = ((LinkButton)sender).Text; var pPage = false; for (var i = 0; i <= gv_Alertas.PageCount - 1; i++) { gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.PageIndex = i; gv_Alertas.DataBind(); for (int j = 0; j <= gv_Alertas.Rows.Count - 1; j++) { if (((LinkButton)gv_Alertas.Rows[j].FindControl("lbtnIdMSGA")).Text.Trim() != id) { continue; } pPage = true; gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.PageIndex = i; gv_Alertas.DataBind(); gv_Alertas.Rows[j].BackColor = Color.LightYellow; break; } if (pPage) { break; } } }
protected void gv_Alertas_PageIndexChanging(object sender, GridViewPageEventArgs e) { gv_Alertas.PageIndex = e.NewPageIndex; gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.DataBind(); pnlMpBA.Visible = true; MpUp_MA.Show(); }
protected void lbtnIdMsgRel_Click(object sender, EventArgs e) { if (gvRelAlert.EditIndex == -1) { return; } if (((LinkButton)gvRelAlert.Rows[gvRelAlert.EditIndex].FindControl("lbtnIdMsgRel")).Text == "##") { return; } Session["dtAlBusq"] = ECmSp("alt.SPSIU_AL|@TCOM;4|@TTAB;1|@IDPAIS;" + ((IUsr)Session["Usr"]).usr.Pais.IdPais + "|@IDROL;" + ((IUsr)Session["Usr"]).usr.Rol.IdRol, System.Configuration.ConfigurationManager.ConnectionStrings["cnnCOS"].ToString(), 1); gv_Alertas.PageIndex = 0; gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.DataBind(); pnlMpBA.Visible = true; MpUp_MA.Show(); }
protected void btnBusq_Click(object sender, EventArgs e) { try { pnlMpBA.Visible = true; MpUp_MA.Show(); if (txtMSGBusq.Text != "" | txtIdBusq.Text != "") { lblEBusq.Visible = false; ServCBloqueados serv = new ServCBloqueados(); gv_Alertas.Visible = true; if (txtIdBusq.Text != "") { Session["dtAlBusq"] = serv.findValidity(txtIdBusq.Text, "7", ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.PageIndex = 0; gv_Alertas.DataBind(); } else if (txtMSGBusq.Text != "") { Session["dtAlBusq"] = serv.findValidity(txtMSGBusq.Text, "6", ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.PageIndex = 0; gv_Alertas.DataBind(); } } else { lblEBusq.Text = "Ingrese los datos solicitados"; lblEBusq.Visible = true; } } catch (Exception exc) { throw; } }
protected void btnBusq_Click(object sender, EventArgs e) { pnlMpBA.Visible = true; MpUp_MA.Show(); gv_Alertas.EditIndex = -1; gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.DataBind(); if (txtMSGBusq.Text != "" | txtIdBusq.Text != "") { lblEBusq.Visible = false; bool pPage = false; if (txtIdBusq.Text != "") { for (int i = 0; i <= gv_Alertas.PageCount - 1; i++) { gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.PageIndex = i; gv_Alertas.DataBind(); for (int j = 0; j <= gv_Alertas.Rows.Count - 1; j++) { if (((LinkButton)gv_Alertas.Rows[j].FindControl("lbtnIdMSGA")).Text.Trim() == txtIdBusq.Text.Trim()) { pPage = true; gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.PageIndex = i; gv_Alertas.DataBind(); gv_Alertas.Rows[j].BackColor = Color.LightYellow; break; } } if (pPage) { break; } } if (pPage == false) { gv_Alertas.DataSource = Session["dtAlBusq"]; gv_Alertas.PageIndex = 0; gv_Alertas.DataBind(); } } else if (txtMSGBusq.Text != "") { Session["dtABCon"] = ECmSp("alt.SPSIU_AL|@TCOM;5|@TTAB;1|@MSGTEXT;" + txtMSGBusq.Text.Trim() + "|@IDPAIS;" + ((IUsr)Session["Usr"]).usr.Pais.IdPais + "|@IDROL;" + ((IUsr)Session["Usr"]).usr.Rol.IdRol, System.Configuration.ConfigurationManager.ConnectionStrings["cnnCOS"].ToString(), 1); if (((DataTable)Session["dtABCon"]).Rows.Count > 0) { gv_ABusq.DataSource = Session["dtABCon"]; gv_ABusq.PageIndex = 0; gv_ABusq.DataBind(); pnlMPB.Visible = true; MpUp_AB.Show(); } } } else { lblEBusq.Text = "Ingrese el Id o el texto de la Alerta!!"; lblEBusq.Visible = true; } }
protected void gvCliBlo_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName) { case "Nuevo": { #region Nuevo Session["editOp"] = false; MpUp_MA.Hide(); gvCliBlo.EditIndex = -1; Session["dtDoc"] = null; DataTable dt = ((DataTable)Session["dtVigencia"]).Copy(); Session["RANew"] = Convert.ToInt32(e.CommandArgument.ToString()); if (dt.Rows[0][0].ToString() == "##" & gvCliBlo.Rows.Count == 1) { gvCliBlo.EditIndex = 0; gvCliBlo.DataSource = dt; gvCliBlo.DataBind(); } else { DataRow rw = dt.NewRow(); for (int i = 0; i <= dt.Columns.Count - 1; i++) { rw[i] = DBNull.Value; } dt.Rows.Add(rw); gvCliBlo.DataSource = dt; gvCliBlo.DataBind(); gvCliBlo.PageIndex = gvCliBlo.PageCount; gvCliBlo.DataBind(); gvCliBlo.EditIndex = gvCliBlo.Rows.Count - 1; gvCliBlo.DataBind(); } #endregion } break; case "Buscar": { #region Buscar Session["dtDoc"] = null; DataTable dt2 = ((DataTable)Session["dtVigencia"]).Copy(); if (dt2.Rows[0][0].ToString() == "##" & gvCliBlo.Rows.Count == 1) { return; } gvCliBlo.EditIndex = -1; gvCliBlo.DataSource = Session["dtVigencia"]; gvCliBlo.DataBind(); gv_Alertas.DataSource = new DataTable(); gv_Alertas.DataBind(); txtIdBusq.Text = String.Empty; txtMSGBusq.Text = String.Empty; lblId.Text = "Id:"; lblTxtCod.Text = "Codigo:"; txtIdBusq_TextBoxWatermarkExtender.WatermarkText = "Id"; txtMSGBusq_TextBoxWatermarkExtender.WatermarkText = "Cliente"; gv_Alertas.Visible = true; pnlMpBA.Visible = true; MpUp_MA.Show(); #endregion } break; case "Editar": { #region Editar Session["dtDoc"] = null; DataTable dt = ((DataTable)Session["dtVigencia"]).Copy(); ServCBloqueados serv = new ServCBloqueados(); string IdCli = gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].Cells[0].Text.Trim(); Session["editOp"] = true; MpUp_MA.Hide(); if (dt.Rows[0][0].ToString() != "##") { Session["RANew"] = 0; gvCliBlo.EditIndex = Convert.ToInt32(e.CommandArgument.ToString()); gvCliBlo.DataSource = Session["dtVigencia"]; gvCliBlo.DataBind(); } ((TextBox)gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("txtIdCli")).Enabled = false; var itemSelected = serv.findClient(IdCli.ToString(), "8", ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); #endregion } break; case "Guardar": { #region Guardar var Id = gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].Cells[0].Text.Trim(); var IdCli = ((TextBox)gvCliBlo.Rows[Convert.ToInt32(gvCliBlo.EditIndex)].FindControl("txtIdCli")).Text; var vigencia = ((TextBox)gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("txtVigencia")).Text.Trim(); ServCBloqueados serv = new ServCBloqueados(); switch (((int)Session["RANew"])) { case 0: { //Actualizar Cli string res = serv.updateValidyty(Id, IdCli, vigencia, ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); if (res.CompareTo("0") == 0) { lblEInsUp.ForeColor = Color.Red; lblEInsUp.Text = "No se ha podido realizar la modificación"; lblEInsUp.Visible = true; } else { Response.Redirect(Request.RawUrl); } } break; case 1: { //Nuevo Cli IdCli = ((TextBox)gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("txtIdCli")).Text.Trim(); string res = serv.insertValidity(IdCli, vigencia, ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); if (res.CompareTo("0") == 0) { lblEInsUp.ForeColor = Color.Red; lblEInsUp.Text = "El cliente ya se encuentra registrado"; lblEInsUp.Visible = true; } else { if (res.CompareTo("-1") == 0) { lblEInsUp.ForeColor = Color.Red; lblEInsUp.Text = "Datos Incorrectos"; lblEInsUp.Visible = true; } else { Response.Redirect(Request.RawUrl); } } } break; } #endregion } break; case "Borrar": { #region Borrar if (gvCliBlo.EditIndex != -1) { return; } var IdCli = gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].Cells[0].Text.Trim(); ServCBloqueados serv = new ServCBloqueados(); string res = serv.deleteValidity(IdCli, ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); if (res.CompareTo("0") == 0) { lblEInsUp.ForeColor = Color.Red; lblEInsUp.Text = "No se pudo eliminar el Cliente"; lblEInsUp.Visible = true; } else { Response.Redirect(Request.RawUrl); } #endregion } break; case "Cancelar": { #region Cancelar MpUp_MA.Hide(); Session["dtDoc"] = null; lblEInsUp.Visible = false; Session["RANew"] = 0; gvCliBlo.EditIndex = -1; gvCliBlo.DataSource = Session["dtVigencia"]; gvCliBlo.DataBind(); #endregion } break; } }
protected void gvCliBlo_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName) { case "Nuevo": { #region Nuevo Session["editOp"] = false; MpUp_MA.Hide(); gvCliBlo.EditIndex = -1; Session["dtDoc"] = null; DataTable dt = ((DataTable)Session["dtCBloqueados"]).Copy(); Session["RANew"] = Convert.ToInt32(e.CommandArgument.ToString()); if (dt.Rows[0][0].ToString() == "##" & gvCliBlo.Rows.Count == 1) { gvCliBlo.EditIndex = 0; gvCliBlo.DataSource = dt; gvCliBlo.DataBind(); } else { DataRow rw = dt.NewRow(); for (int i = 0; i <= dt.Columns.Count - 1; i++) { rw[i] = DBNull.Value; } dt.Rows.Add(rw); gvCliBlo.DataSource = dt; gvCliBlo.DataBind(); gvCliBlo.PageIndex = gvCliBlo.PageCount; gvCliBlo.DataBind(); gvCliBlo.EditIndex = gvCliBlo.Rows.Count - 1; gvCliBlo.DataBind(); } IServCBloqueados serv = new ServCBloqueados(); var dtTEx = serv.getTypeExceptions(); LdDdlGv(gvCliBlo, dtTEx, "ddlTExCli | IdTEx | NTEx", 1); #endregion } break; case "Buscar": { #region Buscar Session["dtDoc"] = null; DataTable dt2 = ((DataTable)Session["dtCBloqueados"]).Copy(); if (dt2.Rows[0][0].ToString() == "##" & gvCliBlo.Rows.Count == 1) { return; } gvCliBlo.EditIndex = -1; gvCliBlo.DataSource = Session["dtCBloqueados"]; gvCliBlo.DataBind(); gv_Alertas.DataSource = new DataTable(); gv_Alertas.DataBind(); txtIdBusq.Text = String.Empty; txtMSGBusq.Text = String.Empty; lblId.Text = "Id:"; lblTxtCod.Text = "Codigo:"; txtIdBusq_TextBoxWatermarkExtender.WatermarkText = "Id"; txtMSGBusq_TextBoxWatermarkExtender.WatermarkText = "Cliente"; gv_Alertas.Visible = true; pnlMpBA.Visible = true; MpUp_MA.Show(); #endregion } break; case "Editar": { #region Editar Session["dtDoc"] = null; DataTable dt = ((DataTable)Session["dtCBloqueados"]).Copy(); DropDownList ddl = ((DropDownList)gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("ddlTExCli")); ServCBloqueados serv = new ServCBloqueados(); string IdCli = gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].Cells[0].Text.Trim(); string tEx = ""; Session["editOp"] = true; MpUp_MA.Hide(); if (dt.Rows[0][0].ToString() != "##") { Session["RANew"] = 0; gvCliBlo.EditIndex = Convert.ToInt32(e.CommandArgument.ToString()); gvCliBlo.DataSource = Session["dtCBloqueados"]; gvCliBlo.DataBind(); } ((TextBox)gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("txtIdCli")).Enabled = false; var dtTEx = serv.getTypeExceptions(); var itemSelected = serv.findClient(IdCli.ToString(), "8", ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); foreach (DataRow row in itemSelected.Rows) { tEx = row["IdTEx"].ToString(); } LdDdlGv(gvCliBlo, dtTEx, "ddlTExCli | IdTEx | NTEx", 2, null, tEx); #endregion } break; case "Guardar": { #region Guardar var Id = gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].Cells[0].Text.Trim(); var IdCli = ((TextBox)gvCliBlo.Rows[Convert.ToInt32(gvCliBlo.EditIndex)].FindControl("txtIdCli")).Text; var deudor = ((TextBox)gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("txtDeudor")).Text.Trim(); ServCBloqueados serv = new ServCBloqueados(); switch (((int)Session["RANew"])) { case 0: { //Actualizar Cli DropDownList ddl = ((DropDownList)gvCliBlo.Rows[Convert.ToInt32(gvCliBlo.EditIndex)].FindControl("ddlTExCli")); string selectedTE = Session["selectedEx"].ToString(); string res = serv.updateClient(Id, IdCli, deudor, ((IUsr)Session["Usr"]).usr.CemexId, ddl.SelectedValue, selectedTE, ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); if (res.CompareTo("0") == 0) { lblEInsUp.ForeColor = Color.Red; lblEInsUp.Text = "No se ha podido realizar la modificación"; lblEInsUp.Visible = true; } else { Response.Redirect(Request.RawUrl); } } break; case 1: { //Nuevo Cli IdCli = ((TextBox)gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("txtIdCli")).Text.Trim(); DropDownList ddl = ((DropDownList)gvCliBlo.Rows[Convert.ToInt32(gvCliBlo.EditIndex)].FindControl("ddlTExCli")); string selected = ddl.SelectedValue; string res = ""; if (selected.CompareTo("0") == 0 || IdCli.CompareTo("") == 0) { res = "-1"; } else { res = serv.insertClient(IdCli, deudor, ((IUsr)Session["Usr"]).usr.CemexId, ddl.SelectedValue, ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString(), "4"); } if (res.CompareTo("0") == 0) { lblEInsUp.ForeColor = Color.Red; lblEInsUp.Text = "El cliente ya se encuentra registrado con ese tipo de Excepción"; lblEInsUp.Visible = true; } else { if (res.CompareTo("-1") == 0) { lblEInsUp.ForeColor = Color.Red; lblEInsUp.Text = "Datos Incorrectos"; lblEInsUp.Visible = true; } else { Response.Redirect(Request.RawUrl); } } } break; } #endregion } break; case "Borrar": { #region Borrar if (gvCliBlo.EditIndex != -1) { return; } int ent; var IdCli = gvCliBlo.Rows[Convert.ToInt32(e.CommandArgument.ToString())].Cells[0].Text.Trim(); ServCBloqueados serv = new ServCBloqueados(); string res = serv.deleteClient(IdCli, ((IUsr)Session["Usr"]).usr.Pais.IdPais.ToString()); if (res.CompareTo("0") == 0) { lblEInsUp.ForeColor = Color.Red; lblEInsUp.Text = "No se pudo eliminar el Cliente"; lblEInsUp.Visible = true; } else { Response.Redirect(Request.RawUrl); } #endregion } break; case "Cancelar": { #region Cancelar MpUp_MA.Hide(); Session["dtDoc"] = null; lblEInsUp.Visible = false; Session["RANew"] = 0; gvCliBlo.EditIndex = -1; gvCliBlo.DataSource = Session["dtCBloqueados"]; gvCliBlo.DataBind(); #endregion } break; } }