コード例 #1
0
        /**
         Retorna una List con todos los productos existentes en la base de datos**/
        public static List<TipoDocumento> select()
        {
            List<TipoDocumento> lista = new List<TipoDocumento>();

            SqlConnection cn = new SqlConnection();
            try
            {
                cn.ConnectionString = cadenaConex;
                cn.Open();
                string consulta = "SELECT idTipoDocumento, nombre FROM TiposDocumento";
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = consulta;
                cmd.Connection = cn;
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    TipoDocumento tp = new TipoDocumento();
                    tp.IdTipoDoc = (int)dr["idTipoDocumento"];
                    tp.Nombre = dr["nombre"].ToString();
                    lista.Add(tp);
                }
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error SQL al obtener los tipo de documentos.");
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                    cn.Close();
            }
            return lista;
        }
コード例 #2
0
        public static TipoDocumento obtenerTipoDoc(string nom)
        {
            SqlConnection cn = new SqlConnection();

            TipoDocumento tp = new TipoDocumento();

            try
            {
                cn.ConnectionString = cadenaConex;
                cn.Open();
                string consulta = "SELECT idTipoDocumento, nombre FROM TiposDocumento WHERE nombre =";
                consulta += "'" + nom + "'";
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = consulta;
                cmd.Connection = cn;
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    tp.IdTipoDoc = (int)dr["idTipoDocumento"];
                    tp.Nombre = dr["nombre"].ToString();
                }
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error SQL al obtener los tipo de documentos.");
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                    cn.Close();
            }
            return tp;
        }
