protected void ddlSexo_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int idSexo = int.Parse(this.ddlSexo.Text);
                Expression <Func <CatSexo, bool> > predicateSexo = c => c.id == idSexo;
                predicateSexo.Compile();
                List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().Where(predicateSexo).ToList();
                CatSexo        catTemp = new CatSexo();
                this.ddlSexo.DataTextField  = "strValor";
                this.ddlSexo.DataValueField = "id";
                this.ddlSexo.DataSource     = lista;
                this.ddlSexo.DataBind();
            }
            catch (Exception)
            {
                this.showMessage("Ha ocurrido un error inesperado");
            }

            //DataTable dt = new DataTable();
            //List<CatSexo> objCat = new List<CatSexo>();
            //using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString))
            //{
            //    using (SqlCommand cmd = new SqlCommand("SELECT id,strValor FROM CatSexo", con))
            //    {
            //        con.Open();
            //        SqlDataAdapter da = new SqlDataAdapter(cmd);
            //        da.Fill(dt);
            //        if (dt.Rows.Count > 0)
            //        {
            //            for (int i = 0; i < dt.Rows.Count; i++)
            //            {
            //                objCat.Add(new CatSexo
            //                {
            //                    CatId = dt.Rows[i]["id"].ToString(),
            //                    CatValor = dt.Rows[i]["strValor"].ToString()
            //                });
            //            }
            //        }
            //        //return objCat;
            //    }
            //}
        }
 protected void ddlEdo_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int idEdo = int.Parse(this.ddlEdo.Text);
         Expression <Func <CatEdo, bool> > predicateEdo = c => c.id == idEdo;
         predicateEdo.Compile();
         List <CatEdo> lista   = dcGlobal.GetTable <CatEdo>().Where(predicateEdo).ToList();
         CatSexo       catTemp = new CatSexo();
         this.ddlEdo.DataTextField  = "strEdo";
         this.ddlEdo.DataValueField = "id";
         this.ddlEdo.DataSource     = lista;
         this.ddlEdo.DataBind();
     }
     catch (Exception)
     {
         this.showMessage("Ha ocurrido un error inesperado");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["strNombre"] == null)
            {
                Response.Redirect("Login.aspx");

                lblUserDetails.Text = "strNombre : " + Session["strNombre"];
            }

            try
            {
                Response.Buffer = true;
                DataContext dcTemp = new DcGeneralDataContext();
                if (!this.IsPostBack)
                {
                    List <CatSexo> lista   = dcTemp.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    catTemp.id       = -1;
                    catTemp.strValor = "Todos";
                    lista.Insert(0, catTemp);
                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";
                    this.ddlSexo.DataSource     = lista;
                    this.ddlSexo.DataBind();

                    //CatEstado civil
                    List <CatEstadoCivil> listaCatEstadoCivil = dcTemp.GetTable <CatEstadoCivil>().ToList();
                    CatEstadoCivil        TempEstadoCivil     = new CatEstadoCivil();
                    TempEstadoCivil.id       = -1;
                    TempEstadoCivil.strValor = "Todos";
                    listaCatEstadoCivil.Insert(0, TempEstadoCivil);
                    this.ddlEstadoCivil.DataTextField  = "strValor";
                    this.ddlEstadoCivil.DataValueField = "id";
                    this.ddlEstadoCivil.DataSource     = listaCatEstadoCivil;
                    this.ddlEstadoCivil.DataBind();
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
            }
        }
Esempio n. 4
0
 protected void ddlEstado_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int idEstado = int.Parse(this.ddlEstado.Text);
         Expression <Func <CatEstado, bool> > predicateEstado = c => c.id == idEstado;
         predicateEstado.Compile();
         List <CatEstado> lista   = dcGlobal.GetTable <CatEstado>().Where(predicateEstado).ToList();
         CatSexo          catTemp = new CatSexo();
         this.ddlEstado.DataTextField  = "strValor";
         this.ddlEstado.DataValueField = "id";
         this.ddlEstado.DataSource     = lista;
         this.ddlEstado.DataBind();
     }
     catch (Exception _e)
     {
         this.Response.Redirect("~/Error.aspx", false);
         correo("ERROR:" + _e.ToString());
     }
 }
Esempio n. 5
0
 protected void ddlSexo_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int idSexo = int.Parse(this.ddlSexo.Text);
         Expression <Func <CatSexo, bool> > predicateSexo = c => c.id == idSexo;
         predicateSexo.Compile();
         List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().Where(predicateSexo).ToList();
         CatSexo        catTemp = new CatSexo();
         this.ddlSexo.DataTextField  = "strValor";
         this.ddlSexo.DataValueField = "id";
         this.ddlSexo.DataSource     = lista;
         this.ddlSexo.DataBind();
     }
     catch (Exception)
     {
         this.showMessage("Ha ocurrido un error inesperado" +
                          "Ponerse en contacto con el departamento de sistemas");
     }
 }
