protected TblPadre GetDatosVista(TblPadre padre) { 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 = "PADRE"; padre.TblDireccion = direccion; padre.TblTelefono = telefono; padre.TblUser = login; return(padre); }
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); }
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(); } }
// POST: api/Sala public bool Post([FromBody]TelTelefono _TelTelefono) { try { using (var dcTemp = new PaslumBaseDatoDataContext()) { var objTemp = new TblTelefono(); objTemp.strcelular = _TelTelefono.strCelular; objTemp.strtelCasa = _TelTelefono.strTelCasa; objTemp.strotro = _TelTelefono.strOtro; dcTemp.GetTable<TblTelefono>().InsertOnSubmit(objTemp); dcTemp.SubmitChanges(); return true; } } catch (Exception _e) { return false; } }
public TelTelefono Get(int id) { using (var dcTemp = new PaslumBaseDatoDataContext()) { TblTelefono TelTelefono = dcTemp.GetTable<TblTelefono>().Where(c => c.id == id).FirstOrDefault(); if (TelTelefono != null) { var objTemp = new TelTelefono(); objTemp.ID = TelTelefono.id; objTemp.strCelular = TelTelefono.strcelular; objTemp.strTelCasa = TelTelefono.strtelCasa; objTemp.strOtro = TelTelefono.strotro; return objTemp; } else { return new TelTelefono(); } } }
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); }