コード例 #3
0
    private void cargarDatos(Entidades.Expediente expediente)
    {
        try
        {
            this.txtNroExpediente.Text = expediente.idExpediente.ToString();
            this.txtIngreso.Text       = expediente.fechaIngreso.ToShortDateString();

            if (expediente.fechaArchivo != DateTime.MinValue)
            {
                this.txtArchivo.Text = expediente.fechaArchivo.ToShortDateString();
            }

            this.txtApellido.Text  = expediente.denunciante.apellido;
            this.txtNombre.Text    = expediente.denunciante.nombre;
            this.txtDomicilio.Text = expediente.denunciante.domicilio;

            Entidades.Localidad localidad = new Entidades.Localidad();
            localidad = Negocio.NegocioMantenimiento.TraerLocalidadPorId(expediente.denunciante.idLocalidad);

            this.txtLocalidad.Text = localidad.descLocalidad;
            this.txtCP.Text        = localidad.codigoPostal.ToString();
            this.txtNumero.Text    = expediente.denunciante.numero.ToString();

            this.txtNroDocumento.Text = expediente.denunciante.nroDocumento.ToString();

            Entidades.TipoDocumento tipoDocumento = new Entidades.TipoDocumento();
            tipoDocumento = Negocio.NegocioMantenimiento.TraerTipoDocumentoPorId(expediente.denunciante.idTipoDocumento);
            this.txtTipoDocumento.Text = tipoDocumento.descTipoDocumento;

            this.gvwContactos.DataSource = Negocio.NegocioExpedientes.TraerContactosDenunciante(expediente.denunciante.idDenunciante);
            this.gvwContactos.DataBind();

            this.txtEnte.Text = expediente.denunciado.entidad;
            //this.txtTema.Text

            this.txtArea.Text = expediente.area.descArea;
            Entidades.TipoDenuncia tipoDenuncia = new Entidades.TipoDenuncia();
            tipoDenuncia = Negocio.NegocioMantenimiento.TraerTipoDenunciaPorId(expediente.idTipoDenuncia);
            this.txtTipoDenuncia.Text = tipoDenuncia.descTipoDenuncia;

            this.txtDenuncia.Text = expediente.descDenuncia;

            this.txtInformante.Text = expediente.informante.nombrePersona;

            //this.txtInicio.Text = ¿?
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #4
0
        public static List<TipoDocumento> GetAll()
        {
            Acceso ac = new Acceso();

            List<TipoDocumento> tiposDoc = new List<TipoDocumento>();

            string sql = "SELECT idTipo, nombre, descripcion FROM TipoDocumento";
            SqlCommand cmd = new SqlCommand();
            SqlConnection conexion = new SqlConnection(ac.getCadenaConexion());

            try
            {
                conexion.Open();

                cmd.Connection = conexion;
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;

                SqlDataReader dr = cmd.ExecuteReader();

                TipoDocumento td;

                while (dr.Read())
                {
                    td  = new TipoDocumento();
                    td.IDTipoDoc = Convert.ToInt32(dr["idTipo"]);
                    td.Nombre = dr["nombre"].ToString();
                    td.Descripcion = dr["descripcion"].ToString();

                    tiposDoc.Add(td);

                }

            }
            catch (InvalidOperationException ex)
            {
                throw new ApplicationException(ex.Message);
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error en BD:" + ex.Message);
            }
            finally
            {
                conexion.Close();
            }

            return tiposDoc;
        }
コード例 #5
0
 public Deportista(string nombre, string apellido, int nroDoc, string fechaNacimiento, int cuit, string mail,TipoDocumento tipoDoc, Patologia patologia, Gimnasio gim, SexoDeportista sexo, int tieneMail)
 {
     this.nombre = nombre;
     this.apellido = apellido;
     this.nroDoc = nroDoc;
     this.fechaNacimiento = fechaNacimiento;
     this.cuit = cuit;
     this.mail = mail;
     this.edad = (int)calcularEdad(fechaNacimiento);
     this.tipoDoc = tipoDoc;
     this.patologia = patologia;
     this.gim = gim;
     this.sexo = sexo;
     this.tieneMail = tieneMail;
 }
コード例 #6
0
 public Persona(String nom, String ape, DateTime feA, String num, TipoDocumento tiD, DateTime feN,
                List <Telefono> tel, List <Correo> cor, Domicilio dom, Usuario usu, String com, Sexo sex)
 {
     nombre          = nom;
     apellido        = ape;
     fechaAlta       = feA;
     numeroDocumento = num;
     tipoDocumento   = tiD;
     fechaNacimiento = feN;
     telefonos       = tel;
     correos         = cor;
     domicilio       = dom;
     usuario         = usu;
     comentario      = com;
     sexo            = sex;
 }
コード例 #7
0
ファイル: TipoDocumento.cs プロジェクト: ferbenor/moro
 public override int CompareTo(object obj)
 {
     if (obj is TipoDocumento)
     {
         TipoDocumento oVar = obj as TipoDocumento;
         return(String.Compare(this.ToString(), oVar.ToString(), true));
     }
     else if (obj is string)
     {
         return(String.Compare(this.ToString(), obj as string));
     }
     else
     {
         return(-1);
     }
 }
コード例 #8
0
 public static Deportista buscarPorDocumento(int nroDoc, int idTipoDoc)
 {
     Deportista d = new Deportista();
     SqlConnection cn = new SqlConnection();
     try
     {
         cn.ConnectionString = cadenaConex;
         cn.Open();
         string consulta = "SELECT idDeportista, nombre, apellido, cuit, idTipoDocumento, nroDoc FROM Deportistas WHERE idTipoDocumento = @idTipoDocumento AND nroDoc = @nroDoc";
         SqlCommand cmd = new SqlCommand();
         cmd.CommandText = consulta;
         cmd.Connection = cn;
         cmd.Parameters.AddWithValue("@idTipoDocumento", idTipoDoc);
         cmd.Parameters.AddWithValue("@nroDoc", nroDoc);
         SqlDataReader dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             d.Apellido = dr["apellido"].ToString();
             TipoDocumento td = new TipoDocumento();
             td.IdTipoDoc = (int)dr["idTipoDocumento"];
             d.TipoDoc = td;
             d.NroDoc = (int)dr["nroDoc"];
             d.Nombre = dr["nombre"].ToString();
             d.IdDeportista = (int)dr["idDeportista"];
             d.Cuit = (int)dr["cuit"];
         }
     }
     catch (SqlException ex)
     {
         throw new ApplicationException("Error SQL al obtener deportista a facturar");
     }
     finally
     {
         if (cn.State == ConnectionState.Open)
             cn.Close();
     }
     return d;
 }
コード例 #9
0
 public Profesional(String nom, String ape, String nuD, TipoDocumento tiD, Domicilio dom, int id, String mat, int idPer)
     : base(idPer, nom, ape, nuD, tiD, dom)
 {
     idprofesional = id;
     matricula     = mat;
 }
コード例 #10
0
 public Paciente(String nom, String ape, String nuD, TipoDocumento tiD, Domicilio dom, String nuP, int idP, int idPac)
     : base(idP, nom, ape, nuD, tiD, dom)
 {
     numero     = nuP;
     idPaciente = idPac;
 }
コード例 #11
0
 public Profesional(int idProf, String nom, String ape, DateTime feA, String nuD, TipoDocumento tiD, DateTime feN,
                    List <Telefono> tel, List <Correo> cor, Domicilio dom, Usuario usu, String com, Sexo sex, String fo,
                    String mat)
     : base(nom, ape, feA, nuD, tiD, feN, tel, cor, dom, usu, com, sex)
 {
     matricula     = mat;
     foto          = fo;
     idprofesional = idProf;
 }
コード例 #12
0
 public void datosClienteIngresados(string cui, long nro, TipoDocumento tip)
 {
     CUIT = cui;
     tipoDoc = tip;
     nroDoc = nro;
 }
コード例 #13
0
 public Empleado(String nom, String ape, DateTime feA, String nuD, TipoDocumento tiD, DateTime feN,
                 List <Telefono> tel, List <Correo> cor, Domicilio dom, Usuario usu, String com, Sexo sex, string leg)
     : base(nom, ape, feA, nuD, tiD, feN, tel, cor, dom, usu, com, sex)
 {
     legajo = leg;
 }
コード例 #14
0
ファイル: PedidoDAO.cs プロジェクト: haploide/luiggi-dot-net
        public static List<Pedido> GetAll()
        {
            Acceso ac = new Acceso();

            List<Pedido> pedidos = new List<Pedido>();

            string sql = "SELECT * from CONSULTA_PEDIDOS ORDER BY fechaNecesidad DESC";
            SqlCommand cmd = new SqlCommand();
            SqlConnection conexion = new SqlConnection(ac.getCadenaConexion());

            try
            {
                conexion.Open();

                cmd.Connection = conexion;
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;

                SqlDataReader dr = cmd.ExecuteReader();

                Pedido  p;
                Estado  e;
                Persona c;
                TipoDocumento t;

                while (dr.Read())
                {
                    c = new Persona();
                    t = new TipoDocumento();

                    t.IDTipoDoc = Convert.ToInt32(dr["idTipoDoc"]);

                    c.RazonSocial = dr["razonSocial"].ToString();
                    c.Nombre  = dr["nombre"].ToString();
                    c.Apellido  = dr["apellido"].ToString();
                    c.cuil = dr["CUIT"].ToString();
                    c.NroDoc = Convert.ToInt32(dr["nroDocumento"]);
                    c.TipoDoc = t;

                    e  = new Estado ();

                   e.idEstado  = Convert.ToInt32(dr["idEstado"]);
                   e.Nombre  = dr["estado"].ToString();

                    p = new Pedido();

                    p.idPedido  = Convert.ToInt32(dr["idPedido"]);
                    p.fechaNecesidad  = Convert.ToDateTime(dr ["fechaNecesidad"]);
                    p.fechaPedido  = Convert.ToDateTime(dr["fechaPedido"]);
                    p.montoTotal = Convert.ToDouble(dr["total"]);
                    p.nroPedido = Convert.ToInt32(dr["nroPedido"]);
                    p.dirEntraga=dr["direccion"].ToString();
                    p.estado = e;
                    p.cliente = c;

                    pedidos.Add(p);

                }

            }
            catch (InvalidOperationException ex)
            {
                throw new ApplicationException(ex.Message);
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error en BD: " + ex.Message);
            }
            finally
            {
                conexion.Close();
            }

            return pedidos;
        }
コード例 #15
0
 public Empleado(String nom, String ape, String nuD, TipoDocumento tiD, Domicilio dom, String leg, int idP, int idE)
     : base(idP, nom, ape, nuD, tiD, dom)
 {
     legajo     = leg;
     idEmpleado = idE;
 }
コード例 #16
0
ファイル: PedidoDAO.cs プロジェクト: haploide/luiggi-dot-net
        public static List<Pedido> GetByFiltros(int est, int tipDoc, int? nroDoc, double? montoDesde, double? mostoHasta, string nom, string ape, string raSoc, int? cuit, DateTime? fdesde, DateTime? fhasta)
        {
            Acceso ac = new Acceso();

            List<Pedido> pedidos = new List<Pedido>();

            string sql = "SELECT * from CONSULTA_PEDIDOS where 1=1";
            SqlCommand cmd = new SqlCommand();
            SqlConnection conexion = new SqlConnection(ac.getCadenaConexion());

            if (est != -1 && est != 0)
            {
                sql += " and idEstado = @est";
                cmd.Parameters.AddWithValue("@est", est);
            }
            if (tipDoc != -1 && tipDoc != 0)
            {
                sql += " and idTipoDoc = @tipDoc";
                cmd.Parameters.AddWithValue("@tipDoc", tipDoc);
            }
            if (nroDoc.HasValue)
            {
                sql += " and nroDocumento = @nroDoc";
                cmd.Parameters.AddWithValue("@nroDoc", nroDoc);

            }
            if (montoDesde.HasValue)
            {
                sql += " and total >= @montoDesde";
                cmd.Parameters.AddWithValue("@montoDesde", montoDesde);

            }
            if (mostoHasta.HasValue)
            {
                sql += " and total <= @mostoHasta";
                cmd.Parameters.AddWithValue("@mostoHasta", mostoHasta);

            }
            if (!string.IsNullOrEmpty(ape))
            {
                sql += " and apellido = @apellido";
                cmd.Parameters.AddWithValue("@apellido", ape);
            }
            if (!string.IsNullOrEmpty(nom))
            {
                sql += " and nombre = @nombre";
                cmd.Parameters.AddWithValue("@nombre", nom);
            }
            if (!string.IsNullOrEmpty(raSoc))
            {
                sql += " and razonSocial = @raSoc";
                cmd.Parameters.AddWithValue("@raSoc", raSoc);
            }
            if (cuit.HasValue)
            {
                sql += " and CUIT = @cuit";
                cmd.Parameters.AddWithValue("@cuit", cuit);

            }
            if (fdesde.HasValue)
            {
                sql += " and fechaNecesidad >= @fdesde";
                cmd.Parameters.AddWithValue("@fdesde", fdesde.Value);
            }
            if (fhasta.HasValue)
            {
                sql += " and fechaNecesidad <= @fhasta";
                cmd.Parameters.AddWithValue("@fhasta", fhasta.Value);
            }

            try
            {
                conexion.Open();

                cmd.Connection = conexion;
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;

                SqlDataReader dr = cmd.ExecuteReader();

                Pedido p;
                Estado e;
                Persona c;
                TipoDocumento t;

                while (dr.Read())
                {
                    c = new Persona();
                    t = new TipoDocumento();

                    t.IDTipoDoc = Convert.ToInt32(dr["idTipoDoc"]);

                    c.RazonSocial = dr["razonSocial"].ToString();
                    c.Nombre = dr["nombre"].ToString();
                    c.Apellido = dr["apellido"].ToString();
                    c.cuil = dr["CUIT"].ToString();
                    c.NroDoc = Convert.ToInt32(dr["nroDocumento"]);
                    c.TipoDoc = t;

                    e = new Estado();

                    e.idEstado = Convert.ToInt32(dr["idEstado"]);
                    e.Nombre = dr["estado"].ToString();

                    p = new Pedido();

                    p.idPedido = Convert.ToInt32(dr["idPedido"]);
                    p.fechaNecesidad = Convert.ToDateTime(dr["fechaNecesidad"]);
                    p.fechaPedido = Convert.ToDateTime(dr["fechaPedido"]);
                    p.montoTotal = Convert.ToDouble(dr["total"]);
                    p.nroPedido = Convert.ToInt32(dr["nroPedido"]);
                    p.dirEntraga = dr["direccion"].ToString();
                    p.estado = e;
                    p.cliente = c;

                    pedidos.Add(p);

                }

            }
            catch (InvalidOperationException ex)
            {
                throw new ApplicationException(ex.Message);
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error en BD: " + ex.Message);
            }
            finally
            {
                conexion.Close();
            }

            return pedidos;
        }
コード例 #17
0
ファイル: PedidoDAO.cs プロジェクト: haploide/luiggi-dot-net
        public static Pedido GetById(int id)
        {
            Acceso ac = new Acceso();

            Pedido p  = new Pedido();

            SqlCommand cmd = new SqlCommand();
            string sql = "SELECT * from CONSULTA_PEDIDOS where idPedido=@id";
            cmd.Parameters.AddWithValue("@id", id);
            SqlConnection conexion = new SqlConnection(ac.getCadenaConexion());

            try
            {
                conexion.Open();

                cmd.Connection = conexion;
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;

                SqlDataReader dr = cmd.ExecuteReader();

                CondicionIVA ci;
                Persona c;
                TipoDocumento t;

                while (dr.Read())
                {
                    ci = new CondicionIVA();
                    ci.idCondicionIVA = Convert.ToInt32(dr["iva"]);
                    c = new Persona();
                    t = new TipoDocumento();

                    t.IDTipoDoc = Convert.ToInt32(dr["idTipoDoc"]);
                    c.idPersona = Convert.ToInt32(dr["idPersona"]);
                    c.RazonSocial = dr["razonSocial"].ToString();
                    c.Nombre = dr["nombre"].ToString();
                    c.Apellido = dr["apellido"].ToString();
                    c.cuil = dr["CUIT"].ToString();
                    c.NroDoc = Convert.ToInt32(dr["nroDocumento"]);
                    c.tefefonoCelular = dr["telefonoCelular"].ToString();
                    c.condicionIVA = ci ;
                    c.TipoDoc=t;

                    p.idPedido = Convert.ToInt32(dr["idPedido"]);
                    p.fechaNecesidad = Convert.ToDateTime(dr["fechaNecesidad"]);
                    p.fechaPedido = Convert.ToDateTime(dr["fechaPedido"]);
                    p.montoTotal = Convert.ToDouble(dr["total"]);
                    p.nroPedido = Convert.ToInt32(dr["nroPedido"]);
                    p.dirEntraga = dr["direccion"].ToString();
                    p.cliente = c;

                }

            }
            catch (InvalidOperationException ex)
            {
                throw new ApplicationException(ex.Message);
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error en BD: " + ex.Message);
            }
            finally
            {
                conexion.Close();
            }

            return p;
        }
コード例 #18
0
        public static List<Deportista> filtrar(string filtro)
        {
            List<Deportista> lista = new List<Deportista>();

            SqlConnection cn = new SqlConnection();
            try
            {
                cn.ConnectionString = cadenaConex;
                cn.Open();
                string consulta = "SELECT D.idDeportista, D.nombre, D.apellido, D.fechaNacimiento, D.nroDoc, D.cuit, D.fechaNacimiento, D.edad, T.idTipoDocumento, T.nombre as TipoDocum, P.nombre as nombrePatologia, P.idPatologia, P.descripcion as patoDescrip, G.idGimnasio, G.nombre as NomGim, G.cuil, G.direccion as direGim, S.nombre as NomSexo, S.idSexo, D.tieneMail, D.mail FROM Deportistas D JOIN Gimnasios G ON D.idGimnasio= G.idGimnasio INNER JOIN TiposDocumento T ON T.idTipoDocumento= D.idTipoDocumento INNER JOIN Patologias P ON P.idPatologia = D.idPatologia INNER JOIN Sexos S ON S.IdSexo = D.idSexo WHERE D.apellido LIKE '%" + filtro +"%'";
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = consulta;
                cmd.Connection = cn;
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Deportista dep = new Deportista();
                    dep.IdDeportista = (int)dr["idDeportista"];
                    dep.Apellido = dr["apellido"].ToString();
                    dep.Nombre = dr["nombre"].ToString();
                    dep.Mail = dr["mail"].ToString();
                    dep.NroDoc = (int)dr["nroDoc"];
                    dep.FechaNacimiento = dr["fechaNacimiento"].ToString();
                    dep.Edad = (int)dr["edad"];
                    dep.Cuit = (int)dr["cuit"];

                    TipoDocumento td = new TipoDocumento();
                    td.IdTipoDoc = (int)dr["idTipoDocumento"];
                    td.Nombre = dr["TipoDocum"].ToString();

                    SexoDeportista sexo = new SexoDeportista();
                    sexo.Nombre = dr["nomSexo"].ToString();
                    sexo.IdSexo = (int)dr["idSexo"];

                    Patologia patologia = new Patologia();
                    patologia.IdPatologia = (int)dr["idPatologia"];
                    patologia.Nombre = dr["nombrePatologia"].ToString();
                    patologia.Descripcion = dr["patoDescrip"].ToString();

                    Gimnasio g = new Gimnasio();
                    g.Nombre = dr["nomGim"].ToString();
                    g.IdGimnasio = (int)dr["idGimnasio"];
                    g.Cuil = (int)dr["cuil"];
                    g.Direccion = dr["direGim"].ToString();

                    dep.Sexo = sexo;
                    dep.TipoDoc = td;
                    dep.Gim = g;
                    dep.Patologia = patologia;

                    // completar
                    lista.Add(dep);
                }
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error SQL al obtener los sexos de los deportistas.");
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                    cn.Close();
            }
            return lista;
        }
