Example #1
0
 public List <ClientesBO> GetAllFiltro([FromBody] eCliente pCliente)
 {
     try
     {
         if (pCliente.nombre == null && pCliente.nit != "")
         {
             var filtro = " WHERE nit LIKE " + "'" + "%" + pCliente.nit + "%" + "'";
             List <ClientesBO> lCliente = ClientesBO.GetAllFiltro(pConnection, filtro);
             return(lCliente);
         }
         if (pCliente.nit == null && pCliente.nombre != "")
         {
             var filtro = " WHERE nombre LIKE " + "'" + "%" + pCliente.nombre + "%" + "'";
             List <ClientesBO> lCliente = ClientesBO.GetAllFiltro(pConnection, filtro);
             return(lCliente);
         }
         else
         {
             return(null);
         }
     }
     catch
     {
         return(null);
     }
 }
Example #2
0
        private void Login_Contacto()
        {
            eContacto oContacto = lExtranet.Contacto_login(txtEmail.Text);

            if (oContacto != null)
            {
                eCliente    oCliente    = lExtranet.Cliente_item(oContacto.codigoCliente);
                eDisclaimer oDisclaimer = lExtranet.Disclaimer_item(oContacto.codigoCliente, oContacto.codigoContacto);
                oContacto.aceptoTerminos = (oDisclaimer != null && oDisclaimer.confirmado);
                RegistrarLog.Login(oContacto);

                Session["oCliente"]  = oCliente;
                Session["oContacto"] = oContacto;

                //Validar Disclaimer
                if (!oContacto.aceptoTerminos)
                {
                    Response.Redirect("Disclaimer.aspx");
                }
                else
                {
                    Response.Redirect("~/Index.aspx");
                }
            }
        }
Example #3
0
 private void button4_Click(object sender, EventArgs e)
 {
     Form1.clienteSesion = null;
     textBox1.Clear();
     textBox2.Clear();
     textBox1.Focus();
 }
Example #4
0
 public eCliente BuscarporId(string id)
 {
     try
     {
         eCliente      cli      = null;
         SqlConnection conexion = db.ConectarDB();
         string        select   = string.Format("select DNI,usuario,clave from cliente where DNI='{0}'", id);
         SqlCommand    cmd      = new SqlCommand(select, conexion);
         SqlDataReader reader   = cmd.ExecuteReader();
         if (reader.Read())
         {
             cli        = new eCliente();
             cli.DNI    = (string)reader["DNI"];
             cli.nombre = (string)reader["usuario"];
             cli.clave  = (string)reader["clave"];
         }
         reader.Close();
         return(cli);
     }
     catch (Exception ex)
     {
         return(null);
     }
     finally
     {
         db.DesconectarDB();
     }
 }
Example #5
0
        protected void repParametro_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem)
            {
                TextBox       txtValor = (TextBox)e.Item.FindControl("txtValor");
                HtmlTableCell tdValor  = (HtmlTableCell)e.Item.FindControl("tdValor");

                if (tdValor != null && txtValor != null)
                {
                    eListItem oParametro = (eListItem)e.Item.DataItem;

                    if (oParametro.Nombre == "Cliente")
                    {
                        eCliente oSelector = new eCliente();
                        oSelector.codigoCliente = "";
                        oSelector.razonSocial   = "--seleccionar--";
                        List <eCliente> lClientes = lExtranet.Cliente_listar("");
                        lClientes.Insert(0, oSelector);

                        DropDownList drpValor = new DropDownList();
                        drpValor.DataTextField  = "razonSocial";
                        drpValor.DataValueField = "codigoCliente";
                        drpValor.DataSource     = lClientes;
                        drpValor.DataBind();

                        drpValor.Attributes.Add("onchange", "drpValor_Change(this, '" + txtValor.ClientID + "')");
                        drpValor.ID = "drpValor";
                        tdValor.Controls.Add(drpValor);
                        txtValor.Style.Add("display", "none");
                    }
                }
            }
        }
