private void Guardar()
    {
        PreInscrito PreInsc = (PreInscrito)Session["PreInsc"];

        bool EsNuevo = PreInsc.Estatus == 0 && string.IsNullOrEmpty(PreInsc.Folio);

        DBEscolarDataContext db = new DBEscolarDataContext();
        if (!EsNuevo)
        {
            string CURP = PreInsc.CURP;
            PreInsc = (from A in db.PreInscritos
                       where A.CURP == CURP && A.Ciclo == Utils.CicloPreInscripciones
                       select A).FirstOrDefault();
        }

        //PreInsc.CURP = this.txtCURP.Text.ToUpper();
        PreInsc.ApPaterno = this.txtApPaterno.Text.ToUpper();
        PreInsc.ApMaterno = this.txtApMaterno.Text.ToUpper();
        PreInsc.Nombre = this.txtNombre.Text.ToUpper();
        PreInsc.Sexo = char.Parse(this.ddlSexo.SelectedValue);
        PreInsc.FechaNac = DateTime.Parse(this.txtFecNac.Text);
        PreInsc.EntidadFed = "SINALOA";
        PreInsc.Telefono = this.txtTelefono.Text.ToUpper();
        PreInsc.Celular = this.txtCelular.Text.ToUpper();
        PreInsc.Correo = this.txtCorreo.Text.ToLower();

        PreInsc.Calle = this.txtDirCalle.Text.ToUpper();
        PreInsc.Numero = this.txtDirNumero.Text.ToUpper();
        PreInsc.CodigoPostal = int.Parse(this.txtDirCP.Text);
        PreInsc.ColoniaID = int.Parse(this.ddlColonia.SelectedValue);
        PreInsc.ColoniaTXT = PreInsc.ColoniaID > 0 ? this.ddlColonia.SelectedItem.Text.ToUpper() : this.txtDirColonia.Text.ToUpper();

        PreInsc.EstadoCivil = byte.Parse(this.ddlEstadoCivil.SelectedValue);
        PreInsc.Ocupacion = byte.Parse(this.ddlOcupacion.SelectedValue);
        PreInsc.TipoBeca = byte.Parse(this.ddlTipoBeca.SelectedValue);
        PreInsc.TipoSangre = byte.Parse(this.ddlTipoSangre.SelectedValue);
        PreInsc.Alergias = this.chkAlergias.Checked ? this.txtAlergias.Text.ToUpper() : null;
        PreInsc.EnfermedadesCronicas = this.chkEnfCronicas.Checked ? this.txtEnfCronicas.Text.ToUpper() : null;
        PreInsc.CapacidadesDiferentes = this.chkCapDiferentes.Checked ? this.txtCapDiferentes.Text.ToUpper() : null;

        PreInsc.DIMSS = this.chkIMSS.Checked;
        PreInsc.DSeguroPopular = this.chkSeguro.Checked;
        PreInsc.DISSSTE = this.chkISSSTE.Checked;
        PreInsc.DPrivado = this.chkPrivado.Checked;

        PreInsc.IntPers1 = byte.Parse(this.ddlIntDet1.SelectedValue);
        PreInsc.IntPersOtros1 = this.txtIntOtro1.Text.ToUpper();
        PreInsc.IntPers2 = byte.Parse(this.ddlIntDet2.SelectedValue);
        PreInsc.IntPersOtros2 = this.txtIntOtro2.Text.ToUpper();

        PreInsc.ViveCon = byte.Parse(this.rblViveCon.SelectedValue);
        if (this.ddlViveConTutor.SelectedValue == "-1")
            PreInsc.ViveConTutor = null;
        else
            PreInsc.ViveConTutor = byte.Parse(this.ddlViveConTutor.SelectedValue);
        PreInsc.TipoVivienda = byte.Parse(this.rblTipoDeCasa.SelectedValue);
        PreInsc.IngresoMensual = byte.Parse(this.rblIngresoMensual.SelectedValue);
        PreInsc.NumIntegrantes = byte.Parse(this.ddlIntegrantes.SelectedValue);
        PreInsc.TienePC = this.chkTienePC.Checked;
        PreInsc.TieneInternet = this.chkTieneInternet.Checked;

        PreInsc.SecundariaID = int.Parse(this.ddlSecSecundaria.SelectedValue);
        PreInsc.SecundariaTXT = PreInsc.SecundariaID > 0 ? this.ddlSecSecundaria.SelectedItem.Text.ToUpper() : this.txtSecundaria.Text.ToUpper();

        if (this.tabPadre.Visible)
        {
            PreInsc.PadreApPaterno = this.txtPadreApPaterno.Text.ToUpper();
            PreInsc.PadreApMaterno = this.txtPadreApMaterno.Text.ToUpper();
            PreInsc.PadreNombre = this.txtPadreNombre.Text.ToUpper();
            PreInsc.PadreTelefono = this.txtPadreTelefono.Text.ToUpper();
            PreInsc.PadreOcupacion = byte.Parse(this.ddlPadreOcupacion.SelectedValue);
            PreInsc.PadreEmpresa = this.txtPadreEmpresa.Text.ToUpper();
        }
        else
        {
            PreInsc.PadreApPaterno = PreInsc.PadreApMaterno = PreInsc.PadreNombre = PreInsc.PadreTelefono = PreInsc.PadreEmpresa = null;
            PreInsc.PadreOcupacion = null;
        }

        if (this.tabMadre.Visible)
        {
            PreInsc.MadreApPaterno = this.txtMadreApPaterno.Text.ToUpper();
            PreInsc.MadreApMaterno = this.txtMadreApMaterno.Text.ToUpper();
            PreInsc.MadreNombre = this.txtMadreNombre.Text.ToUpper();
            PreInsc.MadreTelefono = this.txtMadreTelefono.Text.ToUpper();
            PreInsc.MadreOcupacion = byte.Parse(this.ddlMadreOcupacion.SelectedValue);
            PreInsc.MadreEmpresa = this.txtMadreEmpresa.Text.ToUpper();
        }
        else
        {
            PreInsc.MadreApPaterno = PreInsc.MadreApMaterno = PreInsc.MadreNombre = PreInsc.MadreTelefono = PreInsc.MadreEmpresa = null;
            PreInsc.MadreOcupacion = null;
        }

        PreInsc.FechaDeModif = DateTime.Now;

        if (EsNuevo)
        {
            string Folio = "";
            db.spEXEGetFolioPreInscripcion(PreInsc.PlantelID, PreInsc.Ciclo, ref Folio);
            PreInsc.Folio = Folio;

            //PreInsc.EntidadFed = "";
            PreInsc.FechaDeAlta = DateTime.Now;
            PreInsc.Estatus = 0;

            db.PreInscritos.InsertOnSubmit(PreInsc);
        }
        else
        {
            //Checar si hubo cambio de plantel
            if (PreInsc.PlantelID.ToString() != this.ddlPlantelPlantel.SelectedValue)
            {
                PreInsc.PlantelID = byte.Parse(this.ddlPlantelPlantel.SelectedValue);
                PreInsc.Turno = byte.Parse(this.ddlPlantelTurno.SelectedValue);

                string Folio = "";
                db.spEXEGetFolioPreInscripcion(PreInsc.PlantelID, PreInsc.Ciclo, ref Folio);
                PreInsc.Folio = Folio;
            }
        }

        try
        {
            db.SubmitChanges();
            Session["PreInsc"] = PreInsc;
        }
        catch (Exception ex)
        {
            this.AlertToPage("Lo sentimos, ha ocurrido un problema al guardar tus datos. Si el problema persiste, favor de acudir directamente al plantel. \\n ERROR: " + ex.Message);
            return;
        }

        this.TabContainer1.ActiveTabIndex = 0;

        this.GenerarPDF();
    }
