protected void Page_Load(object sender, EventArgs e)
        {
            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();

                    List <CatEstadoCivil> lista2   = dcTemp.GetTable <CatEstadoCivil>().ToList();
                    CatEstadoCivil        catTemp2 = new CatEstadoCivil();
                    catTemp2.id             = -1;
                    catTemp2.strEstadoCivil = "Todos";
                    lista2.Insert(0, catTemp2);
                    this.ddlEstadoCivil.DataTextField  = "strEstadoCivil";
                    this.ddlEstadoCivil.DataValueField = "id";
                    this.ddlEstadoCivil.DataSource     = lista2;
                    this.ddlEstadoCivil.DataBind();
                }
            }

            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
            }
        }
        protected void ddlEstadoCivil_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int idEstadoCivil = int.Parse(this.ddlEstadoCivil.Text);
                Expression <Func <CatEstadoCivil, bool> > predicateEstadoCivil = c => c.id == idEstadoCivil;
                predicateEstadoCivil.Compile();
                List <CatEstadoCivil> lista = dcGlobal.GetTable <CatEstadoCivil>().Where(predicateEstadoCivil).ToList();
                CatEstadoCivil        catEstadoCivilTemp = new CatEstadoCivil();
                this.ddlEstadoCivil.DataTextField  = "strValor";
                this.ddlEstadoCivil.DataValueField = "id";
                this.ddlEstadoCivil.DataSource     = lista;
                this.ddlEstadoCivil.DataBind();
            }
            catch (Exception _e)
            {
                var mensaje = "Error message: " + _e.Message;
                if (_e.InnerException != null)
                {
                    mensaje = mensaje + " Inner exception: " + _e.InnerException.Message;
                }
                mensaje = mensaje + " Stack trace: " + _e.StackTrace;
                this.Response.Redirect("~/PageError.aspx", false);

                this.EnviarCorreo("*****@*****.**", "Exception", mensaje);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["strNombre"] == null)
            {
                Response.Redirect("LoginUser.aspx");
                lblUsuarioDetalle.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();

                    List <CatEstadoCivil> listaEstadoCivil = dcTemp.GetTable <CatEstadoCivil>().ToList();
                    CatEstadoCivil        tempEstadoCivil  = new CatEstadoCivil();
                    tempEstadoCivil.id       = -1;
                    tempEstadoCivil.strValor = "Todos";
                    listaEstadoCivil.Insert(0, tempEstadoCivil);
                    this.ddlEstadoCivil.DataTextField  = "strValor";
                    this.ddlEstadoCivil.DataValueField = "id";
                    this.ddlEstadoCivil.DataSource     = listaEstadoCivil;
                    this.ddlEstadoCivil.DataBind();
                }
            }
            catch (Exception _e)
            {
                this.showMessage("Ha ocurrido un problema al cargar la página");
                // 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.Response.Redirect("~/PageError.aspx", false);

                this.EnviarCorreo("*****@*****.**", "Exception", mensaje);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["strNombreUsuario"] == null)
            {
                Response.Redirect("login.aspx");
            }
            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();


                    List <CatEstadoCivil> listaCatEstadoCivil = dcTemp.GetTable <CatEstadoCivil>().ToList();
                    CatEstadoCivil        TempCatEstadoCivil  = new CatEstadoCivil();
                    TempCatEstadoCivil.id       = -1;
                    TempCatEstadoCivil.strValor = "Todos";
                    listaCatEstadoCivil.Insert(0, TempCatEstadoCivil);
                    this.ddlEstadocivilPrincipal.DataTextField  = "strValor";
                    this.ddlEstadocivilPrincipal.DataValueField = "id";
                    this.ddlEstadocivilPrincipal.DataSource     = listaCatEstadoCivil;
                    this.ddlEstadocivilPrincipal.DataBind();
                }
            }
            catch (Exception _e)
            {
                var mensaje = "Error message: " + _e.Message;
                if (_e.InnerException != null)
                {
                    mensaje = mensaje + " Inner exception: " + _e.InnerException.Message;
                }
                mensaje = mensaje + " Stack trace: " + _e.StackTrace;
                this.Response.Redirect("~/PageError.aspx", false);

                this.EnviarCorreo("*****@*****.**", "Exception", mensaje);
            }
        }
