public int CrearFuncionario(INFRACTOR p, int p_2) { if(p_2==1) p.PASSWORD_INFR = GeneraMd5.instancia.md5(p.RUT_INFR.ToString().Substring(0,5)); return DaoInfractor.Instancia.CrearFuncionario(p, p_2); }
protected void btnGuardarAIn_Click(object sender, EventArgs e) { INFRACTOR p = new INFRACTOR(); p.RUT_INFR = txtRutAIn.Text; p.NOMBRE_INFR= txtNomAIn.Text; p.APPAT_INFR= txtAppatAIn.Text; p.APMAT_INFR = txtApmatAIn.Text; p.ACTIVO = "1"; p.DIRECCION_INFR= txtDirAIn.Text; p.TELEFONO_INFR= txtTelAIn.Text; p.EMAIL_INFR = txtEmailAIn.Text; p.PASSWORD_INFR = "aa"; p.NUM_LICENCIA = Convert.ToDecimal("3"); p.ID_VEHICULO = Convert.ToDecimal("2"); int newInfractor = NegocioFuncionario.instancia.CrearInfractor(p); if (newInfractor == 1) { Response.Write("<script language=javascript>alert('Los datos han sido guardados exitosamente');</script>"); txtRutAIn.Text = ""; txtNomAIn.Text = ""; txtAppatAIn.Text = ""; txtApmatAIn.Text = ""; txtDirAIn.Text = ""; txtTelAIn.Text = ""; txtEmailAIn.Text = ""; } else Response.Write("<script language=javascript>alert('Datos no guardados');</script>"); }
protected void bot_guardar_datos_Click(object sender, EventArgs e) { INFRACTOR p = new INFRACTOR(); p.RUT_INFR = Convert.ToDecimal(rut_infr.Text); p.NOMBRE_INFR= nom_infr.Text; p.APPAT_INFR= appat_infr.Text; p.APMAT_INFR = apmat_infr.Text; p.ACTIVO = "1"; p.DIRECCION_INFR= dir_infr.Text; p.TELEFONO_INFR= fono_infr.Text; p.EMAIL_INFR = email_infr.Text; p.PASSWORD_INFR = "aa"; p.NUM_LICENCIA = Convert.ToDecimal("3"); p.ID_VEHICULO = Convert.ToDecimal("2"); int newInfractor = NegocioFuncionario.instancia.CrearInfractor(p); if (newInfractor == 1) { Response.Write("<script language=javascript>alert('Los datos han sido guardados exitosamente');</script>"); rut_infr.Text = ""; nom_infr.Text = ""; appat_infr.Text = ""; apmat_infr.Text = ""; rut_infr.Text = ""; nom_infr.Text = ""; dir_infr.Text = ""; fono_infr.Text = ""; email_infr.Text = ""; } else Response.Write("<script language=javascript>alert('Datos no guardados');</script>"); }
public INFRACTOR buscarInfractorPat(int rut) { using (SRI contex = new SRI()) { INFRACTOR lbuscar = new INFRACTOR(); lbuscar = contex.INFRACTOR.Where(a => a.ID_VEHICULO == rut).FirstOrDefault(); return lbuscar; } }
public int CrearInfractor(INFRACTOR dto) { try { using (SRI sri = new SRI()) { dto.ID_INFRACTOR = RetornarNuevoId(); sri.INFRACTOR.AddObject(dto); sri.SaveChanges(); return 1; } } catch (Exception e) { return 0; } }
public int actualizaClave(String newClave, String rut) { using (SRI contex = new SRI()) { try { INFRACTOR lista = new INFRACTOR(); lista = contex.INFRACTOR.Where(a => a.RUT_INFR == rut).FirstOrDefault(); lista.PASSWORD_INFR = newClave; contex.SaveChanges(); return 1; } catch (Exception e) { return 0; } } }
public int actualizaDatosPersonales(String email, String telefono, String rut) { using (SRI contex = new SRI()) { try { INFRACTOR objInfractor = new INFRACTOR(); objInfractor = contex.INFRACTOR.Where(a => a.RUT_INFR == rut).FirstOrDefault(); objInfractor.EMAIL_INFR = email; objInfractor.TELEFONO_INFR = telefono; contex.SaveChanges(); return 1; } catch (Exception e) { return 0; } } }
public int CrearInfractor(INFRACTOR dto) { dto.PASSWORD_INFR = MetodosGenericos.instancia.md5(dto.RUT_INFR.ToString().Substring(0, 5)); return DaoInfractor.instancia.CrearInfractor(dto); }
/// <summary> /// Método desusado para agregar un nuevo objeto al EntitySet INFRACTOR. Considere la posibilidad de usar el método .Add de la propiedad ObjectSet<T> asociada. /// </summary> public void AddToINFRACTOR(INFRACTOR iNFRACTOR) { base.AddObject("INFRACTOR", iNFRACTOR); }
/// <summary> /// Crear un nuevo objeto INFRACTOR. /// </summary> /// <param name="iD_INFRACTOR">Valor inicial de la propiedad ID_INFRACTOR.</param> /// <param name="rUT_INFR">Valor inicial de la propiedad RUT_INFR.</param> /// <param name="nOMBRE_INFR">Valor inicial de la propiedad NOMBRE_INFR.</param> /// <param name="aPPAT_INFR">Valor inicial de la propiedad APPAT_INFR.</param> /// <param name="aPMAT_INFR">Valor inicial de la propiedad APMAT_INFR.</param> /// <param name="pASSWORD_INFR">Valor inicial de la propiedad PASSWORD_INFR.</param> /// <param name="dIRECCION_INFR">Valor inicial de la propiedad DIRECCION_INFR.</param> /// <param name="nUM_LICENCIA">Valor inicial de la propiedad NUM_LICENCIA.</param> /// <param name="aCTIVO">Valor inicial de la propiedad ACTIVO.</param> /// <param name="iD_VEHICULO">Valor inicial de la propiedad ID_VEHICULO.</param> /// <param name="iD_CLASE_LICENCIA">Valor inicial de la propiedad ID_CLASE_LICENCIA.</param> public static INFRACTOR CreateINFRACTOR(global::System.Decimal iD_INFRACTOR, global::System.String rUT_INFR, global::System.String nOMBRE_INFR, global::System.String aPPAT_INFR, global::System.String aPMAT_INFR, global::System.String pASSWORD_INFR, global::System.String dIRECCION_INFR, global::System.Decimal nUM_LICENCIA, global::System.String aCTIVO, global::System.Decimal iD_VEHICULO, global::System.Decimal iD_CLASE_LICENCIA) { INFRACTOR iNFRACTOR = new INFRACTOR(); iNFRACTOR.ID_INFRACTOR = iD_INFRACTOR; iNFRACTOR.RUT_INFR = rUT_INFR; iNFRACTOR.NOMBRE_INFR = nOMBRE_INFR; iNFRACTOR.APPAT_INFR = aPPAT_INFR; iNFRACTOR.APMAT_INFR = aPMAT_INFR; iNFRACTOR.PASSWORD_INFR = pASSWORD_INFR; iNFRACTOR.DIRECCION_INFR = dIRECCION_INFR; iNFRACTOR.NUM_LICENCIA = nUM_LICENCIA; iNFRACTOR.ACTIVO = aCTIVO; iNFRACTOR.ID_VEHICULO = iD_VEHICULO; iNFRACTOR.ID_CLASE_LICENCIA = iD_CLASE_LICENCIA; return iNFRACTOR; }
public int funcionarioId(INFRACTOR dto) { try { using (SRI sri = new SRI()) { dto.ID_INFRACTOR = RetornarNuevoId(); sri.INFRACTOR.AddObject(dto); sri.SaveChanges(); return (int)dto.ID_INFRACTOR; } } catch (Exception e) { return 0; } }
protected void btnGuardarIM_Click1(object sender, EventArgs e) { String rut = ""; String NOMBRE_INFR = ""; String APPAT_INFR = ""; String APMAT_INFR = ""; String DIRECCION_INFR = ""; String FECHANACIMIENTO = ""; String patente =""; ArrayList datos = new ArrayList(); datos = NegocioInspector.instancia.datosRegistroCivil(txtPatIM.Text); if (!datos[0].ToString().Equals("error")) { rut = datos[0].ToString(); NOMBRE_INFR = datos[1].ToString(); patente = datos[2].ToString(); APPAT_INFR = datos[3].ToString(); APMAT_INFR = datos[4].ToString(); FECHANACIMIENTO = datos[5].ToString(); DIRECCION_INFR = datos[6].ToString(); } MULTA objM = new MULTA(); objM.FECHA_CREACION =Convert.ToDateTime(txtFechaMultaIM.Text); objM.FECHA_INTEGRACION = Convert.ToDateTime(txtFechaMultaIM.Text); objM.HORA_MULTA = txtHoraMultaIM.Text; objM.MONTO_ADICIONAL = 0; objM.PAGADA = "0"; objM.ACTIVO = "1"; objM.ID_TIPO_PAGO = 1146; objM.LICENCIA_ENTREGADA = "0"; if (chkCarabIM.Checked) { if (!String.IsNullOrEmpty(txtLicCarabIM.Text)) { objM.CARABINERO_OPC = 1; objM.ID_LIC_CARAB = Convert.ToInt32(txtLicCarabIM.Text); if (chkRetLicIM.Checked) objM.RETENCION_LICENCIA = "1"; else objM.RETENCION_LICENCIA = "0"; } } else objM.CARABINERO_OPC = 0; objM.ID_PERSONAL = NegocioInspector.instancia.buscaInspector(Session["usuario"].ToString()); if (!NegocioInfractor.instancia.existeRut(rut)) { objM.ID_INFRACTOR = NegocioInfractor.instancia.idInfractor(rut); } else { INFRACTOR inf = new INFRACTOR(); inf.RUT_INFR = rut; inf.NOMBRE_INFR = NOMBRE_INFR; inf.APPAT_INFR = APPAT_INFR; inf.APMAT_INFR = APMAT_INFR; inf.DIRECCION_INFR = DIRECCION_INFR; inf.FECHA_NAC = Convert.ToDateTime(FECHANACIMIENTO); inf.TELEFONO_INFR = ""; if (NegocioInspector.instancia.existeVehiculo(patente) > 0) inf.ID_VEHICULO = NegocioInspector.instancia.existeVehiculo(patente); else inf.ID_VEHICULO = NegocioInspector.instancia.creaVehiculo(patente); inf.ID_CLASE_LICENCIA = 6; int largoRut = rut.Length; rut = rut.Substring(0, largoRut - 1); inf.NUM_LICENCIA = Convert.ToInt32(rut); inf.ACTIVO = "1"; objM.ID_INFRACTOR = NegocioInfractor.instancia.FunConId(inf); } objM.ID_VIA_CIRCULACION = NegocioInspector.instancia.idViaN(Convert.ToInt32(ddlistLugarInfIM.SelectedValue)); int idMOneda = NegocioInspector.instancia.idInfraccion(Convert.ToInt32(ddlistMotivoIM.SelectedValue)); int idInfraccion = NegocioInspector.instancia.idInfraccion2(Convert.ToInt32(ddlistMotivoIM.SelectedValue)); objM.ID_INFRACCION = idInfraccion; objM.ID_MONEDA = NegocioInspector.instancia.moneda(idMOneda); objM.DETALLE_ADICIONAL = txtDetalleAdicIM.Text; objM.ID_RESTRICCION = NegocioInspector.instancia.idRestriccion(); if (FileUpload.HasFile) { String Extension = System.IO.Path.GetExtension(FileUpload.FileName); int peso = FileUpload.PostedFile.ContentLength; if (Extension.ToLower() != ".doc" && Extension.ToLower() != ".docx" && Extension.ToLower() != ".pdf" && Extension.ToLower() != ".jpg" && Extension.ToLower() != ".png" && Extension.ToLower() != ".zip" && Extension.ToLower() != ".rar") { lblInfoIM.Text = "El archivo no cumple con los formatos solicitados"; lblInfoIM.ForeColor = System.Drawing.Color.Red; lblInfoIM.Visible = true; } else { if (peso <= 5242880) { if (FileUpload.FileName.Length < 50) { objM.ADJUNTO = txtRutIM.Text +"_multa_"+ "_" + FileUpload.FileName; int grabado = NegocioInspector.instancia.grabaMulta(objM); FileUpload.SaveAs(Server.MapPath("~/Upload/" + grabado + "_" + txtRutIM.Text + "_multa_" + FileUpload.FileName)); } else { /////// } } else { lblInfoIM.Text = "El archivo supera los 5mb permitidos"; lblInfoIM.ForeColor = System.Drawing.Color.Red; lblInfoIM.Visible = true; } } } else { objM.ADJUNTO = "ARCHIVO EN BLANCO O NO ADJUNTO"; int grabado = NegocioInspector.instancia.grabaMulta(objM); } }
protected void btnGuardarAF_Click(object sender, EventArgs e) { lblInfoAF.Visible = false; if (ValidaRut.instancia.VerificaRut(txtRutAF.Text)) { if (NegocioInfractor.instancia.existeRut(txtRutAF.Text)) { INFRACTOR p = new INFRACTOR(); p.RUT_INFR = txtRutAF.Text; p.NOMBRE_INFR = txtNomAF.Text; p.APPAT_INFR = txtAppatAF.Text; p.APMAT_INFR = txtApmatAF.Text; p.DIRECCION_INFR = txtDirAF.Text; p.TELEFONO_INFR = txtFonoAF.Text; p.EMAIL_INFR = txtEmailAF.Text; if (chkActivoAF.Checked) p.ACTIVO = "1"; else p.ACTIVO = "0"; int newPersonal = NegocioFuncionario.instancia.CrearFuncionario(p, 1); if (newPersonal == 1) { txtRutAF.Text = ""; txtNomAF.Text = ""; txtAppatAF.Text = ""; txtApmatAF.Text = ""; txtDirAF.Text = ""; txtFonoAF.Text = ""; txtEmailAF.Text = ""; chkActivoAF.Checked = true; lblInfoAF.Text = "Los Datos han sido guardados exitosamente"; lblInfoAF.Visible = true; lblInfoAF.ForeColor = System.Drawing.Color.Gray; } else lblInfoAF.Text = "Los Datos no han sido guardados"; lblInfoAF.Visible = true; lblInfoAF.ForeColor = System.Drawing.Color.Red; } else lblInfoAF.Text = "El Usuario ya existe"; } else { int n = 0; if (txtRutAF.Text == "" || txtRutAF.Text == null) { txtRutAF.BorderColor = System.Drawing.Color.Red; txtRutAF.BorderWidth = 1; n = 1; } else { txtRutAF.BorderColor = System.Drawing.Color.LightGray; txtRutAF.BorderWidth = 1; n = 0; } if (txtNomAF.Text == "" || txtNomAF.Text == null) { txtNomAF.BorderColor = System.Drawing.Color.Red; txtNomAF.BorderWidth = 1; n = 1; } else { txtNomAF.BorderColor = System.Drawing.Color.LightGray; txtNomAF.BorderWidth = 1; n = 0; } if (txtAppatAF.Text == "" || txtAppatAF.Text == null) { txtAppatAF.BorderColor = System.Drawing.Color.Red; txtAppatAF.BorderWidth = 1; n = 1; } else { txtAppatAF.BorderColor = System.Drawing.Color.LightGray; txtAppatAF.BorderWidth = 1; n = 0; } if (txtApmatAF.Text == "" || txtApmatAF.Text == null) { txtApmatAF.BorderColor = System.Drawing.Color.Red; txtApmatAF.BorderWidth = 1; n = 1; } else { txtApmatAF.BorderColor = System.Drawing.Color.LightGray; txtApmatAF.BorderWidth = 1; n = 0; } if (txtDirAF.Text == "" || txtDirAF.Text == null) { txtDirAF.BorderColor = System.Drawing.Color.Red; txtDirAF.BorderWidth = 1; n = 1; } else { txtDirAF.BorderColor = System.Drawing.Color.LightGray; txtDirAF.BorderWidth = 1; n = 0; } if (n == 1) { lblInfoAF.Visible = true; lblInfoAF.Text = "No se pueden guardar datos sin agregar el Rut"; lblInfoAF.ForeColor = System.Drawing.Color.Red; } } }
public int ReiniciarClave(String clave, String rut) { try { using (SRI contex = new SRI()) { INFRACTOR infr = new INFRACTOR(); infr = contex.INFRACTOR.Where(p => p.RUT_INFR == rut).FirstOrDefault(); infr.PASSWORD_INFR = clave; contex.SaveChanges(); return 1; } } catch (Exception e) { return 0; } }
public int idInfractor(String rut) { INFRACTOR objInfrac = new INFRACTOR(); using (SRI sri = new SRI()) { objInfrac = sri.INFRACTOR.Where(p => p.RUT_INFR == rut).FirstOrDefault(); return (int)objInfrac.ID_INFRACTOR; } }
public int FunConId(INFRACTOR objInf) { objInf.PASSWORD_INFR = GeneraMd5.instancia.md5(objInf.RUT_INFR.ToString().Substring(0, 5)); return DaoInfractor.Instancia.funcionarioId(objInf); }
public int CrearFuncionario(INFRACTOR dto, int tipo) { try { using (SRI sri = new SRI()) { if (!existeRut(dto.RUT_INFR.ToString()) && tipo == 2) { INFRACTOR per = new INFRACTOR(); per = sri.INFRACTOR.Where(a => a.RUT_INFR == dto.RUT_INFR).FirstOrDefault(); per.RUT_INFR = dto.RUT_INFR; per.NOMBRE_INFR = dto.NOMBRE_INFR; per.ACTIVO = dto.ACTIVO; per.APMAT_INFR = dto.APMAT_INFR; per.APPAT_INFR = dto.APPAT_INFR; per.TELEFONO_INFR = dto.TELEFONO_INFR; per.DIRECCION_INFR = dto.DIRECCION_INFR; per.EMAIL_INFR = dto.EMAIL_INFR; sri.SaveChanges(); return 2; } else { if (tipo == 1) { dto.ID_INFRACTOR = RetornarNuevoId(); sri.INFRACTOR.AddObject(dto); sri.SaveChanges(); return 1; } else return 0; } } } catch (Exception e) { return 0; } }