Пример #2
0
    private void Guardar()
    {
        DBEscolarDataContext db = new DBEscolarDataContext();
        var Alumno = (from A in db.Alumnos
                      where A.Matricula == this.Matricula
                      select A).FirstOrDefault();

        if (Alumno == null) //NO existe en Alumnos
        {
            //Si no esta en la sesion, que lo cargue
            AlumnoReinsc Alu = Session["AlumnoReinsc"] as AlumnoReinsc ?? (from A in db.AlumnoReinscs
                                                                           where A.Matricula == this.Matricula
                                                                           select A).FirstOrDefault();

            if (Alu == null) //NO EXISTE, nunca debe de pasar, si no, no hubiera pasado Accesar
                return;

            Alumno = new Alumno();
            Alumno.PlantelID = Alu.PlantelID;
            Alumno.Turno = Alu.Turno;
            Alumno.Grupo = Alu.Grupo;
            Alumno.Semestre = Alu.Semestre;
            Alumno.Matricula = Alu.Matricula;

            Alumno.FechaDeAlta = DateTime.Now;
            db.Alumnos.InsertOnSubmit(Alumno);
        }
        else if (Alumno.Estatus == 0 && Alumno.Semestre < 6)//Si ya esta en alumnos pero esta actualizando
        {
            Alumno.Semestre += 1;
            Alumno.Grupo += 100;
        }

        Alumno.CURP = this.txtCURP.Text.ToUpper();
        Alumno.ApPaterno = this.txtApPaterno.Text.ToUpper();
        Alumno.ApMaterno = this.txtApMaterno.Text.ToUpper();
        Alumno.Nombre = this.txtNombre.Text.ToUpper();
        Alumno.Sexo = char.Parse(this.ddlSexo.SelectedValue);
        Alumno.FechaNac = DateTime.Parse(this.txtFecNac.Text);

        Alumno.Telefono = this.txtTelefono.Text.ToUpper();
        Alumno.Celular = this.txtCelular.Text.ToUpper();
        Alumno.Correo = this.txtCorreo.Text.ToLower();

        Alumno.Calle = this.txtDirCalle.Text.ToUpper();
        Alumno.Numero = this.txtDirNumero.Text.ToUpper();
        Alumno.CodigoPostal = int.Parse(this.txtDirCP.Text);
        Alumno.ColoniaID = int.Parse(this.ddlColonia.SelectedValue);
        Alumno.ColoniaTXT = Alumno.ColoniaID > 0 ? this.ddlColonia.SelectedItem.Text.ToUpper() : this.txtDirColonia.Text.ToUpper();

        Alumno.EstadoCivil = byte.Parse(this.ddlEstadoCivil.SelectedValue);
        Alumno.Ocupacion = byte.Parse(this.ddlOcupacion.SelectedValue);
        Alumno.TipoBeca = byte.Parse(this.ddlTipoBeca.SelectedValue);
        Alumno.TipoSangre = byte.Parse(this.ddlTipoSangre.SelectedValue);
        Alumno.Alergias = this.chkAlergias.Checked ? this.txtAlergias.Text.ToUpper() : null;
        Alumno.EnfermedadesCronicas = this.chkEnfCronicas.Checked ? this.txtEnfCronicas.Text.ToUpper() : null;
        Alumno.CapacidadesDiferentes = this.chkCapDiferentes.Checked ? this.txtCapDiferentes.Text.ToUpper() : null;

        Alumno.DIMSS = this.chkIMSS.Checked;
        Alumno.DSeguroPopular = this.chkSeguro.Checked;
        Alumno.DISSSTE = this.chkISSSTE.Checked;
        Alumno.DPrivado = this.chkPrivado.Checked;

        Alumno.IntPers1 = byte.Parse(this.ddlIntDet1.SelectedValue);
        Alumno.IntPersOtros1 = this.txtIntOtro1.Text.ToUpper();
        Alumno.IntPers2 = byte.Parse(this.ddlIntDet2.SelectedValue);
        Alumno.IntPersOtros2 = this.txtIntOtro2.Text.ToUpper();

        Alumno.ViveCon = byte.Parse(this.rblViveCon.SelectedValue);
        if (this.ddlViveConTutor.SelectedValue == "-1")
            Alumno.ViveConTutor = null;
        else
            Alumno.ViveConTutor = byte.Parse(this.ddlViveConTutor.SelectedValue);
        Alumno.TipoVivienda = byte.Parse(this.rblTipoDeCasa.SelectedValue);
        Alumno.IngresoMensual = byte.Parse(this.rblIngresoMensual.SelectedValue);
        Alumno.NumIntegrantes = byte.Parse(this.ddlIntegrantes.SelectedValue);
        Alumno.TienePC = this.chkTienePC.Checked;
        Alumno.TieneInternet = this.chkTieneInternet.Checked;

        Alumno.SecundariaID = int.Parse(this.ddlSecSecundaria.SelectedValue);
        Alumno.SecundariaTXT = Alumno.SecundariaID > 0 ? this.ddlSecSecundaria.SelectedItem.Text.ToUpper() : this.txtSecundaria.Text.ToUpper();

        if (this.tabPadre.Visible)
        {
            Alumno.PadreApPaterno = this.txtPadreApPaterno.Text.ToUpper();
            Alumno.PadreApMaterno = this.txtPadreApMaterno.Text.ToUpper();
            Alumno.PadreNombre = this.txtPadreNombre.Text.ToUpper();
            Alumno.PadreTelefono = this.txtPadreTelefono.Text.ToUpper();
            Alumno.PadreOcupacion = byte.Parse(this.ddlPadreOcupacion.SelectedValue);
            Alumno.PadreEmpresa = this.txtPadreEmpresa.Text.ToUpper();
        }
        else
        {
            Alumno.PadreApPaterno = Alumno.PadreApMaterno = Alumno.PadreNombre = Alumno.PadreTelefono = Alumno.PadreEmpresa = null;
            Alumno.PadreOcupacion = null;
        }

        if (this.tabMadre.Visible)
        {
            Alumno.MadreApPaterno = this.txtMadreApPaterno.Text.ToUpper();
            Alumno.MadreApMaterno = this.txtMadreApMaterno.Text.ToUpper();
            Alumno.MadreNombre = this.txtMadreNombre.Text.ToUpper();
            Alumno.MadreTelefono = this.txtMadreTelefono.Text.ToUpper();
            Alumno.MadreOcupacion = byte.Parse(this.ddlMadreOcupacion.SelectedValue);
            Alumno.MadreEmpresa = this.txtMadreEmpresa.Text.ToUpper();
        }
        else
        {
            Alumno.MadreApPaterno = Alumno.MadreApMaterno = Alumno.MadreNombre = Alumno.MadreTelefono = Alumno.MadreEmpresa = null;
            Alumno.MadreOcupacion = null;
        }

        Alumno.EntidadFed = "";
        Alumno.FechaDeModif = DateTime.Now;
        Alumno.Estatus = 1;

        db.SubmitChanges();
        this.TabContainer1.ActiveTabIndex = 0;

        //this.GenerarPDF();

        //int Reprobadas = this.MateriasReprobadas(Alumno.Matricula, Utils.CicloAnterior);
        //if (this.PasaValidacionAutomatica(Reprobadas))
        //{

        int folioPa=0;
        Plantel P = new Plantel();
        if (Pagos.GenerarReciboDePago(Alumno, Utils.CicloActual, true, out folioPa,out P))
        {
            Session["AlumnoID"] = Alumno.AlumnoID;
            try
            {

                Activa_Correo(Alumno.Matricula, folioPa, P.Zona, P.plantel);

            }
            catch (Exception e) { }
            //Guardar el AlumnoID en la sesion para que pueda imprimir la ficha de pago
            Response.Redirect("ImprimirFichaDePago.aspx");

            return;
        }
        //}

        this.GenerarPDF();
    }