コード例 #19
0
        private void dgv_clientes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Provincia prov = new Provincia()
            {
                idProvincia = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["idprovincia"].Value

            };
            Localidad loc = new Localidad()
            {
                codPostal = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["idlocalidad"].Value,
                Provincia = prov
            };
            TipoDocumento tipo = new TipoDocumento()
            {
                IDTipoDoc = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["idtipo"].Value
            };
            CondicionIVA condicio = new CondicionIVA() { idCondicionIVA = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["idCondicion"].Value };
            TipoConsumidor tipoCons = new TipoConsumidor() { idTipoConsumidor = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["idConsumidor"].Value };
            Persona pers = new Persona()
            {
                Localidad = loc,
                TipoDoc = tipo,
                Apellido = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["apellido"].Value,
                Barrio = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["barrio"].Value,
                calle = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["calle"].Value,
                calle_nro = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["calleNro"].Value,
                cuil = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["cuit"].Value,
                depto = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["depto"].Value,
                mail = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["mail"].Value,
                Nombre = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["Nombre"].Value,
                telefono = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["telefono"].Value,
                RazonSocial = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["raSocial"].Value,
                NroCliente = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["nroCli"].Value,
                NroDoc = (long)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["nroDoc"].Value,
                piso = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["piso"].Value,
                condicionIVA = condicio,
                tipoConsumidor = tipoCons,
                tefefonoCelular = (string)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["celular"].Value,
                Sexo = (Char)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["sexo"].Value,
                fechaNAc = Convert.ToDateTime(dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["fecha"].Value),
                idPersona = (int)dgv_clientes.Rows[dgv_clientes.CurrentRow.Index].Cells["idPersona"].Value

            };

            Vista.iniciador.per = pers;

            Close();
            Dispose();
        }
