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>");
            }
        }
        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));
        }
 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 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 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);
     }
 }
 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 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 actualizaClavePropia(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 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);
     }
 }
 public int CrearInfractor(INFRACTOR dto)
 {
     dto.PASSWORD_INFR = GeneraMd5.instancia.md5(dto.RUT_INFR.ToString().Substring(0, 5));
     return(DaoInfractor.Instancia.CrearInfractor(dto));
 }
Beispiel #12
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);
            }
        }
Beispiel #13
0
        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;
                }
            }
        }
Beispiel #14
0
 public int FunConId(INFRACTOR objInf)
 {
     objInf.PASSWORD_INFR = GeneraMd5.instancia.md5(objInf.RUT_INFR.ToString().Substring(0, 5));
     return(DaoInfractor.Instancia.funcionarioId(objInf));
 }