Пример #3
0
    private void Guardar()
    {
        Alumnos_Virtual PreInsc = (Alumnos_Virtual)Session["PreInsc"];

        bool EsNuevo = PreInsc.Estatus == 0 && string.IsNullOrEmpty(PreInsc.Matricula);

        DBEscolarDataContext db = new DBEscolarDataContext();
        if (!EsNuevo)
        {
            string CURP = PreInsc.CURP;
            PreInsc = (from A in db.Alumnos_Virtuals
                       where A.CURP == CURP
                       select A).FirstOrDefault();
        }

        PreInsc.CURP = this.txtCURP.Text.ToUpper();
        PreInsc.ApPaterno = this.txtApPaterno.Text.ToUpper();
        PreInsc.ApMaterno = this.txtApMaterno.Text.ToUpper();
        PreInsc.Nombre = this.txtNombre.Text.ToUpper();
        PreInsc.Sexo = char.Parse(this.ddlSexo.SelectedValue);
        PreInsc.FechaNac = DateTime.Parse(this.txtFecNac.Text);
        PreInsc.EntidadFed = this.txtEstado.Text.ToUpper();

        PreInsc.Telefono = this.txtTelefono.Text.ToUpper();
        PreInsc.Celular = this.txtCelular.Text.ToUpper();
        PreInsc.Correo = this.txtCorreo.Text.ToLower();

        PreInsc.Calle = this.txtDirCalle.Text.ToUpper();
        PreInsc.Numero = this.txtDirNumero.Text.ToUpper();
        PreInsc.CodigoPostal = int.Parse(this.txtDirCP.Text);
        PreInsc.ColoniaID = int.Parse(this.ddlColonia.SelectedValue);
        PreInsc.ColoniaTXT = PreInsc.ColoniaID > 0 ? this.ddlColonia.SelectedItem.Text.ToUpper() : this.txtDirColonia.Text.ToUpper();
        PreInsc.MunicipioID = byte.Parse(this.ddlMunicipio.SelectedValue.ToString());

        if (EsNuevo)
        {
            string Folio = "";
            db.spEXEGetFolioPreInscripcion(PreInsc.PlantelID, "2015B", ref Folio);
            PreInsc.Matricula = Folio;

            //PreInsc.EntidadFed = "";
            PreInsc.Matricula = Folio; //Guardar el folio por mientras
            PreInsc.FechaDeAlta = DateTime.Now;
            PreInsc.Estatus = 1;

            db.Alumnos_Virtuals.InsertOnSubmit(PreInsc);
        }

        try
        {
            db.SubmitChanges();
            Session["PreInsc"] = PreInsc;
        }
        catch (Exception ex)
        {
            this.AlertToPage("Lo sentimos, ha ocurrido un problema al guardar tus datos. Si el problema persiste, favor de acudir directamente al plantel. \\n ERROR: " + ex.Message);
            return;
        }

        this.GenerarPDF();
    }