コード例 #20
0
ファイル: PersonaDAO.cs プロジェクト: haploide/luiggi-dot-net
        public static List<Persona> GetAll()
        {
            Acceso ac = new Acceso();

            List<Persona> personas = new List<Persona>();

            string sql = "SELECT * from CONSULTA_CLIENTES order by apellido asc";
            SqlCommand cmd = new SqlCommand();
            SqlConnection conexion = new SqlConnection(ac.getCadenaConexion());

            try
            {
                conexion.Open();

                cmd.Connection = conexion;
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;

                SqlDataReader dr = cmd.ExecuteReader();
                Provincia pr;
                Persona p;
                TipoDocumento td;
                Localidad l;
                TipoConsumidor tc;
                CondicionIVA iva;

                while (dr.Read())
                {
                    pr = new Provincia();

                    pr.idProvincia = Convert.ToInt32(dr["idProvincia"]);
                    pr.Nombre = dr["provincia"].ToString();

                    l = new Localidad ();

                    l.codPostal  = Convert.ToInt32(dr["codPostal"]);
                    l.Nombre  = dr["localidad"].ToString();
                    l.Provincia  = pr;

                    td  = new TipoDocumento ();

                    td.IDTipoDoc = Convert.ToInt32(dr["idTipo"]);
                    td.Nombre = dr["tipoDocumento"].ToString();
                    td.Descripcion = dr["descripcion"].ToString();

                    tc = new TipoConsumidor();
                    tc.idTipoConsumidor = Convert.ToInt32(dr["idTipoConsumidor"]);

                    iva = new CondicionIVA();
                    iva.idCondicionIVA = Convert.ToInt32(dr["idCondicionIVA"]);

                    p = new Persona ();

                    p.Apellido = dr["apellido"].ToString();
                    p.Barrio = dr["barrio"].ToString();
                    p.calle = dr["calle"].ToString();
                    p.calle_nro = Convert.ToInt32(dr["nro"]);
                    p.cuil =  dr["CUIT"].ToString();
                    p.depto = Convert.ToInt32(dr["depto"]);
                    p.Localidad = l;
                    p.mail = dr["email"].ToString();
                    p.Nombre = dr["nombre"].ToString();
                    p.NroCliente = Convert.ToInt32(dr["nroCliente"]);
                    p.NroDoc = Convert.ToInt64(dr["nroDocumento"]);
                    p.NroProveedor = Convert.ToInt32(dr["nroProveedor"]);
                    p.piso = Convert.ToInt32(dr["piso"]);
                    p.RazonSocial = dr["razonSocial"].ToString();
                    p.telefono = dr["telefonoContacto"].ToString();
                    p.tefefonoCelular = dr["telefonoCelular"].ToString();
                    p.Sexo = Convert.ToChar(dr["sexo"]);
                    p.fechaNAc = Convert.ToDateTime(dr["fechaNac"]);
                    p.idPersona = Convert.ToInt32(dr["idPersona"]);
                    p.TipoDoc = td;
                    p.condicionIVA = iva;
                    p.tipoConsumidor = tc;

                    personas.Add(p);

                }

            }
            catch (InvalidOperationException ex)
            {
                throw new ApplicationException(ex.Message);
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error en BD: " + ex.Message);
            }
            finally
            {
                conexion.Close();
            }

            return personas;
        }