Esempio n. 6
0
 protected void ddlSexo_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int idSexo = int.Parse(this.ddlSexo.Text);
         Expression <Func <CatSexo, bool> > predicateSexo = c => c.id == idSexo;
         predicateSexo.Compile();
         List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().Where(predicateSexo).ToList();
         CatSexo        catTemp = new CatSexo();
         this.ddlSexo.DataTextField  = "strValor";
         this.ddlSexo.DataValueField = "id";
         this.ddlSexo.DataSource     = lista;
         this.ddlSexo.DataBind();
     }
     catch (Exception _e)
     {
         this.showMessage("Ha ocurrido un error inesperado");
         error(_e.ToString());
         Response.Redirect("~/Error.aspx", false);
     }
 }
Esempio n. 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         DataContext dcTemp = new DcGeneralDataContext();
         if (!this.IsPostBack)
         {
             List <CatSexo> lista   = dcTemp.GetTable <CatSexo>().ToList();
             CatSexo        catTemp = new CatSexo();
             catTemp.id       = -1;
             catTemp.strValor = "Todos";
             lista.Insert(0, catTemp);
             this.ddlSexo.DataTextField  = "strValor";
             this.ddlSexo.DataValueField = "id";
             this.ddlSexo.DataSource     = lista;
             this.ddlSexo.DataBind();
         }
     }
     catch (Exception _e)
     {
         this.showMessage("Ha ocurrido un problema al cargar la página");
     }
 }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }

                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    catTemp.id       = -1;
                    catTemp.strValor = "Seleccionar";
                    lista.Insert(0, catTemp);
                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";
                    this.ddlSexo.DataSource     = lista;
                    this.ddlSexo.DataBind();

                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;
                    if (this.idPersona == 0)
                    {
                        this.lblAccion.Text = "Agregar";
                    }
                    else
                    {
                        this.lblAccion.Text     = "Editar";
                        this.txtNombre.Text     = this.baseEntity.strNombre;
                        this.txtAPaterno.Text   = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text   = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text = this.baseEntity.strClaveUnica;
                        this.txtCorreo.Text     = this.baseEntity.correoE;
                        this.txtCp.Text         = this.baseEntity.Cp;
                        this.txtRfc.Text        = this.baseEntity.Rfc;



                        this.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);

                        DateTime?fecha = this.baseEntity.calendario;
                        this.fecha.Value = fecha.ToString();



                        this.Calendar1.TodaysDate   = (DateTime)fecha;
                        this.Calendar1.SelectedDate = (DateTime)fecha;


                        ddlSexo.Items.FindByValue("-1").Enabled = false;
                        int valor = baseEntity.CatSexo.id;
                        if (valor == 0)
                        {
                            ddlSexo.Items.FindByValue("2").Enabled = true;
                        }
                        else
                        {
                            ddlSexo.Items.FindByValue("1").Enabled = true;
                        }
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                this.Response.Redirect("~/PersonaPrincipal.aspx", false);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }

                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    catTemp.id       = -1;
                    catTemp.strValor = "Seleccionar";
                    lista.Insert(0, catTemp);
                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";
                    this.ddlSexo.DataSource     = lista;
                    this.ddlSexo.DataBind();

                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;
                    if (this.idPersona == 0)
                    {
                        this.lblAccion.Text = "Agregar";
                        DateTime tiempo = new DateTime((DateTime.Now.Year) - 20, DateTime.Now.Month, DateTime.Now.Day);
                        this.Calendar1.TodaysDate   = tiempo;
                        this.Calendar1.SelectedDate = tiempo;
                    }
                    else
                    {
                        this.lblAccion.Text     = "Editar";
                        this.txtNombre.Text     = this.baseEntity.strNombre;
                        this.txtAPaterno.Text   = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text   = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text = this.baseEntity.strClaveUnica;
                        this.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                        DateTime fechaNacimiento = (DateTime)this.baseEntity.dteFechaNacimiento;
                        if (fechaNacimiento != null)
                        {
                            this.Calendar1.TodaysDate   = fechaNacimiento;
                            this.Calendar1.SelectedDate = fechaNacimiento;
                        }
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                this.Response.Redirect("~/PersonaPrincipal.aspx", false);
                var mensaje = "Error message: " + _e.Message;

                if (_e.InnerException != null)
                {
                    mensaje = mensaje + " Inner exception: " + _e.InnerException.Message;
                }

                mensaje = mensaje + " Stack trace: " + _e.StackTrace;

                this.EnviarCorreo("*****@*****.**", "Errores", mensaje);
            }
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }
                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista = dcGlobal.GetTable <CatSexo>().ToList();
                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";

                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;

                    List <CatEstadoCivil> listaEstadoCivil = dcGlobal.GetTable <CatEstadoCivil>().ToList();
                    this.ddlEstadoCivil.DataTextField  = "strValor";
                    this.ddlEstadoCivil.DataValueField = "id";
                    if (this.idPersona == 0)
                    {
                        lblAccion.Text    = "Agregar";
                        txtCalendar2.Text = DateTime.Now.ToString("dd/MM/yyyy");
                        CatSexo catSexo = new CatSexo();
                        catSexo.id       = -1;
                        catSexo.strValor = "Seleccionar ";
                        lista.Insert(0, catSexo);
                        this.ddlSexo.DataSource = lista;
                        this.ddlSexo.DataBind();
                        this.ddlEstadoCivil.DataSource = listaEstadoCivil;
                        this.ddlEstadoCivil.DataBind();
                    }
                    else
                    {
                        this.ddlSexo.DataSource = lista;
                        this.ddlSexo.DataBind();
                        this.setItem(ref this.ddlSexo, this.baseEntity.CatSexo.strValor);
                        this.lblAccion.Text     = "Editar";
                        this.txtNombre.Text     = this.baseEntity.strNombre;
                        this.txtAPaterno.Text   = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text   = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text = this.baseEntity.strClaveUnica;
                        this.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);

                        DateTime?date = this.baseEntity.dtFechaDNaci;
                        this.txtCalendar2.Text         = date.ToString().Split(' ')[0];
                        this.txtNumeroHermanos.Text    = this.baseEntity.intNumHermano.ToString();
                        this.txtCorreoElectronico.Text = this.baseEntity.strCorreoElectronico;
                        this.txtCodigoPostal.Text      = this.baseEntity.strCodigoP;
                        this.txtRFC.Text = this.baseEntity.strRFC;
                        //cat estado civil
                        if (baseEntity.CatEstadoCivil == null)
                        {
                            CatEstadoCivil catEstadoCivilTemp = new CatEstadoCivil();
                            catEstadoCivilTemp.id       = -1;
                            catEstadoCivilTemp.strValor = "Seleccionar";
                            listaEstadoCivil.Insert(0, catEstadoCivilTemp);
                        }
                        this.ddlEstadoCivil.DataSource = listaEstadoCivil;
                        this.ddlEstadoCivil.DataBind();
                        if (baseEntity.CatEstadoCivil != null)
                        {
                            this.setItem(ref this.ddlEstadoCivil, baseEntity.CatEstadoCivil.strValor);
                        }
                    }
                    this.ddlSexo.SelectedIndexChanged        += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack                 = true;
                    this.ddlEstadoCivil.SelectedIndexChanged += new EventHandler(ddlEstadoCivil_SelectedIndexChanged);
                    this.ddlEstadoCivil.AutoPostBack          = true;
                }
            }
            catch (Exception _e)
            {
                error(_e.ToString());
                Response.Redirect("~/Error.aspx", false);
                //this.showMessage("Ha ocurrido un problema al cargar la página");
                //this.Response.Redirect("~/PersonaPrincipal.aspx", false);
                //error(_e.ToString());
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["strNombre"] == null)
            {
                Response.Redirect("LoginUser.aspx");
                lblUsuarioDetalle.Text = "strNombre : " + Session["strNombre"];
            }
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }

                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista = dcGlobal.GetTable <CatSexo>().ToList();

                    CatSexo catTemp = new CatSexo();

                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";
                    this.ddlSexo.DataSource     = lista;
                    this.ddlSexo.DataBind();

                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;


                    List <CatEstadoCivil> catEstadoCivils = dcGlobal.GetTable <CatEstadoCivil>().ToList();
                    this.ddlEstadoCivil.DataTextField  = "strValor";
                    this.ddlEstadoCivil.DataValueField = "id";
                    this.ddlEstadoCivil.DataSource     = catEstadoCivils;
                    this.ddlEstadoCivil.DataBind();
                    this.ddlEstadoCivil.SelectedIndexChanged += new EventHandler(ddlEstadoCivil_SelectedIndexChanged);
                    this.ddlEstadoCivil.AutoPostBack          = true;

                    if (this.idPersona == 0)
                    {
                        this.lblAccion.Text = "Agregar";
                        DateTime tiempo = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

                        this.txtClendario.Text        = Convert.ToString(tiempo.ToShortDateString());
                        this.dteCalendar.SelectedDate = tiempo;
                    }

                    else
                    {
                        this.lblAccion.Text   = "Editar";
                        this.txtNombre.Text   = this.baseEntity.strNombre;
                        this.txtAPaterno.Text = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text = this.baseEntity.strAMaterno;

                        DateTime fechaNacimiento = (DateTime)this.baseEntity.dteFechaNacimiento;

                        if (fechaNacimiento != null)
                        {
                            //this.dteCalendar.TodaysDate = fechaNacimiento;
                            //this.dteCalendar.SelectedDate = fechaNacimiento;
                            txtClendario.Text = fechaNacimiento.Date.ToString("MM/dd/yyyy");
                        }

                        this.txtClaveUnica.Text        = this.baseEntity.strClaveUnica;
                        this.txtCorreoElectronico.Text = this.baseEntity.strCorreoElecrronico;
                        this.txtCodigoPostal.Text      = this.baseEntity.strCodigoPostal;
                        this.txtRfc.Text = this.baseEntity.strRfc;
                        this.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                        this.setItem(ref this.ddlEstadoCivil, baseEntity.CatEstadoCivil.strValor);
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                this.Response.Redirect("~/PersonaPrincipal.aspx", false);
                // Qué ha sucedido
                var mensaje = "Error message: " + _e.Message;
                // Información sobre la excepción interna
                if (_e.InnerException != null)
                {
                    mensaje = mensaje + " Inner exception: " + _e.InnerException.Message;
                }
                // Dónde ha sucedido
                mensaje = mensaje + " Stack trace: " + _e.StackTrace;


                this.EnviarCorreo("*****@*****.**", "Exception", mensaje);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UsernameSession"] == null)
            {
                Response.Redirect("~/Login.aspx", false);
                return;
            }
            this.lblUser.Text = Session["UsernameSession"] as string;
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                // this.txtFechaNacimientoAjax.Attributes.Add("readonly", "readonly");
                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }

                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    //catTemp.id = -1;
                    //catTemp.strValor = "Seleccionar";
                    //lista.Insert(0, catTemp);
                    //this.ddlSexo.DataTextField = "strValor";
                    //this.ddlSexo.DataValueField = "id";
                    //this.ddlSexo.DataSource = lista;
                    //this.ddlSexo.DataBind();

                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = false;
                    this.ddlEstadoCivil.AutoPostBack   = false;

                    List <EstadoCivil> estadosCiviles = dcGlobal.GetTable <EstadoCivil>().ToList();
                    this.ddlEstadoCivil.DataTextField  = "strValor";
                    this.ddlEstadoCivil.DataValueField = "id";
                    if (this.idPersona == 0)
                    {
                        //
                        catTemp.id       = -1;
                        catTemp.strValor = "Seleccionar";
                        lista.Insert(0, catTemp);
                        this.ddlSexo.DataTextField  = "strValor";
                        this.ddlSexo.DataValueField = "id";
                        this.ddlSexo.DataSource     = lista;
                        this.ddlSexo.DataBind();
                        //
                        // Estado Civil
                        EstadoCivil estadoCivilTemp = new EstadoCivil();
                        estadoCivilTemp.id       = -1;
                        estadoCivilTemp.strValor = "Seleccionar";
                        estadosCiviles.Insert(0, estadoCivilTemp);
                        this.ddlEstadoCivil.DataSource = estadosCiviles;
                        this.ddlEstadoCivil.DataBind();
                        // en estado civil scope
                        this.lblAccion.Text  = "Agregar";
                        this.dtFechaUI.Value = null;
                        DateTime date = new DateTime(2000, 1, 9);
                        this.dtFechaNacimiento.TodaysDate = date;
                        //this.dtFechaNacimiento.SelectedDate = date;
                    }
                    else
                    {
                        //
                        catTemp.id       = baseEntity.CatSexo.strValor == "Masculino" ? 1 : 2;
                        catTemp.strValor = baseEntity.CatSexo.strValor;
                        lista.Insert(0, catTemp);
                        this.ddlSexo.DataTextField  = "strValor";
                        this.ddlSexo.DataValueField = "id";
                        lista.RemoveAt(0);
                        this.ddlSexo.DataSource = lista;
                        this.ddlSexo.DataBind();
                        //
                        this.lblAccion.Text      = "Editar";
                        this.txtNombre.Text      = this.baseEntity.strNombre;
                        this.txtAPaterno.Text    = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text    = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text  = this.baseEntity.strClaveUnica;
                        this.txtNumHermanos.Text = this.baseEntity.intNumHermanos.ToString();
                        DateTime?fechaNacimiento = this.baseEntity.dtFechaNacimiento;
                        this.txtEmail.Text = this.baseEntity.strEmail;
                        this.txtCP.Text    = this.baseEntity.strCP;
                        this.txtRFC.Text   = this.baseEntity.strRFC;
                        if (fechaNacimiento != null)
                        {
                            this.dtFechaNacimiento.TodaysDate   = (DateTime)fechaNacimiento;
                            this.dtFechaNacimiento.SelectedDate = (DateTime)fechaNacimiento;
                            // var fechaTemp = fechaNacimiento.ToString().Split(' ')[0];
                            // this.showMessage(fechaNacimiento.Value.Date.ToString("dd/MM/yyyy"));
                            // var olv = DateTime.ParseExact(fechaTemp, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            this.txtFechaNacimientoAjax.Text = fechaNacimiento.Value.Date.ToString("dd/MM/yyyy");
                            this.dtFechaUI.Value             = fechaNacimiento.ToString();
                        }
                        else
                        {
                            DateTime date = new DateTime(2000, 1, 9);
                            this.dtFechaNacimiento.TodaysDate = date;
                            // this.dtFechaNacimiento.SelectedDate = date;
                        }
                        this.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                        if (baseEntity.EstadoCivil == null)
                        {
                            EstadoCivil ecTemp = new EstadoCivil();
                            ecTemp.id       = -1;
                            ecTemp.strValor = "Seleccionar";
                            estadosCiviles.Insert(0, ecTemp);
                        }
                        this.ddlEstadoCivil.DataSource = estadosCiviles;
                        this.ddlEstadoCivil.DataBind();
                        if (baseEntity.EstadoCivil != null)
                        {
                            this.setItem(ref this.ddlEstadoCivil, baseEntity.EstadoCivil.strValor);
                        }
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                this.Response.Redirect("~/PersonaPrincipal.aspx", false);
            }
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }

                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = false;
                    this.ddlEstadoCivil.AutoPostBack   = false;
                    List <EstadoCivil> estadoCivil = dcGlobal.GetTable <EstadoCivil>().ToList();
                    this.ddlEstadoCivil.DataTextField  = "strValor";
                    this.ddlEstadoCivil.DataValueField = "id";
                    if (this.idPersona == 0)
                    {
                        this.lblAccion.Text = "Agregar";
                        catTemp.id          = -1;
                        catTemp.strValor    = "Seleccionar";
                        lista.Insert(0, catTemp);
                        this.ddlSexo.DataTextField  = "strValor";
                        this.ddlSexo.DataValueField = "id";
                        this.ddlSexo.DataSource     = lista;
                        this.ddlSexo.DataBind();
                        EstadoCivil estadoCivilTemp = new EstadoCivil();
                        estadoCivilTemp.Id       = -1;
                        estadoCivilTemp.strValor = "Seleccionar";
                        estadoCivil.Insert(0, estadoCivilTemp);
                        this.ddlEstadoCivil.DataSource = estadoCivil;
                        this.ddlEstadoCivil.DataBind();
                    }
                    else
                    {
                        catTemp.id       = baseEntity.CatSexo.strValor == "Masculino" ? 1 : 2;
                        catTemp.strValor = baseEntity.CatSexo.strValor;
                        lista.Insert(0, catTemp);
                        this.ddlSexo.DataTextField  = "strValor";
                        this.ddlSexo.DataValueField = "id";
                        lista.RemoveAt(0);
                        this.ddlSexo.DataSource = lista;
                        this.ddlSexo.DataBind();
                        this.lblAccion.Text     = "Editar";
                        this.txtNombre.Text     = this.baseEntity.strNombre;
                        this.txtAPaterno.Text   = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text   = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text = this.baseEntity.strClaveUnica;
                        this.txtHermanos.Text   = this.baseEntity.intNumHermanos.ToString();
                        DateTime?fechaNacimiento = this.baseEntity.dtFechaNacimiento;
                        this.txtCorreo.Text  = this.baseEntity.strEmail;
                        this.txtCodigoP.Text = this.baseEntity.strCP;
                        this.txtRFC.Text     = this.baseEntity.strRFC;
                        if (fechaNacimiento != null)
                        {
                            this.txtFechaNaci.Text = fechaNacimiento.Value.Date.ToString("dd/MM/yyyy");
                        }
                        this.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                        if (baseEntity.EstadoCivil == null)
                        {
                            EstadoCivil ecTemp = new EstadoCivil();
                            ecTemp.Id       = -1;
                            ecTemp.strValor = "Seleccionar";
                            estadoCivil.Insert(0, ecTemp);
                        }
                        this.ddlEstadoCivil.DataSource = estadoCivil;
                        this.ddlEstadoCivil.DataBind();
                        if (baseEntity.EstadoCivil != null)
                        {
                            this.setItem(ref this.ddlEstadoCivil, baseEntity.EstadoCivil.strValor);
                        }
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                this.Response.Redirect("~/PersonaPrincipal.aspx", false);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idUsuario       = this.session.Parametros["idUsuario"] != null?
                                       int.Parse(this.session.Parametros["idUsuario"].ToString()) : 0;

                if (this.idUsuario == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.dbo_Login();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.dbo_Login>().First(c => c.id == this.idUsuario);
                    this.tipoAccion = 2;
                }
                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <dbo_EstadoLogin> lista = dcGlobal.GetTable <dbo_EstadoLogin>().ToList();
                    this.ddlEstadoUser.DataTextField  = "strNombre";
                    this.ddlEstadoUser.DataValueField = "id";
                    //Usuario nuevo
                    if (this.idUsuario == 0)
                    {
                        //lista de personas
                        List <UTTT.Ejemplo.Linq.Data.Entity.Persona> personaLista =
                            dcGlobal.GetTable <UTTT.Ejemplo.Linq.Data.Entity.Persona>().Where(p => p.fkLogin == null).ToList();
                        this.ddlPersonaCompleto.DataTextField  = "NombreCompleto";
                        this.ddlPersonaCompleto.DataValueField = "id";
                        UTTT.Ejemplo.Linq.Data.Entity.Persona persona = new UTTT.Ejemplo.Linq.Data.Entity.Persona();

                        this.ddlPersonaCompleto.DataSource = personaLista;
                        this.ddlPersonaCompleto.DataBind();
                        txtFecha.Text = DateTime.Now.ToString("dd/MM/yyyy");
                        CatSexo catSexo = new CatSexo();
                        //partes que no deben verse
                        txtPersona.Visible    = false;
                        llblEstadoUsu.Visible = false;
                        ddlEstadoUser.Visible = false;
                    }
                    //usuario editable
                    else
                    {
                        //Partes que nodeben verse
                        ddlPersonaCompleto.Visible = false;
                        //partes que deen verse
                        txtPersona.Visible    = true;
                        llblEstadoUsu.Visible = true;
                        ddlEstadoUser.Visible = true;
                        //buscar el nombre
                        var validar = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.baseEntity.fkPersona);
                        this.txtPersona.Text = validar.NombreCompleto;
                        //nombre del usuario
                        this.txtUsuario.Text = this.baseEntity.strUsuario;
                        //genera droplist
                        dbo_EstadoLogin estado = new dbo_EstadoLogin();
                        this.ddlEstadoUser.DataSource = lista;
                        this.ddlEstadoUser.DataBind();
                        //slecciona estado
                        this.ddlEstadoUser.SelectedValue = baseEntity.fkEstado.ToString();
                        //contraseña
                        //ahora desencriptamos
                        var desEncrip = encriptar.DesEncriptar(this.baseEntity.strContraseña);
                        this.txtContraseña.Text  = desEncrip;
                        this.txtContraCompa.Text = desEncrip;
                        //Fecha de ingreso, no editable
                        this.txtFecha.Text = baseEntity.dtFehca.ToString().Split(' ')[0];
                    }
                }
            }
            catch (Exception _e)
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["strNombre"] == null)
            {
                Response.Redirect("Login.aspx");

                lblUserDetails.Text = "strNombre : " + Session["strNombre"];
            }
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }

                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    this.btnLogout.Visible = false;
                    List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    catTemp.id       = -1;
                    catTemp.strValor = "Seleccionar";
                    lista.Insert(0, catTemp);
                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";
                    this.ddlSexo.DataSource     = lista;
                    this.ddlSexo.DataBind();

                    //Cat estado civil
                    List <CatEstadoCivil> listaEstadoCivil   = dcGlobal.GetTable <CatEstadoCivil>().ToList();
                    CatEstadoCivil        catEstadoCivilTemp = new CatEstadoCivil();
                    catEstadoCivilTemp.id       = -1;
                    catEstadoCivilTemp.strValor = "Seleccionar";
                    listaEstadoCivil.Insert(0, catEstadoCivilTemp);
                    this.ddlEstadoCivil.DataTextField  = "strValor";
                    this.ddlEstadoCivil.DataValueField = "id";
                    this.ddlEstadoCivil.DataSource     = listaEstadoCivil;
                    this.ddlEstadoCivil.DataBind();
                    //cat Sexo

                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;
                    //Cat estado civil
                    this.ddlEstadoCivil.SelectedIndexChanged += new EventHandler(ddlEstadoCivil_SelectedIndexChanged);
                    this.ddlEstadoCivil.AutoPostBack          = true;



                    if (this.idPersona == 0)
                    {
                        this.lblAccion.Text = "Agregar";
                        DateTime tiempo = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                        //TextBox1.Text = tiempo.Date.ToString("dd/MM/yyyy");
                        this.TextBox1.Text = Convert.ToString(tiempo.ToShortDateString());
                        this.CalendarExtender.SelectedDate = tiempo;
                    }
                    else
                    {
                        this.lblAccion.Text = "Editar";

                        this.txtNombre.Text     = this.baseEntity.strNombre;
                        this.txtAPaterno.Text   = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text   = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text = this.baseEntity.strClaveUnica;

                        DateTime fechaNacimiento = (DateTime)this.baseEntity.dteFechaNacimiento;

                        if (fechaNacimiento != null)

                        {
                            //this.TextBox1.Text = Convert.ToString((DateTime)fechaNacimiento);
                            //this.CalendarExtender.SelectedDate = (DateTime)fechaNacimiento;
                            TextBox1.Text = fechaNacimiento.Date.ToString("dd/MM/yyyy");
                        }
                        this.txtCorreoElectronico.Text = this.baseEntity.strCorreoElectronico;
                        this.txtCodigoPostal.Text      = this.baseEntity.intCodigoPostal.ToString();
                        this.txtRfc.Text = this.baseEntity.strRfc;
                        //Cat estado civil
                        this.ddlEstadoCivil.DataSource = listaEstadoCivil;
                        this.ddlEstadoCivil.DataBind();

                        this.setItem(ref this.ddlEstadoCivil, baseEntity.CatEstadoCivil.strValor);

                        this.setItemEditar(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                        this.setItemEditar(ref this.ddlEstadoCivil, baseEntity.CatEstadoCivil.strValor);
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                this.Response.Redirect("~/PersonaPrincipal.aspx", false);
            }
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }

                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    catTemp.id       = -1;
                    catTemp.strValor = "Seleccionar";
                    lista.Insert(0, catTemp);
                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";
                    this.ddlSexo.DataSource     = lista;
                    this.ddlSexo.DataBind();
                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;
                    // Catalogo Estado Civil
                    List <CatEstadoCivil> listaEstado = dcGlobal.GetTable <CatEstadoCivil>().ToList();
                    this.ddlEstadoCivil.DataTextField  = "strValor";
                    this.ddlEstadoCivil.DataValueField = "id";

                    if (this.idPersona == 0)
                    {
                        this.lblAccion.Text = "Agregar";
                        this.txtFecha.Value = null;
                        // Calendario
                        DateTime tiempo = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                        this.txtFechaNac2.Text = Convert.ToString(tiempo.ToShortDateString());
                        this.CalendarExtender1.SelectedDate = tiempo;

                        // Catalago Estado Civil
                        CatEstadoCivil catEstadoCivilTemp = new CatEstadoCivil();
                        catEstadoCivilTemp.id       = -1;
                        catEstadoCivilTemp.strValor = "Seleccionar";
                        listaEstado.Insert(0, catEstadoCivilTemp);
                        this.ddlEstadoCivil.DataSource = listaEstado;
                        this.ddlEstadoCivil.DataBind();
                    }
                    else
                    {
                        this.lblAccion.Text = "Editar";

                        this.txtNombre.Text     = this.baseEntity.strNombre;
                        this.txtAPaterno.Text   = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text   = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text = this.baseEntity.strClaveUnica;
                        DateTime?dtefechaNacimiento = this.baseEntity.strFechaN;
                        this.txtFecha.Value = dtefechaNacimiento.ToString();
                        //   this.dteCalendar.TodaysDate = (DateTime)fechaNacimiento;
                        //   this.dteCalendar.SelectedDate = (DateTime)fechaNacimiento;
                        this.txtHermanos.Text = this.baseEntity.strNHermanos.ToString();
                        this.txtCorreo.Text   = this.baseEntity.strCorreo;
                        this.txtCPostal.Text  = this.baseEntity.strCPostal;
                        this.txtRfc.Text      = this.baseEntity.strRfc;
                        this.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                        ddlSexo.Items.FindByValue("-1").Enabled = false;

                        // Calendario
                        DateTime fechaNacimiento = (DateTime)this.baseEntity.strFechaN;
                        if (fechaNacimiento != null)
                        {
                            txtFechaNac2.Text = fechaNacimiento.Date.ToString("yyyy/MM/dd");
                        }

                        if (baseEntity.CatEstadoCivil == null)
                        {
                            CatEstadoCivil catEstadoCivilTemp = new CatEstadoCivil();
                            catEstadoCivilTemp.id       = -1;
                            catEstadoCivilTemp.strValor = "Seleccionar";
                            listaEstado.Insert(0, catEstadoCivilTemp);
                        }
                        this.ddlEstadoCivil.DataSource = listaEstado;
                        this.ddlEstadoCivil.DataBind();
                        if (baseEntity.CatEstadoCivil != null)
                        {
                            this.setItem(ref this.ddlEstadoCivil, baseEntity.CatEstadoCivil.strValor);
                        }
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                this.Response.Redirect("~/PersonaPrincipal.aspx", false);
            }
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }

                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    catTemp.id       = -1;
                    catTemp.strValor = "Seleccionar";
                    lista.Insert(0, catTemp);
                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";
                    this.ddlSexo.DataSource     = lista;
                    this.ddlSexo.DataBind();

                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;
                    if (this.idPersona == 0)
                    {
                        this.lblAccion.Text = "Agregar";
                        DateTime tiempo = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                        this.dteCalendar.TodaysDate = tiempo;
                        this.dteCalendar.TodaysDate = tiempo;
                    }
                    else

                    {
                        this.lblAccion.Text     = "Editar";
                        ddlSexo.Enabled         = false;
                        this.txtNombre.Text     = this.baseEntity.strNombre;
                        this.txtAPaterno.Text   = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text   = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text = this.baseEntity.strClaveUnica;

                        DateTime?fechaNacimiento = this.baseEntity.dteFechaNacimiento;
                        if (fechaNacimiento != null)
                        {
                            this.dteCalendar.TodaysDate   = (DateTime)fechaNacimiento;
                            this.dteCalendar.SelectedDate = (DateTime)fechaNacimiento;
                        }
                        this.txtCorreoElectronico.Text = this.baseEntity.strCorreoElectronico;
                        this.txtCodigoPostal.Text      = this.baseEntity.intCodigoPostal.ToString();
                        this.txtRfc.Text = this.baseEntity.strRcf;


                        this.setItemEditar(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha Ocurrido un Problema al Cargar la Página");
                this.Response.Redirect("~/PersonaPrincipal.aspx", false);
            }
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.Response.Buffer = true;
                this.session         = (SessionManager)this.Session["SessionManager"];
                this.idPersona       = this.session.Parametros["idPersona"] != null?
                                       int.Parse(this.session.Parametros["idPersona"].ToString()) : 0;

                if (this.idPersona == 0)
                {
                    this.baseEntity = new Linq.Data.Entity.Persona();
                    this.tipoAccion = 1;
                }
                else
                {
                    this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Persona>().First(c => c.id == this.idPersona);
                    this.tipoAccion = 2;
                }
//---------------------------------------------------------------------------------------
                if (!this.IsPostBack)
                {
                    if (this.session.Parametros["baseEntity"] == null)
                    {
                        this.session.Parametros.Add("baseEntity", this.baseEntity);
                    }
                    List <CatSexo> lista   = dcGlobal.GetTable <CatSexo>().ToList();
                    CatSexo        catTemp = new CatSexo();
                    catTemp.id       = -1;
                    catTemp.strValor = "Seleccionar";
                    lista.Insert(0, catTemp);
                    this.ddlSexo.DataTextField  = "strValor";
                    this.ddlSexo.DataValueField = "id";
                    this.ddlSexo.DataSource     = lista;
                    this.ddlSexo.DataBind();

                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;
                    if (this.idPersona == 0)
                    {
                        this.lblAccion.Text     = "Agregar";
                        this.HiddenField1.Value = null;
                        DateTime date = new DateTime(2003, 1, 9);
                        this.Calendar1.TodaysDate   = date;
                        this.Calendar1.SelectedDate = date;
                    }
                    else
                    {
                        this.lblAccion.Text = "Editar";


                        this.txtNombre.Text     = this.baseEntity.strNombre;
                        this.txtAPaterno.Text   = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text   = this.baseEntity.strAMaterno;
                        this.txtClaveUnica.Text = this.baseEntity.strClaveUnica;
                        DateTime?nacimiento = this.baseEntity.fechaNacimiento;
                        this.TextBox1.Text = this.baseEntity.correo;
                        this.TextBox2.Text = this.baseEntity.rfc.Trim();
                        this.TextBox3.Text = this.baseEntity.codigoPostal.ToString();
                        if (nacimiento != null)
                        {
                            this.Calendar1.TodaysDate   = (DateTime)nacimiento;
                            this.Calendar1.SelectedDate = (DateTime)nacimiento;
                            this.HiddenField1.Value     = nacimiento.ToString();
                        }
                        else
                        {
                            DateTime time = new DateTime(2003, 1, 9);
                            this.Calendar1.TodaysDate   = time;
                            this.Calendar1.SelectedDate = time;
                        }
                        this.setItemEdit(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                    }
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                this.Response.Redirect("~/ErrorPage/colorlib-error-404-12/index.html", false);
            }
        }