protected void Page_Load(object sender, EventArgs e)
        {
            GM_CarreraPolitica DatosAux = new GM_CarreraPolitica {
                Conexion = Comun.Conexion, IDUsuario = Comun.IDUsuario
            };
            GM_CarreraPoliticaNegocio FN = new GM_CarreraPoliticaNegocio();

            if (Request.QueryString["op"] != null && Request.QueryString["op"] == "3")
            {
                if (Request.QueryString["id"] != null)
                {
                    string AuxID = Request.QueryString["id"].ToString();
                    DatosAux.IDCarreraPolitica = AuxID;
                    FN.EliminarCarreraPoliticaID(DatosAux);
                    if (DatosAux.Completado)
                    {
                        string ScriptError = DialogMessage.Show(TipoMensaje.Success, "Registro eliminado correctamente.", "Información", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                    }
                    else
                    {
                        string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Error al eliminar el registro.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                    }
                }
            }
            Lista = FN.ObtenerListCarreraPolitica(DatosAux);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GM_CarreraPolitica DatosAux = new GM_CarreraPolitica {
                Conexion = Comun.Conexion, IDUsuario = Comun.IDUsuario
            };
            GM_CarreraPoliticaNegocio FN = new GM_CarreraPoliticaNegocio();

            Lista      = FN.ObtenerListCarreraPolitica(DatosAux);
            DatosAdmin = FN.ObtenerCarrerapoliticaTexto(DatosAux);
        }
Exemplo n.º 3
0
 private void Save(bool NuevoRegistro, string IDCarreraPolitica, string Titulo, string Descripcion, DateTime FechaInicio, string UrlImg, HttpPostedFile bannerImage, bool Band)
 {
     try
     {
         string             BDir          = Server.MapPath("~/Images/CarreraPolitica/");
         string             FileExtension = Band ? Path.GetExtension(UrlImg) : string.Empty;
         GM_CarreraPolitica Datos         = new GM_CarreraPolitica
         {
             NuevoRegistro     = NuevoRegistro,
             IDCarreraPolitica = IDCarreraPolitica,
             Title             = Titulo,
             Descripcion       = Descripcion,
             FechaRealizado    = FechaInicio,
             ExtrancionImagen  = FileExtension,
             URLImagen         = UrlImg,
             CambioImagen      = Band,
             Conexion          = Comun.Conexion,
             IDUsuario         = User.Identity.Name
         };
         GM_CarreraPoliticaNegocio CP = new GM_CarreraPoliticaNegocio();
         CP.AGCarreraPolitica(Datos);
         Datos.Completado = true;
         if (Datos.Completado)
         {
             if (bannerImage != null && bannerImage.ContentLength > 0)
             {
                 try
                 {
                     Stream S = bannerImage.InputStream;
                     System.Drawing.Image Img = new System.Drawing.Bitmap(S);
                     Img.Save(BDir + Datos.URLImagen);
                     CP.ImagenSubidaFotoXID(Datos);
                 }
                 catch (Exception)
                 {
                 }
             }
             Response.Redirect("frmViewCarreraPolitica.aspx", false);
         }
         else
         {
             string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Error al guardar los datos.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
             ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GM_PlanCampania DatosAux = new GM_PlanCampania {
                Conexion = Comun.Conexion, IDUsuario = Comun.IDUsuario
            };
            GM_CarreraPoliticaNegocio FN = new GM_CarreraPoliticaNegocio();

            if (Request.QueryString["id"] != null)
            {
                string AuxID = Request.QueryString["id"].ToString();
                DatosAux.IDPElectoral = AuxID;
                Lista = FN.ObtenerProyectoCampania(DatosAux);
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["op"] != null)
                {
                    if (Request.QueryString["op"] == "2")
                    {
                        if (Request.QueryString["id"] != null)
                        {
                            string             ID       = Request.QueryString["id"].ToString();
                            GM_CarreraPolitica DatosAux = new GM_CarreraPolitica {
                                Conexion = Comun.Conexion, IDCarreraPolitica = ID
                            };
                            GM_CarreraPoliticaNegocio CP = new GM_CarreraPoliticaNegocio();
                            CP.ObtenerDetalleCarreraPolitica(DatosAux);
                            if (DatosAux.Completado)
                            {
                                this.CargarDatos(DatosAux);
                            }
                            else
                            {
                                Response.Redirect("frmViewCarreraPolitica.aspx?error=" + "Error al cargar los datos&nError=1");
                            }
                        }
                        else
                        {
                            Response.Redirect("frmViewCarreraPolitica.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("frmViewCarreraPolitica.aspx");
                    }
                }
                else
                {
                }
            }
            else
            {
                if (Request.Form.Count > 0)
                {
                    bool Band = false;
                    if (imgLogo.HasFile)
                    {
                        Band = true;
                    }
                    DateTime    FechaInicio;
                    CultureInfo esMX           = new CultureInfo("es-MX");
                    string      txtTitulo      = Request.Form["ctl00$cph_MasterBody$txtTitulo"].ToString();
                    string      txtDescription = Request.Form["ctl00$cph_MasterBody$txtDescription"].ToString();
                    DateTime.TryParseExact(Request.Form["ctl00$cph_MasterBody$txtFechaRealizado"].ToString(), "dd-MM-yyyy", esMX, System.Globalization.DateTimeStyles.None, out FechaInicio);
                    string         zFechaRealizado   = Request.Form["ctl00$cph_MasterBody$txtFechaRealizado"].ToString();
                    string         txtUrlImg         = Band ? imgLogo.PostedFile.FileName : string.Empty;
                    HttpPostedFile bannerImage       = imgLogo.PostedFile as HttpPostedFile;
                    string         IDCarreraPolitica = "";

                    try
                    {
                        string AuxID = Request.Form["ctl00$cph_MasterBody$hf"].ToString();
                        IDCarreraPolitica = AuxID;
                        bool NuevoRegistro = string.IsNullOrEmpty(IDCarreraPolitica);


                        this.Save(NuevoRegistro, IDCarreraPolitica, txtTitulo, txtDescription, FechaInicio, txtUrlImg, bannerImage, Band);
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("ErrorPage.aspx?msjError=" + ex.Message);
                    }
                }
            }
        }