コード例 #21
0
        private void btn_verificar_existencia_persona_Click(object sender, EventArgs e)
        {
            if(!(txt_nro_doc.Text==""))
            {
                TipoDocumento tipo = new TipoDocumento()
                {
                    IDTipoDoc=(int)cmb_tipo_doc.SelectedValue,
                    Nombre=(string)cmb_tipo_doc.SelectedText
                };
                gestor.datosClienteIngresados("", Convert.ToInt64(txt_nro_doc.Text), tipo);
                try
                {
                    if (gestor.verificarExistenciaCliente())
                    {
                        MessageBox.Show(this, "El Cliente ya existe", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        desbloquearCampos();
                        verifico = true;
                        bloquearEmpresa();

                    }
                }
                catch (ApplicationException ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }

            }
            else
            {
                MessageBox.Show("Complete el campo\"Nro Doc\" antes de verificar su existencia", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
コード例 #22
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            if (_estado == estados.nuevo && validarCampos() == true)
                {
                    Provincia pro = new Provincia
                    {
                        idProvincia = (int)cmb_provincia.SelectedValue,
                        Nombre = (string)cmb_provincia.SelectedItem.ToString()
                    };
                    Localidad loc = new Localidad()
                    {
                        codPostal = (int)cmb_localidad.SelectedValue,
                        Nombre = (string)cmb_localidad.SelectedItem.ToString(),
                        Provincia = pro

                    };
                    TipoConsumidor tc=new TipoConsumidor(){ idTipoConsumidor=(int)cmd_tipo_cons.SelectedValue };
                    CondicionIVA iva = new CondicionIVA() { idCondicionIVA = (int)cmb_cond_iva.SelectedValue };

                    string tele = "";
                    string cel = "";
                    int dto = 0;
                    int pis = 0;
                    int call = 0;
                    Char sexo='O';

                    if (!(txt_telefono.Text == "    -"))
                    {
                        tele = txt_telefono.Text;
                    }
                    if (!(txt_celular.Text == "    -"))
                    {
                        cel = txt_celular.Text;
                    }
                    if (!(txt_depto.Text == ""))
                    {
                        dto = Convert.ToInt32(txt_depto.Text);
                    }
                    if (!(txt_piso.Text == ""))
                    {
                        pis = Convert.ToInt32(txt_piso.Text);
                    }
                    if (!(txt_calle_nro.Text == ""))
                    {
                        call = Convert.ToInt32(txt_calle_nro.Text);
                    }
                    if (cmb_sexo.SelectedIndex == 1)
                    {
                        sexo='H';
                    }
                    else if (cmb_sexo.SelectedIndex == 2)
                    {
                        sexo='M';
                    }

                    gestor.datosPersonales(loc, txt_barrio.Text, txt_mail.Text, tele, dto, pis, call, txt_calle.Text, txt_razon_social.Text, txt_apellido.Text, txt_nombre.Text,cel,iva,tc,dtp_fechaNac.Value,sexo);

                    try
                    {
                        gestor.confirmar();
                        MessageBox.Show("Registrado con Exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        limpiarCampos();
                        btn_guardar.Enabled = false;

                    }
                    catch (ApplicationException ex)
                    {
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }

                }
                else
                {
                    if (_estado == estados.modificar && validarCampos() == true)
                    {
                        TipoDocumento tipo = new TipoDocumento()
                        {
                            IDTipoDoc = (int)cmb_tipo_doc.SelectedValue,
                            Nombre = (string)cmb_tipo_doc.SelectedText
                        };
                        Localidad loc=new Localidad()
                        {
                             codPostal=(int)cmb_localidad.SelectedValue
                        };
                        TipoConsumidor tc = new TipoConsumidor() { idTipoConsumidor = (int)cmd_tipo_cons.SelectedValue };
                        CondicionIVA iva = new CondicionIVA() { idCondicionIVA = (int)cmb_cond_iva.SelectedValue };

                        gestor.datosClienteIngresados(txt_cuit.Text, Convert.ToInt32(txt_nro_doc.Text), tipo);
                        gestor.codigoTomado(_persModificar.NroCliente);
                        string tele;
                        string cel;
                        int dto = 0;
                        int pis = 0;
                        int call = 0;
                        char sexo='O';

                        tele = txt_telefono.Text;
                        cel = txt_celular.Text;
                        dto = Convert.ToInt32(txt_depto.Text);
                        pis = Convert.ToInt32(txt_piso.Text);
                        call = Convert.ToInt32(txt_calle_nro.Text);

                        if (cmb_sexo.SelectedIndex == 1)
                        {
                            sexo = 'H';
                        }
                        else if (cmb_sexo.SelectedIndex == 2)
                        {
                            sexo = 'M';
                        }

                        gestor.datosPersonales(loc, txt_barrio.Text, txt_mail.Text, tele, dto, pis, call, txt_calle.Text, txt_razon_social.Text, txt_apellido.Text, txt_nombre.Text,cel,iva,tc,dtp_fechaNac.Value,sexo);

                        try
                        {
                            gestor.modificacionConfirmada();
                            MessageBox.Show("Actualizado con Exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            //limpiarCampos();
                            //btn_guardar.Enabled = false;
                            Close();
                            Dispose();
                        }
                        catch (ApplicationException ex)
                        {
                            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                        }
                    }

                }
        }