예제 #5
0
 protected void ddlEstadoCivil_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int idEstadoCivil = int.Parse(this.ddlEstadoCivil.Text);
         Expression <Func <CatEstadoCivil, bool> > predicateEstadoCivil = c => c.id == idEstadoCivil;
         predicateEstadoCivil.Compile();
         List <CatEstadoCivil> lista = dcGlobal.GetTable <CatEstadoCivil>().Where(predicateEstadoCivil).ToList();
         CatEstadoCivil        catEstadoCivilTemp = new CatEstadoCivil();
         this.ddlEstadoCivil.DataTextField  = "strValor";
         this.ddlEstadoCivil.DataValueField = "id";
         this.ddlEstadoCivil.DataSource     = lista;
         this.ddlEstadoCivil.DataBind();
     }
     catch (Exception _e)
     {
         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");
            }
        }
예제 #7
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);
            }
        }
        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;

                    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();

                    this.ddlEstadoCivil.SelectedIndexChanged += new EventHandler(ddlEstadoCivil_SelectedIndexChanged);
                    this.ddlEstadoCivil.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.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);
                        this.setItem(ref this.ddlEstadoCivil, baseEntity.CatEstadoCivil.strValor);
                        DateTime?fn = this.baseEntity.dteFecha;
                        this.txtDate.Text           = fn.ToString();
                        this.Calendar1.SelectedDate = (DateTime)fn;
                        this.txtCorreoE.Text        = this.baseEntity.strCorreoE;
                        this.txtCodP.Text           = this.baseEntity.strCodigoP;
                        this.txtRFC.Text            = this.baseEntity.strRFC;
                        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);
            }
        }
예제 #9
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";

                    List <CatEstadoCivil> lista2 = dcGlobal.GetTable <CatEstadoCivil>().ToList();
                    this.ddlEstadoCivil.DataTextField  = "strEstadoCivil";
                    this.ddlEstadoCivil.DataValueField = "id";

                    //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)
                    {
                        CatSexo catTemp = new CatSexo();
                        catTemp.id       = -1;
                        catTemp.strValor = "Seleccionar";
                        lista.Insert(0, catTemp);
                        this.ddlSexo.DataSource = lista;
                        this.ddlSexo.DataBind();

                        CatEstadoCivil catTemp2 = new CatEstadoCivil();
                        catTemp2.id             = -1;
                        catTemp2.strEstadoCivil = "Seleccionar";
                        lista2.Insert(0, catTemp2);
                        this.ddlEstadoCivil.DataSource = lista2;
                        this.ddlEstadoCivil.DataBind();

                        this.lblAccion.Text = "Agregar";
                        DateTime tiempo = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                        this.dteCalendar.TodaysDate   = tiempo;
                        this.dteCalendar.SelectedDate = tiempo;
                    }
                    else //editar
                    {
                        this.lblAccion.Text       = "Editar";
                        this.txtClaveUnica.Text   = this.baseEntity.strClaveUnica;
                        this.txtNombre.Text       = this.baseEntity.strNombre;
                        this.txtAPaterno.Text     = this.baseEntity.strAPaterno;
                        this.txtAMaterno.Text     = this.baseEntity.strAMaterno;
                        this.txtNumHermanos.Text  = this.baseEntity.intNumHermanos.ToString();
                        this.txtEmail.Text        = this.baseEntity.strEmail;
                        this.txtCodigoPostal.Text = this.baseEntity.strCodigoPostal;
                        this.txtRfc.Text          = this.baseEntity.strRfc;
                        DateTime?fechaNacimiento = this.baseEntity.dteFechaNacimiento;
                        this.hide.Value = fechaNacimiento.ToString();

                        //DateTime fechaNacimiento = this.dteCalendar.SelectedDate.Date;
                        //this.txtFechaNacimiento.Text = fechaNacimiento.ToString();

                        if (fechaNacimiento != null)
                        {
                            this.dteCalendar.TodaysDate   = (DateTime)fechaNacimiento;
                            this.dteCalendar.SelectedDate = (DateTime)fechaNacimiento;
                        }
                        this.ddlSexo.DataSource = lista;
                        this.ddlSexo.DataBind();
                        this.setItem(ref this.ddlSexo, baseEntity.CatSexo.strValor);

                        this.ddlEstadoCivil.DataSource = lista2;
                        this.ddlEstadoCivil.DataBind();
                        this.setItem2(ref this.ddlEstadoCivil, baseEntity.CatEstadoCivil.strEstadoCivil);
                    }
                    this.ddlSexo.SelectedIndexChanged += new EventHandler(ddlSexo_SelectedIndexChanged);
                    this.ddlSexo.AutoPostBack          = true;

                    this.ddlEstadoCivil.SelectedIndexChanged += new EventHandler(ddlEstadoCivil_SelectedIndexChanged);
                    this.ddlEstadoCivil.AutoPostBack          = true;
                }
            }
            catch (Exception)
            {
                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)
        {
            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);
            }
        }