public void CargarRespaldos() { try { DataTable Data = new DataTable(); Data.Columns.Add("NombreArchivo"); Data.Columns.Add("FechaCreacion"); string Ruta = HttpContext.Current.Server.MapPath(@"~\App_Data\Respaldos"); if (System.IO.Directory.Exists(Ruta)) { string[] files = System.IO.Directory.GetFiles(Ruta, "*.bak"); foreach (string s in files) { if (System.IO.File.Exists(s)) { FileInfo Info = new FileInfo(s); string NombreArchivo = s.Replace(Ruta, "").Replace("\\", ""); string FechaCreacion = Info.CreationTime.ToString(); Info.Length.ToString(); //ListReportes.Items.Add(s.Replace(Ruta, ""), s.Replace(Ruta, ""), "~/Content/report-icon-32.jpg"); Data.Rows.Add(new Object[] { NombreArchivo, FechaCreacion }); } } GridView_Respaldos.DataSource = Data; GridView_Respaldos.DataBind(); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void GridView_Lotes_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { e.Cancel = true; clsLotes Lote = new clsLotes(); FG._NombreUsuario = HttpContext.Current.User.Identity.Name; string IdentityUser = FG.CrearIdentificadorUsuario(FG._NombreUsuario); Lote.IdLote = 0; Lote.IdBloque = Convert.ToInt32(e.NewValues["IdBloque"].ToString()); Lote.NumeroLote = e.NewValues["NumeroLote"].ToString(); Lote.Area = Convert.ToDouble(e.NewValues["Area"]); Neg.AgregarActualizarLote(Lote, IdentityUser); string MsjSQL = FG.Obtener_MensajeSQL(IdentityUser); if (MsjSQL != "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('" + MsjSQL + "');", true); return; } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('Registro creado con éxito.');", true); GridView_Lotes.CancelEdit(); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void GridView_Moras_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { e.Cancel = true; clsMoras Mora = new clsMoras(); FG._NombreUsuario = HttpContext.Current.User.Identity.Name; string IdentityUser = FG.CrearIdentificadorUsuario(FG._NombreUsuario); Mora.IdMora = 0; Mora.Minimo = Convert.ToInt32(e.NewValues["Minimo"]); Mora.Maximo = Convert.ToInt32(e.NewValues["Maximo"]); Mora.Porcentaje = Convert.ToDouble(e.NewValues["Porcentaje"]); Neg.AgregarActualizarMora(Mora, IdentityUser); string MsjSQL = FG.Obtener_MensajeSQL(IdentityUser); if (MsjSQL != "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('" + MsjSQL + "');", true); return; } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('Registro creado con éxito.');", true); GridView_Moras.CancelEdit(); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void GridView_Beneficiarios_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { e.Cancel = true; clsBeneficiarios Beneficario = new clsBeneficiarios(); FG._NombreUsuario = HttpContext.Current.User.Identity.Name; string IdentityUser = FG.CrearIdentificadorUsuario(FG._NombreUsuario); Beneficario.IdBeneficiario = 0; Beneficario.NombreCompleto = e.NewValues["NombreCompleto"].ToString(); Beneficario.CedulaIdentidad = e.NewValues["CedulaIdentidad"].ToString(); Beneficario.Direccion = e.NewValues["Direccion"] != null ? e.NewValues["Direccion"].ToString() : ""; Beneficario.Telefono = e.NewValues["Telefono"].ToString(); Neg.AgregarActualizarBeneficiario(Beneficario, IdentityUser); string MsjSQL = FG.Obtener_MensajeSQL(IdentityUser); if (MsjSQL != "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('" + MsjSQL + "');", true); return; } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('Registro creado con éxito.');", true); GridView_Beneficiarios.CancelEdit(); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void Page_Load(object sender, EventArgs e) { try { if (HttpContext.Current.User.Identity.Name == "") { Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { LimpiarCampos(); } if (lblIdProforma.Text == "0") { Btn_Imprimir.Enabled = false; } else { Btn_Imprimir.Enabled = true; GenerarProforma(); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
//BOTON PARA REGISTRAR NUEVO PAGO protected void ASPxButton_Nuevo_Click(object sender, EventArgs e) { try { GridViewGroupRowTemplateContainer row = (GridViewGroupRowTemplateContainer)((sender as ASPxButton).NamingContainer); string IdAsignacion = row.KeyValue.ToString(); Session["IdAsignacionPago"] = IdAsignacion; Session["IdPago"] = "0"; Response.Redirect("RegistrarPago.aspx"); } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void Page_Load(object sender, EventArgs e) { try { DataSet Datos = new DataSet(); string sql = "select count(IdUbicacion) from Ubicaciones " + "union ALL " + "select distinct count(IdLote) Lotes from Lotes " + "union ALL " + "select count(distinct IdBeneficiario) Clientes from Asignaciones where Estado = 'Vigente' " + "union ALL " + "select ISNULL(SUM(ISNULL(MontoPago,0)+ISNULL(Interés, 0) + ISNULL(Mora, 0)),0) from Pagos where convert(date, FechaRecibo) = convert(date, GETDATE()) AND Moneda= 'DÓLARES' " + "union ALL " + "select ISNULL(SUM(MontoEfectivo),0) from Pagos where convert(date, FechaRecibo) = convert(date, GETDATE()) AND Moneda= 'CÓRDOBAS'"; FG.MakeRecordSet(Datos, sql, ""); if (Datos.Tables[0].Rows.Count != 0) { string Proyectos = Datos.Tables[0].Rows[0][0].ToString(); string Lotes = Datos.Tables[0].Rows[1][0].ToString(); string Clientes = Datos.Tables[0].Rows[2][0].ToString(); string PagosDolares = Datos.Tables[0].Rows[3][0].ToString(); string PagosCordobas = Datos.Tables[0].Rows[4][0].ToString(); string Parametros = "'" + Proyectos + "','" + Lotes + "','" + Clientes + "','" + PagosDolares + "','" + PagosCordobas + "'"; ScriptManager.RegisterStartupScript(this, this.GetType(), "dash", "FillDash(" + Parametros + ");", true); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs Cls_General FG = new Cls_General(); Exception Ex = Server.GetLastError(); FG.Controlador_Error(Ex, Response); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { byte[] Avatar = ASPxBinaryImage1.ContentBytes; ProfileBase profile = HttpContext.Current.Profile; byte[] avatar = (byte[])profile.GetPropertyValue("Avatar"); ASPxBinaryImage1.ContentBytes = avatar; } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void GridView_Ubicaciones_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { e.Cancel = true; clsUbicaciones Ubicacion = new clsUbicaciones(); FG._NombreUsuario = HttpContext.Current.User.Identity.Name; string IdentityUser = FG.CrearIdentificadorUsuario(FG._NombreUsuario); Ubicacion.IdUbicacion = 0; Ubicacion.NombreProyecto = e.NewValues["NombreProyecto"].ToString(); Ubicacion.IdMunicipio = Convert.ToInt32(e.NewValues["Id_Municipio"].ToString()); Ubicacion.Direccion = e.NewValues["Direccion"] != null ? e.NewValues["Direccion"].ToString() : ""; Ubicacion.AplicaInteres = Convert.ToBoolean(e.NewValues["AplicaInteres"]); Neg.AgregarActualizarUbicacion(Ubicacion, IdentityUser); string MsjSQL = FG.Obtener_MensajeSQL(IdentityUser); if (MsjSQL != "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('" + MsjSQL + "');", true); return; } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('Registro creado con éxito.');", true); GridView_Ubicaciones.CancelEdit(); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void Page_Load(object sender, EventArgs e) { try { if (HttpContext.Current.User.Identity.Name == "") { Response.Redirect("~/Account/Login.aspx"); return; } if (!IsPostBack) { if (Session["RegistrarAsignacion"] == null || Session["RegistrarAsignacion"] == "") { //Response.Redirect("~/Default.aspx", true); } else { lblIdAsignacion.Text = Session["RegistrarAsignacion"].ToString(); Session["RegistrarAsignacion"] = ""; } //NUEVA ASIGNACION if (lblIdAsignacion.Text == "0") { LimpiarCampos(); } else { CargarDatos(lblIdAsignacion.Text.Trim()); } } //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "active", "SetActiveMenu('RegistrarPago');", true); ASPxNavBar navMain = (this.Master.FindControl("LeftPanel").FindControl("nbMain") as ASPxNavBar); if (navMain != null) { navMain.Groups.FindByName("Asignaciones").Expanded = true; navMain.SelectedItem = navMain.Items.FindByName("RegistrarAsignacion"); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void GridView_Asignaciones_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) { try { if (e.Column.FieldName == "IdBeneficiario") { if (Session["IdNuevoBeneficiario"] != null) { e.Editor.Value = Session["IdNuevoBeneficiario"]; } } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
public void Permisos() { try { string Rol = Roles.GetRolesForUser(HttpContext.Current.User.Identity.Name)[0].ToLower(); if (Rol != "" && Rol != null) { if (Rol != "administrador" && Rol != "desarrollo") { nbMain.Groups.FindByName("Desarrollo").Visible = false; nbMain.Groups.FindByName("Administrar").Visible = false; } } else { nbMain.Enabled = false; } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
//protected void btnCreateUser_Click(object sender, EventArgs e) { // try { // MembershipUser user = Membership.CreateUser(tbUserName.Text, tbPassword.Text, tbEmail.Text); // Response.Redirect(Request.QueryString["ReturnUrl"] ?? "~/Account/RegisterSuccess.aspx"); // } // catch (MembershipCreateUserException exc) { // if (exc.StatusCode == MembershipCreateStatus.DuplicateEmail || exc.StatusCode == MembershipCreateStatus.InvalidEmail) { // tbEmail.ErrorText = exc.Message; // tbEmail.IsValid = false; // } // else if (exc.StatusCode == MembershipCreateStatus.InvalidPassword) { // tbPassword.ErrorText = exc.Message; // tbPassword.IsValid = false; // } // else { // tbUserName.ErrorText = exc.Message; // tbUserName.IsValid = false; // } // } //} protected void GridView_Usuarios_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { e.Cancel = true; string Usuario = e.NewValues["UserName"].ToString(); string Email = e.NewValues["Email"].ToString(); string Password = "******"; string Rol = e.NewValues["RoleName"].ToString(); MembershipCreateStatus createStatus; MembershipUser user = Membership.CreateUser(Usuario, Password, Email, "Ninguna", "Ninguna", true, out createStatus); if (createStatus == MembershipCreateStatus.Success) { Roles.AddUserToRole(Usuario, Rol); if (Roles.IsUserInRole(Usuario, Rol)) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('Usuario Creado correctamente');", true); } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('Usuario Creado correctamente pero sin asignar Rol');", true); } GridView_Usuarios.CancelEdit(); GridView_Usuarios.DataBind(); } else { string Error = GetErrorMessage(createStatus); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msj", "alert('" + Error + "');", true); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void Page_Load(object sender, EventArgs e) { try { if (HttpContext.Current.User.Identity.Name == "") { Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { Session["TicketImprimir"] = ""; } if (Session["TicketImprimir"] != null && Session["TicketImprimir"] != "") { GenerarTicket(Convert.ToInt32(Session["TicketImprimir"])); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void Page_Load(object sender, EventArgs e) { try { Session["RegistrarAsignacion"] = ""; DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards"); ASPxDashboard1.SetDashboardStorage(dashboardFileStorage); if (User.IsInRole("Desarrollo")) { ASPxDashboard1.WorkingMode = WorkingMode.Viewer; } // Uncomment this string to allow end users to create new data sources based on predefined connection strings. ASPxDashboard1.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider()); //ASPxDashboard1.OpenDashboard("dashboard1.xml"); } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void Page_Load(object sender, EventArgs e) { try { //DataSet dataset = new DataSet(); //FG._NombreUsuario = HttpContext.Current.User.Identity.Name; //string IdentityUser = FG.CrearIdentificadorUsuario(FG._NombreUsuario); //var retorno = FG.ExecuteSQLEscalar("SP_PagosVencidos '" + IdentityUser + "'"); //string MsjSQL = FG.Obtener_MensajeSQL(IdentityUser); //if(MsjSQL!="") //{ // return; //} //FG.FilldataSource(SqlDataSource_PagosVencidos, "SELECT * FROM Morosos"); //GridView_PlanPago.DataBind(); } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void Btn_Imprimir_Click(object sender, EventArgs e) { try { Session["ReportName"] = "PagosFechas"; if (BootstrapCalendar1.SelectedDates.Count() == 0) { //Toast.ShowToast(this, Clases.Toast.ToastType.Error, "Seleccione la Fecha para generar el reporte"); Session["FiltroFechas"] = "Todos"; //return; } else if (BootstrapCalendar1.SelectedDates.Count == 1) { Session["FiltroFechas"] = "'" + BootstrapCalendar1.SelectedDate.ToShortDateString() + "'"; } else if (BootstrapCalendar1.SelectedDates.Count > 1) { string FiltoFechas = ""; var Fechas = BootstrapCalendar1.SelectedDates.ToList(); for (int i = 0; i < Fechas.Count(); i++) { if (FiltoFechas == "") { FiltoFechas = "'" + Fechas[i].ToShortDateString() + "'"; } else { FiltoFechas = FiltoFechas + ",'" + Fechas[i].ToShortDateString() + "'"; } } Session["FiltroFechas"] = FiltoFechas; } Response.Redirect("ReportViewer.aspx"); } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void ASPxPivotGrid1_CustomFieldSort(object sender, DevExpress.Web.ASPxPivotGrid.PivotGridCustomFieldSortEventArgs e) { try { if (e.Field.FieldName == "MesPagado") { string val1 = Convert.ToString(e.Value1); string val2 = Convert.ToString(e.Value2); DateTime f1 = Convert.ToDateTime(val1); DateTime f2 = Convert.ToDateTime(val2); e.Result = f1.CompareTo(f2); e.Handled = true; } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void Page_Load(object sender, EventArgs e) { try { if (HttpContext.Current.User.Identity.Name == "") { Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { if ((Session["IdAsignacionPago"] == null && Session["IdPago"] == null) || (Session["IdAsignacionPago"] == "" && Session["IdPago"] == "")) { //Response.Redirect("Pagos.aspx", true); //return; } else { lblIdAsignacion.Text = Session["IdAsignacionPago"].ToString(); lblIdPago.Text = Session["IdPago"].ToString(); Session["IdAsignacionPago"] = ""; Session["IdPago"] = ""; } if (lblIdPago.Text == "" && lblIdAsignacion.Text == "") { LimpiarCampos("General"); HabilitarCampos(false); return; } if (lblIdPago.Text == "0") { LimpiarCampos("Detalle"); } else { CargarDatosPago(lblIdPago.Text); } if (lblIdAsignacion.Text == "0") { LimpiarCampos("General"); } else { CargarDatosAsignacion(lblIdAsignacion.Text); } Session["TicketImprimir"] = ""; //CargarDatosAsignacion(lblIdAsignacion.Text); } ASPxNavBar navMain = (this.Master.FindControl("LeftPanel").FindControl("nbMain") as ASPxNavBar); if (navMain != null) { navMain.Groups.FindByName("Pagos").Expanded = true; navMain.SelectedItem = navMain.Items.FindByName("RegistrarPago"); } if (Session["TicketImprimir"] != null && Session["TicketImprimir"] != "") { GenerarTicket(Convert.ToInt32(Session["TicketImprimir"])); } if (ComboBox_Moneda.Text == "Córdobas") { SpinEditTasaCambio.ClientEnabled = true; } else { SpinEditTasaCambio.ClientEnabled = false; } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }