Пример #1
0
        protected TblProfesor GetDatosVista(TblProfesor prof)
        {
            TblDireccion direccion = new TblDireccion();

            direccion.strestado      = txtDirecEstado.Text.ToUpper();
            direccion.strmunicipio   = txtDirecMunicipio.Text.ToUpper();
            direccion.strcolonia     = txtDirecColonia.Text.ToUpper();
            direccion.strcalle       = txtDirecCalle.Text.ToUpper();
            direccion.intcodpost     = Int32.Parse(txtIntCodigo.Text);
            direccion.strnumInt      = txtDirecInter.Text.ToUpper();
            direccion.strnumExt      = txtDirecExt.Text.ToUpper();
            direccion.strreferencias = txtDirecReferencia.Text.ToUpper();

            TblTelefono telefono = new TblTelefono();

            telefono.strcelular = txtTelCelular.Text.ToUpper();
            telefono.strtelCasa = txtTelCasa.Text.ToUpper();
            telefono.strotro    = txtTelOtro.Text.ToUpper();

            TblUser login = new TblUser();

            login.strusuario     = txtUsuario.Text.ToString();
            login.strpass        = txtPass.Text.ToString();
            login.strtipoUsuario = "PROFESOR";

            prof.TblDireccion = direccion;
            prof.TblTelefono  = telefono;
            prof.TblUser      = login;

            return(prof);
        }
        protected TblProfesor GetDatosVista(TblProfesor prof)
        {
            var random = new Random();
            var value  = random.Next(0, 999999);

            TblDireccion direccion = new TblDireccion();

            direccion.strestado      = txtDirecEstado.Text.ToUpper();
            direccion.strmunicipio   = txtDirecMunicipio.Text.ToUpper();
            direccion.strcolonia     = txtDirecColonia.Text.ToUpper();
            direccion.strcalle       = txtDirecCalle.Text.ToUpper();
            direccion.intcodpost     = Int32.Parse(txtpostal.Text);
            direccion.strnumInt      = txtDirecInter.Text.ToUpper();
            direccion.strnumExt      = txtDirecExt.Text.ToUpper();
            direccion.strreferencias = TxtReferencia.Text.ToUpper();

            TblTelefono telefono = new TblTelefono();

            telefono.strcelular = txtTelCelular.Text.ToUpper();
            telefono.strtelCasa = txtTelCasa.Text.ToUpper();
            telefono.strotro    = txtTelotro.Text.ToUpper();

            TblUser login = new TblUser();

            login.strusuario     = txtCorreoAgregar.Text;
            login.strpass        = value.ToString();
            login.strtipoUsuario = "PROFESOR";

            prof.TblDireccion = direccion;
            prof.TblTelefono  = telefono;
            prof.TblUser      = login;

            return(prof);
        }
Пример #3
0
        public void Editar(TblProfesor profe, TblTelefono tel, TblDireccion dom)
        {
            TblProfesor profeBd = contexto.TblProfesor
                                  .Where(t => t.id == profe.id).FirstOrDefault();

            if (profeBd != null)
            {
                profeBd.strCorreo = profe.strCorreo;
                contexto.SubmitChanges();
            }

            TblTelefono telBd = contexto.TblTelefono
                                .Where(t => t.id == tel.id).FirstOrDefault();

            if (telBd != null)
            {
                telBd.strcelular = tel.strcelular;
                telBd.strtelCasa = tel.strtelCasa;
                telBd.strotro    = tel.strotro;
                contexto.SubmitChanges();
            }

            TblDireccion domBd = contexto.TblDireccion
                                 .Where(t => t.id == dom.id).FirstOrDefault();

            if (domBd != null)
            {
                domBd.strcalle     = dom.strcalle;
                domBd.strcolonia   = dom.strcolonia;
                domBd.strmunicipio = dom.strmunicipio;
                contexto.SubmitChanges();
            }
        }
Пример #4
0
        public bool InsertarProfe(TblProfesor _TBL_Profe)
        {
            bool respuesta = false;

            try
            {
                contexto.TblProfesor.InsertOnSubmit(_TBL_Profe);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
Пример #5
0
        protected void btnRegistrarProfe_Click(object sender, EventArgs e)
        {
            if (FotoPerfil.HasFile)
            {
                string path = Server.MapPath("~/Imagenes/ProfeRegistrado/" + FotoPerfil.FileName);
                FotoPerfil.SaveAs(path);

                TblProfesor prof = new TblProfesor();
                prof.strNombre    = txtNombre.Text.ToUpper();
                prof.strApellidoP = txtAPaterno.Text.ToUpper();
                prof.strApellidoM = txtAMaterno.Text.ToUpper();
                prof.intEdad      = Int32.Parse(txtEdad.Text);
                prof.strSexo      = txtSexo.Text.ToUpper();
                prof.strCorreo    = txtCorreo.Text;
                prof.strCedula    = txtCedula.Text;
                prof.bitFoto      = path;
                ControllerProfesor ctrlProfe = new ControllerProfesor();
                ctrlProfe.InsertarProfe(GetDatosVista(prof));
            }
            this.Response.Redirect("./InicioAdmin.aspx", true);
        }
        protected void btnAceptarAgregar_Click(object sender, EventArgs e)
        {
            var sex = cmbSexo.SelectedItem.Value;

            if (FotoMaestro.HasFile)
            {
                string path = Server.MapPath("~/images/ProfeRegistrado/" + FotoMaestro.FileName);
                FotoMaestro.SaveAs(path);

                TblProfesor prof = new TblProfesor();
                prof.strNombre       = txtNombreAgregar.Text.ToUpper();
                prof.strApellidoP    = txtPaternoAgregar.Text.ToUpper();
                prof.strApellidoM    = txtMaternoAgregar.Text.ToUpper();
                prof.intEdad         = Int32.Parse(txtEdadAgregar.Text);
                prof.strSexo         = sex;
                prof.strCorreo       = txtCorreoAgregar.Text;
                prof.strCedula       = txtCedulaAgregar.Text;
                prof.strEspecialidad = txtEspecialidadAgregar.Text.ToUpper();
                prof.bitFoto         = path;
                ControllerMaestro ctrlProfe = new ControllerMaestro();
                ctrlProfe.InsertarProfe(GetDatosVista(prof));
            }
            this.Response.Redirect("./Maestrosadmin.aspx", true);
        }
Пример #7
0
        protected void BtnEditar_Click(object sender, EventArgs e)
        {
            TblProfesor prof = new TblProfesor();

            prof.id = Convert.ToInt32(Session["id"]);
            if (TxtCorreo.Text.Length > 1)
            {
                prof.strCorreo = TxtCorreo.Text;
            }
            else
            {
                prof.strCorreo = lbcorreo.Text;
            }

            TblTelefono tel = new TblTelefono();

            tel.id = Convert.ToInt32(Session["forTel"]);
            if (TxtCelular.Text.Length > 1)
            {
                tel.strcelular = TxtCelular.Text;
            }
            else
            {
                tel.strcelular = lbCelular.Text;
            }
            if (TxtTelefono.Text.Length > 1)
            {
                tel.strtelCasa = TxtTelefono.Text;
            }
            else
            {
                tel.strtelCasa = lbTelefono.Text;
            }
            if (TxtOtro.Text.Length > 1)
            {
                tel.strotro = TxtOtro.Text;
            }
            else
            {
                tel.strotro = lbOtro.Text;
            }

            TblDireccion dom = new TblDireccion();

            dom.id = Convert.ToInt32(Session["forDom"]);
            if (TxtCalle.Text.Length > 1)
            {
                dom.strcalle = TxtCalle.Text;
            }
            else
            {
                dom.strcalle = lbCalle.Text;
            }
            if (TxtColonia.Text.Length > 1)
            {
                dom.strcolonia = TxtColonia.Text;
            }
            else
            {
                dom.strcolonia = lbColonia.Text;
            }
            if (TxtMunicipio.Text.Length > 1)
            {
                dom.strmunicipio = TxtMunicipio.Text;
            }
            else
            {
                dom.strmunicipio = lbMunicipio.Text;
            }
            ControllerMaestro ctrlProfe = new ControllerMaestro();

            ctrlProfe.Editar(prof, tel, dom);
            this.Response.Redirect("./DatosPersonales.aspx", true);
        }