Example #6
0
        public void creaCliente(eCliente cl)
        {
            OracleConnection cnn = D_Conexion.conectar();

            try
            {
                OracleCommand command = new OracleCommand("SP_INSERTACLIENTE", cnn);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.Add("nom", OracleDbType.Varchar2).Value          = cl.nombre;
                command.Parameters.Add("paterno", OracleDbType.Varchar2).Value      = cl.apPaterno;
                command.Parameters.Add("materno", OracleDbType.Varchar2).Value      = cl.apMaterno;
                command.Parameters.Add("rut", OracleDbType.Int32).Value             = cl.rut;
                command.Parameters.Add("dverificador", OracleDbType.Varchar2).Value = cl.dvVerificador;
                command.Parameters.Add("idrubro", OracleDbType.Int32).Value         = cl.idRubro;
                command.Parameters.Add("direccion", OracleDbType.Varchar2).Value    = cl.direccion;
                command.Parameters.Add("codcomuna", OracleDbType.Int32).Value       = cl.codComuna;
                command.Parameters.Add("codciudad", OracleDbType.Int32).Value       = cl.codCiudad;
                command.Parameters.Add("codregion", OracleDbType.Int32).Value       = cl.codRegion;
                command.Parameters.Add("telefono", OracleDbType.Int32).Value        = cl.telefono;
                command.Parameters.Add("mail", OracleDbType.Varchar2).Value         = cl.email;
                command.ExecuteNonQuery();
                command.Dispose();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                cnn.Close();
                cnn.Dispose();
            }
        }
        public List <eCliente> listarClientes()
        {
            List <eCliente> listaCliente = new List <eCliente>();
            eCliente        aux          = null;

            try {
                SqlCommand    cmd    = new SqlCommand("SELECT dni, nombre, telefono, direccion, contraseña, tipo FROM tabla_Clientes ", db.conectaDB());
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    aux                    = new eCliente();
                    aux.dniCliente         = (string)reader["dni"];
                    aux.nombreCliente      = (string)reader["nombre"];
                    aux.telefonoCliente    = (string)reader["telefono"];
                    aux.direccionCliente   = (string)reader["direccion"];
                    aux.constraseñaCliente = (string)reader["contraseña"];
                    aux.tipoCliente        = (string)reader["tipo"];

                    listaCliente.Add(aux);
                }
                reader.Close();
            } catch (SqlException ex) {
                return(null);
            } finally {
                db.desconectaDB();
            }
            return(listaCliente);
        }
        public eCliente buscarCliente(string dni)
        {
            eCliente aux = null;

            try {
                SqlCommand    cmd    = new SqlCommand(string.Format("SELECT dni, nombre, telefono, direccion, contraseña, tipo FROM tabla_Clientes WHERE dni='{0}'", dni), db.conectaDB());
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    aux                    = new eCliente();
                    aux.dniCliente         = (string)reader["dni"];
                    aux.nombreCliente      = (string)reader["nombre"];
                    aux.telefonoCliente    = (string)reader["telefono"];
                    aux.direccionCliente   = (string)reader["direccion"];
                    aux.constraseñaCliente = (string)reader["contraseña"];
                    aux.tipoCliente        = (string)reader["tipo"];
                }
                reader.Close();
                return(aux);
            } catch (SqlException ex) {
                return(null);
            } finally {
                db.desconectaDB();
            }
        }
Example #9
0
 public List <eCliente> lisarTodo()
 {
     try
     {
         List <eCliente> lisCli   = new List <eCliente>();
         eCliente        cli      = null;
         SqlConnection   conexion = db.ConectarDB();
         SqlCommand      cmd      = new SqlCommand("select DNI,usuario,clave from cliente", conexion);
         SqlDataReader   reader   = cmd.ExecuteReader();
         while (reader.Read())
         {
             cli        = new eCliente();
             cli.DNI    = (string)reader["DNI"];
             cli.nombre = (string)reader["usuario"];
             cli.clave  = (string)reader["clave"];
             lisCli.Add(cli);
         }
         reader.Close();
         return(lisCli);
     }
     catch (Exception ex)
     {
         return(null);
     }
     finally
     {
         db.DesconectarDB();
     }
 }
