protected void btneliminarGridView_Command(object sender, CommandEventArgs e) { try { if (e.CommandName != "Page") { BllTipoDocumento.TipoDocumento Row = new BllTipoDocumento.TipoDocumento(); List<BllTipoDocumento.TipoDocumento> Rows = new List<BllTipoDocumento.TipoDocumento>(); Rows = (List<BllTipoDocumento.TipoDocumento>)Session["ListTipoDocumento"]; Session["CodigoActividad"] = e.CommandArgument; if (Rows.Exists(b => b.TiDoCodi.ToString() == e.CommandArgument.ToString())) { Row = Rows.Where(b => b.TiDoCodi.ToString() == e.CommandArgument.ToString()).First(); Row.TiPoEsta = false; int r = Row.Desactivar(); if (r > 0) { FillTipoDocumento(); Metodos.divMensaje(Constantes.Danger, Constantes.Eliminado, PnlMsg, Constantes.Fallo); updateGrid.Update(); } } } } catch (Exception ex) { Metodos.divMensaje(Constantes.Danger, Constantes.ErrorAlConsultarDatos, PnlMsg, Constantes.Fallo); Log.EscribirError(ex); } }
protected void BtnGuardar_Click(object sender, EventArgs e) { try { BllTipoDocumento.TipoDocumento ObjGrabar = new BllTipoDocumento.TipoDocumento(); if(TxtCargo.Text!="") if (BllTipoDocumento.Existe(TxtCodigo.Text) == 0) { //ObjGrabar.TiDoCodi = TxtCodigo.Text; ObjGrabar.TiDoDocu = TxtCargo.Text; ObjGrabar.TiPoEsta = ChkActivo.Checked; ObjGrabar.TiDoMens = chkmensajeria.Checked; ObjGrabar.TiDoDele = chkDelete.Checked; ObjGrabar.TiDoOrMe=int.Parse(OrdenMensajeria1.SelectedValue); ObjGrabar.TiDoSubn=Subnormal.Checked; ObjGrabar.TiDoImpr=Imprimir.Checked; int r = ObjGrabar.Insert(); if (r > 0) { Metodos.divMensaje(Constantes.Succes, Constantes.Guardado, PnlMsg, Constantes.Ok); FillTipoDocumento(); updateGrid.Update(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "mostrarGrid();", true); } else { Metodos.divMensaje(Constantes.Danger, Constantes.ErrorAlGuardar, PnlMsg, Constantes.Fallo); } } } catch (Exception ex) { Metodos.divMensaje(Constantes.Danger, Constantes.errorGeneral, PnlMsg, Constantes.Fallo); Log.EscribirError(ex); } }
protected void btnDelete_Command(object sender, CommandEventArgs e) { try { if (e.CommandName == "delete") { BllDocumentos.Documentos Docu = new BllDocumentos.Documentos(); BllTipoDocumento.TipoDocumento TiDo = new BllTipoDocumento.TipoDocumento(); Docu = BllDocumentos.GetCargo(int.Parse(e.CommandArgument.ToString())); TiDo = BllTipoDocumento.GetCargo(Docu.DocuTiDo); if (TiDo.TiDoDele == true) { File.Delete(Server.MapPath(Docu.DocuUrLo)); if (BllDocumentos.Delete(Docu.DocuCodi.Value)) { FillDocumentos(); Metodos.divMensaje(Constantes.Succes, Constantes.Eliminado, PnlMsg, Constantes.Ok); } else { Metodos.divMensaje(Constantes.Danger, Constantes.ErrorEliminando, PnlMsg, Constantes.Fallo); } } } } catch (Exception ex) { Log.EscribirError(ex); } }
protected void gridDocume_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { var Link = e.Row.FindControl("LinkHGI") as HyperLink; BllDocumentos.Documentos D = (BllDocumentos.GetCargo((int.Parse(e.Row.Cells[0].Text.ToString())))); var V = e.Row.FindControl("ImgVer") as Image; var S = e.Row.FindControl("ImgS") as Image; var C = e.Row.FindControl("chkVer") as CheckBox; var CV = e.Row.FindControl("ChkSin") as CheckBox; var dele = e.Row.FindControl("btnDelete") as ImageButton; BllTipoDocumento.TipoDocumento TiDo = new BllTipoDocumento.TipoDocumento(); TiDo = BllTipoDocumento.GetCargo(D.DocuTiDo); if (TiDo.TiDoDele == true) { dele.Visible = true; } else { dele.Visible = false; } if (Usuario.id_rol == 10 || Usuario.id_rol == 10017) { e.Row.Cells[7].Visible = true; } else { e.Row.Cells[7].Visible = false; } if (D.DocuVeri == "1") { V.Visible = true; } else { C.Visible = true; } if (D.DocuSincro == "1") { S.Visible = true; } else { CV.Visible = true; } if (Link.NavigateUrl != "") { Link.Visible = true; Link.NavigateUrl = "Download.aspx?FileName=" + D.DocuCodi; Link.Target = "_Blank"; } else { Link.Visible = false; } } } catch (Exception ex) { Log.EscribirError(ex); } }
protected void BtnSelect_Command(object sender, CommandEventArgs e) { try { if (e.CommandName != "Page") { BllTipoDocumento.TipoDocumento Row = new BllTipoDocumento.TipoDocumento(); List<BllTipoDocumento.TipoDocumento> Rows = new List<BllTipoDocumento.TipoDocumento>(); Rows = (List<BllTipoDocumento.TipoDocumento>)Session["ListTipoDocumento"]; Session["CodigoActividad"] = e.CommandArgument; if (Rows.Exists(b => b.TiDoCodi.ToString() == e.CommandArgument.ToString())) { Row = Rows.Where(b => b.TiDoCodi.ToString() == e.CommandArgument.ToString()).First(); TxtCodigo.Enabled = false; TxtCodigo.Text = Row.TiDoCodi.ToString(); TxtCargo.Text = Row.TiDoDocu; chkmensajeria.Checked=Row.TiDoMens; chkDelete.Checked=Row.TiDoDele; ChkActivo.Checked = Row.TiPoEsta; OrdenMensajeria1.SelectedValue= Row.TiDoOrMe.ToString(); Subnormal.Checked = Row.TiDoSubn; Imprimir.Checked = Row.TiDoImpr; BtnGuardar.Visible = false; UpdateNew.Update(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "mostrarDatos();", true); } } } catch (Exception ex) { Metodos.divMensaje(Constantes.Danger, Constantes.errorGeneral, PnlMsg, Constantes.Fallo); Log.EscribirError(ex); } }