Example #10
0
        public List <eCliente> getListaClientePorRutorName(int rut, string nombre)
        {
            OracleConnection conn         = D_Conexion.conectar();
            List <eCliente>  listaCliente = new List <eCliente>();

            try
            {
                OracleCommand command = conn.CreateCommand();

                //StringBuilder queryCliente = new StringBuilder();

                //queryCliente.Append("select idcliente,nombre,appaterno,apmaterno,rut,dverificador,idrubro,direccion,codcomuna,codciudad,codregion,telefono,email  from cliente cl inner join comuna cm on cm.idcomuna = cl.codcomuna inner join ciudad cd on cd.idciudad = cm.idciudad inner join region rg on rg.idregion = cd.idregion where (cl.rut = :rut  or UPPER(cl.nombre|| ' '|| cl.appaterno ||' ' ||cl.apmaterno) like ");
                //queryCliente.Append(nombre);
                //queryCliente.Append(" )");
                command.CommandText = "select idcliente,nombre,appaterno,apmaterno,rut,dverificador,idrubro,direccion,codcomuna,codciudad,codregion,telefono,email  from cliente cl inner join comuna cm on cm.idcomuna = cl.codcomuna inner join ciudad cd on cd.idciudad = cm.idciudad inner join region rg on rg.idregion = cd.idregion where (cl.rut = :rut  or UPPER(cl.nombre|| ' '|| cl.appaterno ||' ' ||cl.apmaterno) = :nombre )  ";
                //command.CommandText = queryCliente.ToString();


                command.Parameters.Add(":rut", OracleDbType.Int32).Value       = rut;
                command.Parameters.Add(":nombre", OracleDbType.Varchar2).Value = nombre.ToUpper();

                OracleDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    eCliente clienteGrid = new eCliente();
                    clienteGrid.idcliente = int.Parse(reader["IDCLIENTE"].ToString());
                    clienteGrid.nombre    = reader["NOMBRE"].ToString();
                    //usuarioGrid.estado = short.Parse(reader["ISACTIVO"].ToString()) == 1 ? "Activo" : "Inactivo";
                    clienteGrid.apPaterno     = reader["APPATERNO"].ToString().ToUpper();
                    clienteGrid.apMaterno     = reader["APMATERNO"].ToString().ToUpper();
                    clienteGrid.rut           = int.Parse(reader["RUT"].ToString());
                    clienteGrid.dvVerificador = reader["dverificador"].ToString();
                    clienteGrid.idRubro       = int.Parse(reader["IDRUBRO"].ToString());
                    clienteGrid.direccion     = reader["DIRECCION"].ToString().ToUpper();
                    clienteGrid.codComuna     = int.Parse(reader["CODCOMUNA"].ToString());
                    clienteGrid.codCiudad     = int.Parse(reader["CODCIUDAD"].ToString());
                    clienteGrid.codRegion     = int.Parse(reader["CODREGION"].ToString());
                    clienteGrid.telefono      = int.Parse(reader["TELEFONO"].ToString());
                    clienteGrid.email         = reader["EMAIL"].ToString();

                    listaCliente.Add(clienteGrid);
                }

                command.Dispose();
                reader.Close();
                reader.Dispose();

                return(listaCliente);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Example #11
0
        private void btnActualiza_Click(object sender, EventArgs e)
        {
            if (tbListaCliente.Parent == null)
            {
                // 3 es el index por la cuarta pestana
                tbControlMantenedor.TabPages.Insert(0, tbListaCliente);
            }
            tbControlMantenedor.Visible = true;
            tbActualizaCliente.Parent   = null;
            tbIngresaCliente.Parent     = null;
            tbEliminaCliente.Parent     = null;
            tbInfomeCliente.Parent      = null;
            tbIngresaProfesional.Parent = null;
            tbBuscar.Parent             = null;


            if (this.dgvListaCliente.SelectedRows.Count == 0)
            {
                MessageBox.Show("Error: Debe seleccionar un usuario para Editar.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //eCliente e_cliente = new eCliente();
                //e_cliente.nombre = txtNombreClienteListar.Text.Trim();
                //e_cliente.apPaterno = txtPaternoClienteListar.Text.Trim();
                //e_cliente.apMaterno = txtMaternoClienteListar.Text.Trim();
                //e_cliente.rut = int.Parse(txtRutListar.Text.Trim());


                /*CREAR CLIENTE*/
                eCliente  cl       = new eCliente();
                dClientes dcliente = new dClientes();


                cl.idcliente     = int.Parse(txtIdCliente.Text.Trim());
                cl.nombre        = txtNombreClienteListar.Text.Trim();
                cl.apPaterno     = txtPaternoClienteListar.Text.Trim();
                cl.apMaterno     = txtMaternoClienteListar.Text.Trim();
                cl.rut           = int.Parse(txtRutListar.Text.Trim());
                cl.dvVerificador = txtDvListar.Text.Trim();
                cl.idRubro       = int.Parse(cbRubroListaCliente.SelectedValue.ToString());
                cl.direccion     = txtDireccionClienteListar.Text.Trim();
                cl.codComuna     = int.Parse(cbComunaListaCliente.SelectedValue.ToString());
                cl.codCiudad     = int.Parse(cbCiudadListaCliente.SelectedValue.ToString());
                cl.codRegion     = int.Parse(cbRegionListaCliente.SelectedValue.ToString());
                cl.telefono      = int.Parse(txtTelefonoClienteListar.Text.Trim());
                cl.email         = txtEmailClienteListar.Text.Trim();


                dcliente.editaCliente(cl);

                listaCliente(cl.rut, cl.nombre + " " + cl.apPaterno + " " + cl.apMaterno);

                MessageBox.Show("Cliente editado exitosamente.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #12
0
        public string ActuzalizarCliente(string contraseña, string nombre, string DNIaModificar)
        {
            eCliente cliente = new eCliente()
            {
                nombre = nombre,
                clave  = contraseña
            };

            return(datos.Modificar(cliente, DNIaModificar));
        }
        public static int UpdateDrive(eCliente oCliente)
        {
            SqlCommand cmd = new SqlCommand("pEXT_ClienteDrive_update");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@codigoCliente", SqlDbType.Char, 10).Value      = oCliente.codigoCliente;
            cmd.Parameters.Add("@driveFerreyros", SqlDbType.VarChar, 255).Value = oCliente.driveFerreyros;
            cmd.Parameters.Add("@driveCliente", SqlDbType.VarChar, 255).Value   = oCliente.driveCliente;
            return(UpdateCommand(cmd));
        }
        protected void grvListado_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            eCliente oCliente = (eCliente)e.Row.DataItem;

            if (oCliente != null)
            {
                ImageButton ibtContactos = (ImageButton)e.Row.FindControl("ibtContactos");
                ibtContactos.CommandArgument = oCliente.codigoCliente;
            }
        }
 private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     cliente = dataGrid.SelectedItem as eCliente;
     if (cliente != null)
     {
         //idcliente = cliente.DNI;
         textBox.Text  = cliente.nombre;
         textBox1.Text = cliente.clave;
         textBox2.Text = cliente.DNI;
     }
 }
Example #16
0
        public string RegistrarCliente(string DNI, string nombre, string clave)
        {
            eCliente cliente = new eCliente()
            {
                DNI    = DNI,
                clave  = clave,
                nombre = nombre
            };

            return(datos.Insertar(cliente));
        }
 public string modificarCliente(eCliente cliente, string dnicliente)
 {
     try {
         SqlCommand cmd = new SqlCommand(string.Format("UPDATE tabla_Clientes SET dni ='{0}', nombre = '{1}', contraseña = '{2}', direccion = '{3}', telefono ='{4}' WHERE dni = '{5}' ", cliente.dniCliente, cliente.nombreCliente, cliente.constraseñaCliente, cliente.direccionCliente, cliente.telefonoCliente, dnicliente), db.conectaDB());
         cmd.ExecuteNonQuery();
         return("Cliente Modificado");
     } catch (SqlException ex) {
         return(ex.Message);
     } finally {
         db.desconectaDB();
     }
 }
        public string modificarCliente(string _nombreCliente, string _dniCliente, string _contraseñaCliente, string _direccionCliente, string _telefonoCliente, string dni, string tipoCliente)
        {
            eCliente cliente = new eCliente(_nombreCliente, _dniCliente, _contraseñaCliente, _direccionCliente, _telefonoCliente, tipoCliente);

            if (dCliente.buscarCliente(dni) != null)
            {
                return(dCliente.modificarCliente(cliente, dni));
            }
            else
            {
                return("El cliente no existe");
            }
        }
 public string insertarCliente(eCliente cliente)
 {
     try {
         string     insert = string.Format("INSERT INTO tabla_Clientes (dni,nombre,contraseña,direccion,telefono,tipo) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}')", cliente.dniCliente, cliente.nombreCliente, cliente.constraseñaCliente, cliente.direccionCliente, cliente.telefonoCliente, cliente.tipoCliente);
         SqlCommand cmd    = new SqlCommand(insert, db.conectaDB());
         cmd.ExecuteNonQuery();
         return("Cliente Registrado");
     } catch (SqlException ex) {
         return(ex.Message);
     } finally {
         db.desconectaDB();
     }
 }
Example #20
0
        public ActionResult getClientes()
        {
            List <eCliente> listClientes = new List <eCliente>();
            dCliente        obj          = new dCliente();
            DataTable       dtClientes   = obj.getClientes();

            foreach (DataRow row in dtClientes.Rows)
            {
                eCliente Cliente = new eCliente();
                Cliente.codigo = Convert.ToInt32(row["codigo"].ToString());
                Cliente.nombre = row["nombre"].ToString();
                listClientes.Add(Cliente);
            }
            return(Json(listClientes, JsonRequestBehavior.AllowGet));
        }
Example #21
0
        public List <eCliente> getListaCliente()
        {
            OracleConnection conn         = D_Conexion.conectar();
            List <eCliente>  listaCliente = new List <eCliente>();

            try
            {
                OracleCommand command = conn.CreateCommand();
                command.CommandText = "select idcliente,nombre,appaterno,apmaterno,rut,dverificador,idrubro,direccion,codcomuna,codciudad,codregion,telefono,email  from cliente cl inner join comuna cm on cm.idcomuna = cl.codcomuna inner join ciudad cd on cd.idciudad = cm.idciudad inner join region rg on rg.idregion = cd.idregion";
                OracleDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    eCliente clienteGrid = new eCliente();
                    clienteGrid.idcliente = int.Parse(reader["IDCLIENTE"].ToString());
                    clienteGrid.nombre    = reader["NOMBRE"].ToString();
                    //usuarioGrid.estado = short.Parse(reader["ISACTIVO"].ToString()) == 1 ? "Activo" : "Inactivo";
                    clienteGrid.apPaterno     = reader["APPATERNO"].ToString().ToUpper();
                    clienteGrid.apMaterno     = reader["APMATERNO"].ToString().ToUpper();
                    clienteGrid.rut           = int.Parse(reader["RUT"].ToString());
                    clienteGrid.dvVerificador = reader["dverificador"].ToString();
                    clienteGrid.idRubro       = int.Parse(reader["IDRUBRO"].ToString());
                    clienteGrid.direccion     = reader["DIRECCION"].ToString().ToUpper();
                    clienteGrid.codComuna     = int.Parse(reader["CODCOMUNA"].ToString());
                    clienteGrid.codCiudad     = int.Parse(reader["CODCIUDAD"].ToString());
                    clienteGrid.codRegion     = int.Parse(reader["CODREGION"].ToString());
                    clienteGrid.telefono      = int.Parse(reader["TELEFONO"].ToString());
                    clienteGrid.email         = reader["EMAIL"].ToString();

                    listaCliente.Add(clienteGrid);
                }

                command.Dispose();
                reader.Close();
                reader.Dispose();

                return(listaCliente);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Example #22
0
 public IHttpActionResult AddCliente([FromBody] eCliente pCliente)
 {
     try
     {
         ClientesBO lClientes = new ClientesBO();
         lClientes.apellido = pCliente.apellido;
         lClientes.nombre   = pCliente.nombre;
         lClientes.nit      = pCliente.nit;
         lClientes.Save(pConnection);
         return(Ok());
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
        public static List <eCliente> GetList_Search(string codigoVendedor, string filtro, string criterio)
        {
            SqlCommand cmd = new SqlCommand("pEXT_ClienteVendedor_search");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@codigoVendedor", SqlDbType.Char, 10).Value = codigoVendedor;
            cmd.Parameters.Add("@filtro", SqlDbType.Char, 10).Value         = filtro;
            cmd.Parameters.Add("@criterio", SqlDbType.VarChar, 250).Value   = criterio;

            SqlDataReader   reader = ExecuteReader(cmd);
            List <eCliente> lista  = new List <eCliente>();

            while (reader.Read())
            {
                eCliente oCliente = new eCliente();
                oCliente.codigoCliente      = reader.GetString(0);
                oCliente.codigoDBS          = !reader[1].Equals(DBNull.Value) ? reader.GetString(1) : string.Empty;
                oCliente.tipoPersona        = !reader[2].Equals(DBNull.Value) ? reader.GetString(2) : string.Empty;
                oCliente.descripcionPersona = !reader[3].Equals(DBNull.Value) ? reader.GetString(3) : string.Empty;
                oCliente.ruc                     = !reader[4].Equals(DBNull.Value) ? reader.GetString(4) : "";
                oCliente.razonSocial             = !reader[5].Equals(DBNull.Value) ? reader.GetString(5) : string.Empty;
                oCliente.nombreComercial         = !reader[6].Equals(DBNull.Value) ? reader.GetString(6) : string.Empty;
                oCliente.segmento                = !reader[7].Equals(DBNull.Value) ? reader.GetString(7) : string.Empty;
                oCliente.descripcionSegmento     = !reader[8].Equals(DBNull.Value) ? reader.GetString(8) : string.Empty;
                oCliente.codigoMercado           = !reader[9].Equals(DBNull.Value) ? reader.GetString(9) : string.Empty;
                oCliente.descripcionMercado      = !reader[10].Equals(DBNull.Value) ? reader.GetString(10) : string.Empty;
                oCliente.direccion               = !reader[11].Equals(DBNull.Value) ? reader.GetString(11) : string.Empty;
                oCliente.codigoDistrito          = !reader[12].Equals(DBNull.Value) ? reader.GetString(12) : string.Empty;
                oCliente.descripcionDistrito     = !reader[13].Equals(DBNull.Value) ? reader.GetString(13) : string.Empty;
                oCliente.codigoProvincia         = !reader[14].Equals(DBNull.Value) ? reader.GetString(14) : string.Empty;
                oCliente.descripcionProvincia    = !reader[15].Equals(DBNull.Value) ? reader.GetString(15) : string.Empty;
                oCliente.codigoDepartamento      = !reader[16].Equals(DBNull.Value) ? reader.GetString(16) : string.Empty;
                oCliente.descripcionDepartamento = !reader[17].Equals(DBNull.Value) ? reader.GetString(17) : string.Empty;
                oCliente.codigoPais              = !reader[18].Equals(DBNull.Value) ? reader.GetString(18) : string.Empty;
                oCliente.descripcionPais         = !reader[19].Equals(DBNull.Value) ? reader.GetString(19) : string.Empty;
                oCliente.fechaAniversario        = !reader[20].Equals(DBNull.Value) ? reader.GetString(20) : string.Empty;
                oCliente.telefonoPrincipal       = !reader[21].Equals(DBNull.Value) ? reader.GetString(21) : string.Empty;
                oCliente.flagExtranet            = !reader[22].Equals(DBNull.Value) ? reader.GetString(22) : string.Empty;
                oCliente.flagPrincipal           = !reader[23].Equals(DBNull.Value) ? reader.GetString(23) : string.Empty;

                lista.Add(oCliente);
            }
            reader.Close();

            return(lista);
        }
Example #24
0
        protected void repResultados_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Literal   litCodigoCliente   = (Literal)e.Item.FindControl("litCodigoCliente");
            Literal   litRUC             = (Literal)e.Item.FindControl("litRUC");
            HyperLink lnkRazonSocial     = (HyperLink)e.Item.FindControl("lnkRazonSocial");
            Literal   litNombreComercial = (Literal)e.Item.FindControl("litNombreComercial");

            if (litCodigoCliente != null)
            {
                eCliente oItem = (eCliente)e.Item.DataItem;

                litCodigoCliente.Text      = oItem.codigoCliente;
                litRUC.Text                = oItem.ruc;
                litNombreComercial.Text    = oItem.nombreComercial;
                lnkRazonSocial.Text        = oItem.razonSocial;
                lnkRazonSocial.NavigateUrl = "~/ClienteSel.aspx?csel=" + oItem.codigoCliente.Trim();
            }
        }
        protected void grvListado_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Contactos")
            {
                if (!validateUserAction(ModuloID, CMD_Administrar))
                {
                    return;
                }

                string   clienteID = e.CommandArgument.ToString();
                eCliente oCliente  = lExtranet.Cliente_item(clienteID);
                lblSubtitulo2.Text     = oCliente.razonSocial + ": Contactos";
                hdnCodigoCliente.Value = clienteID;

                BindContactos(clienteID);
                mvwClientes.ActiveViewIndex = 2;
            }
        }
        public static eCliente GetItem(string codigoCliente)
        {
            SqlCommand cmd = new SqlCommand("pEXT_Cliente_select");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@codigoCliente", SqlDbType.Char, 10).Value = codigoCliente;

            SqlDataReader reader   = ExecuteReader(cmd);
            eCliente      oCliente = null;

            if (reader.Read())
            {
                oCliente = new eCliente();
                oCliente.codigoCliente      = reader.GetString(0);
                oCliente.codigoDBS          = !reader[1].Equals(DBNull.Value) ? reader.GetString(1) : string.Empty;
                oCliente.tipoPersona        = !reader[2].Equals(DBNull.Value) ? reader.GetString(2) : string.Empty;
                oCliente.descripcionPersona = !reader[3].Equals(DBNull.Value) ? reader.GetString(3) : string.Empty;
                oCliente.ruc                     = !reader[4].Equals(DBNull.Value) ? reader.GetString(4) : "";
                oCliente.razonSocial             = !reader[5].Equals(DBNull.Value) ? reader.GetString(5) : string.Empty;
                oCliente.nombreComercial         = !reader[6].Equals(DBNull.Value) ? reader.GetString(6) : string.Empty;
                oCliente.segmento                = !reader[7].Equals(DBNull.Value) ? reader.GetString(7) : string.Empty;
                oCliente.descripcionSegmento     = !reader[8].Equals(DBNull.Value) ? reader.GetString(8) : string.Empty;
                oCliente.codigoMercado           = !reader[9].Equals(DBNull.Value) ? reader.GetString(9) : string.Empty;
                oCliente.descripcionMercado      = !reader[10].Equals(DBNull.Value) ? reader.GetString(10) : string.Empty;
                oCliente.direccion               = !reader[11].Equals(DBNull.Value) ? reader.GetString(11) : string.Empty;
                oCliente.codigoDistrito          = !reader[12].Equals(DBNull.Value) ? reader.GetString(12) : string.Empty;
                oCliente.descripcionDistrito     = !reader[13].Equals(DBNull.Value) ? reader.GetString(13) : string.Empty;
                oCliente.codigoProvincia         = !reader[14].Equals(DBNull.Value) ? reader.GetString(14) : string.Empty;
                oCliente.descripcionProvincia    = !reader[15].Equals(DBNull.Value) ? reader.GetString(15) : string.Empty;
                oCliente.codigoDepartamento      = !reader[16].Equals(DBNull.Value) ? reader.GetString(16) : string.Empty;
                oCliente.descripcionDepartamento = !reader[17].Equals(DBNull.Value) ? reader.GetString(17) : string.Empty;
                oCliente.codigoPais              = !reader[18].Equals(DBNull.Value) ? reader.GetString(18) : string.Empty;
                oCliente.descripcionPais         = !reader[19].Equals(DBNull.Value) ? reader.GetString(19) : string.Empty;
                oCliente.fechaAniversario        = !reader[20].Equals(DBNull.Value) ? reader.GetString(20) : string.Empty;
                oCliente.telefonoPrincipal       = !reader[21].Equals(DBNull.Value) ? reader.GetString(21) : string.Empty;
                oCliente.flagExtranet            = !reader[22].Equals(DBNull.Value) ? reader.GetString(22) : string.Empty;
                oCliente.flagPrincipal           = !reader[23].Equals(DBNull.Value) ? reader.GetString(23) : string.Empty;
                oCliente.driveFerreyros          = !reader[24].Equals(DBNull.Value) ? reader.GetString(24) : string.Empty;
                oCliente.driveCliente            = !reader[25].Equals(DBNull.Value) ? reader.GetString(25) : string.Empty;
            }
            reader.Close();

            return(oCliente);
        }
Example #27
0
 public string Insertar(eCliente cli)
 {
     try
     {
         SqlConnection conexion = db.ConectarDB();
         string        insertar = string.Format("insert into cliente (DNI,usuario,clave) VALUES ('{0}','{1}','{2}')", cli.DNI, cli.nombre, cli.clave);
         SqlCommand    cmd      = new SqlCommand(insertar, conexion);
         cmd.ExecuteNonQuery();
         return("REGISTRO USUARIO");
     }
     catch (Exception e)
     {
         return(e.Message);
     }
     finally
     {
         db.DesconectarDB();
     }
 }
Example #28
0
 public string Modificar(eCliente cli, string dni)
 {
     try
     {
         SqlConnection conexion = db.ConectarDB();
         string        update   = string.Format("UPDATE cliente SET usuario='{0}', clave='{1}'  Where DNI={2}", cli.nombre, cli.clave, dni);
         SqlCommand    cmd      = new SqlCommand(update, conexion);
         cmd.ExecuteNonQuery();
         return("MODIFICO USUARIO");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
     finally
     {
         db.DesconectarDB();
     }
 }
        private void FillDetalle(string clienteID)
        {
            eCliente oCliente = lExtranet.Cliente_item(clienteID);

            if (oCliente != null)
            {
                lblCodigoCliente.Text      = oCliente.codigoCliente;
                lblCodigoDBS.Text          = oCliente.codigoDBS;
                lblDescripcionPersona.Text = oCliente.descripcionPersona;
                lblRUC.Text                     = oCliente.ruc.ToString();
                lblRazonSocial.Text             = oCliente.razonSocial;
                lblNombreComercial.Text         = oCliente.nombreComercial;
                lblDescripcionSegmento.Text     = oCliente.descripcionSegmento;
                lblDescripcionMercado.Text      = oCliente.descripcionMercado;
                lblDireccion.Text               = oCliente.direccion;
                lblDescripcionDistrito.Text     = oCliente.descripcionDistrito;
                lblDescripcionProvincia.Text    = oCliente.descripcionProvincia;
                lblDescripcionDepartamento.Text = oCliente.descripcionDepartamento;
                lblDescripcionPais.Text         = oCliente.descripcionPais;
            }
        }
        public string registrarCliente(string nombreCliente, string dniCliente, string contraseñaCliente, string direccionCliente, string telefonoCliente)
        {
            eCliente cliente = null;

            if (dCliente.buscarCliente(dniCliente) == null)
            {
                if (nombreCliente[0] == 'x' || nombreCliente[0] == 'X')
                {
                    cliente = new eCliente(nombreCliente, dniCliente, contraseñaCliente, direccionCliente, telefonoCliente, "Administrador");
                    dCliente.insertarCliente(cliente);
                    return("Administrador Registrado");
                }
                else
                {
                    cliente = new eCliente(nombreCliente, dniCliente, contraseñaCliente, direccionCliente, telefonoCliente, "No Premium");
                    return(dCliente.insertarCliente(cliente));
                }
            }
            else
            {
                return("El cliente ya existe");
            }
        }