Пример #1
0
        }// del InsertCliente

        public static string UpdCliente(int idCliente, string Nombre, string ApPaterno, string ApMaterno, string Telefono, string Correo, string UrlFoto, bool Disponibilidad)
        {
            try
            {
                List <ClientesVO> LstClientes = DALClientes.GetListClientes(null);//Se llena lista
                bool Existe = false;

                foreach (ClientesVO item in LstClientes)//Recorre lista
                {
                    if ((item.IdCliente != idCliente) && (item.Nombre == Nombre) && (item.ApPaterno == ApPaterno) && (item.ApMaterno == ApMaterno))
                    {
                        Existe = true;
                    }
                }

                if (Existe)
                {
                    return("El nombre del cliente ya fue utilizado con anterioridad");
                }
                else
                {
                    DALClientes.UpdCliente(idCliente, Nombre, ApPaterno, ApMaterno, Telefono, Correo, UrlFoto, Disponibilidad);
                    return("Cliente actualizado correctamente");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }// del UpdCliente
Пример #2
0
        public static string InsCliente(string Nombre, string ApPaterno, string ApMaterno, string Telefono, string Correo, string UrlFoto)
        {
            try
            {
                List <ClientesVO> LstClientes = DALClientes.GetListClientes(null);//Se llena lista
                bool Existe = false;

                foreach (ClientesVO item in LstClientes)//Recorre lista
                {
                    if (item.Nombre == Nombre & item.ApPaterno == ApPaterno && item.ApMaterno == ApMaterno)
                    {
                        Existe = true;
                    }
                }

                if (Existe)
                {
                    return("El nombre de cliente ya fue utilizado con anterioridad");
                }
                else
                {
                    DALClientes.InsCliente(Nombre, ApPaterno, ApMaterno, Telefono, Correo, UrlFoto);
                    return("Cliente agregado");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }// del InsertCliente
Пример #3
0
 //GUARDAR CLIENTE
 private void btnGuardar_Click_1(object sender, EventArgs e)
 {
     if (ValidarPersonas())
     {
         ModelClientes agregar = new ModelClientes();
         agregar.Nombre          = txtNombre.Text;
         agregar.Apellidos       = txtApellido.Text;
         agregar.Documento       = txtDocumento.Text;
         agregar.Telefono        = mtbTelefono.Text;
         agregar.IdGenero        = Convert.ToInt32(cmbGenero.SelectedIndex.ToString());
         agregar.IdUsuario       = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
         agregar.IdTipoDocumento = Convert.ToInt32(cmbUsuario.SelectedValue.ToString());
         int datos = DALClientes.agregar(agregar);
         if (datos > 0)
         {
             MessageBox.Show("Registro ingresado correctamente", "Operacón exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtIdClientes.Clear();
             txtNombre.Clear();
             txtApellido.Clear();
             txtDocumento.Clear();
             cmbTipoDoc.SelectedIndex = 0;
             txtDocumento.Clear();
             mtbTelefono.Clear();
             cmbGenero.SelectedIndex  = 0;
             cmbUsuario.SelectedIndex = 0;
         }
         else
         {
             MessageBox.Show("Registro no ingresado", "Operacón fallida", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
     }
 }
        public ActionResult listado()
        {
            DALClientes oClientes = new DALClientes();

            //Limpiar el modelo
            ModelState.Clear();
            return(View(oClientes.ListarClientes()));
        }
Пример #5
0
 private void Form1_Load(object sender, EventArgs e)
 {
     dgvPersonas.DataSource = DALClientes.mostrartabla();
     Conexion.obtenerconexion();
     cmbTipoDoc.SelectedIndex   = 0;
     cmbGenero.SelectedIndex    = 0;
     cmbMunicipio.SelectedIndex = 0;
 }
Пример #6
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            ModelClientes eliminar = new ModelClientes();

            eliminar.IdClientes = Convert.ToInt32(txtIdPersonas.Text);
            eliminar.IdEstado   = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
            DALClientes.eliminar(eliminar);
            MessageBox.Show("Registro eliminado exitosamente", "Eliminado", MessageBoxButtons.OK, MessageBoxIcon.Error);
            dgvPersonas.DataSource = DALClientes.mostrartabla();
        }
        public static long InsEvento(int IdTipoEvento, int IdComida, int IdCliente, int IdServicios, DateTime FechaEvento)
        {
            //Cambiar la disponibilidad del TipoEvento, Comida y del Cliente
            //DALTipoEventos.UpdTipoEvento(IdTipoEvento, null, null, null, null, false, null);

            //DAL.UpdComida(IdComida, null, null, null, null, null, null, null, false);

            DALClientes.UpdCliente(IdCliente, null, null, null, null, null, null, false);

            return(DALEvento.InsEvento(IdTipoEvento, IdComida, IdCliente, IdServicios, FechaEvento));
        }
Пример #8
0
        } // del DeleteCliente

        public static ClientesVO GetClienteById(int IdCliente)
        {
            try
            {
                return(DALClientes.GetClienteById(IdCliente));
            }
            catch (Exception)
            {
                return(new ClientesVO());
            }
        } //del GetClienteId
Пример #9
0
        } //del GetClienteId

        public static List <ClientesVO> GetLstClientes(bool?Disponibilidad)
        {
            List <ClientesVO> LstClientes = new List <ClientesVO>();

            try
            {
                return(DALClientes.GetListClientes(Disponibilidad));
            }
            catch (Exception)
            {
                return(LstClientes);
            }
        } // del GetLstClientes
Пример #10
0
        //ELIMINAR CLIENTE
        private void btnEliminar_Click_1(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Estas seguro de eliminar este cliente?", "Precaución!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)  {
                return;
            }

            ModelClientes eliminar = new ModelClientes();
            eliminar.IdClientes = Convert.ToInt32(txtIdClientes.Text);
            eliminar.IdEstado = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
            DALClientes.eliminar(eliminar);
            MessageBox.Show("Registro eliminado exitosamente", "Eliminado", MessageBoxButtons.OK, MessageBoxIcon.Error);
            dgvClientes.DataSource = DALClientes.mostrartabla();

        }
Пример #11
0
 private void Form1_Load(object sender, EventArgs e)
 {
     dgvClientes.DataSource = DALClientes.mostrartabla();
     Conexion.obtenerconexion();
     cmbTipoDoc.DataSource    = DALUsuarios.ObtenerTipoDocumento();
     cmbTipoDoc.DisplayMember = "Documento";
     cmbTipoDoc.ValueMember   = "IdTipoDocumento";
     cmbUsuario.DataSource    = DALUsuarios.ObtenerTipoUsuario();
     cmbUsuario.DisplayMember = "TipoUsuario";
     cmbUsuario.ValueMember   = "IdTipoUsuario";
     cmbGenero.DataSource     = DALUsuarios.ObtenerGenero();
     cmbGenero.DisplayMember  = "Genero";
     cmbGenero.ValueMember    = "IdGenero";
     cmbTipoDoc.SelectedIndex = 0;
     cmbGenero.SelectedIndex  = 0;
     cmbUsuario.SelectedIndex = 0;
 }
Пример #12
0
        }// del UpdCliente

        public static string DelCliente(int IdCliente)
        {
            try
            {
                ClientesVO Cliente = DALClientes.GetClienteById(IdCliente);

                if (Cliente.Disponibilidad)
                {
                    DALClientes.DelCliente(IdCliente);
                    return("Cliente eliminado");
                }
                else
                {
                    return("El Cliente se encuentra en un evento o no está disponible");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        } // del DeleteCliente
 public ActionResult agregarCliente(EntidadClientes cliente)
 {
     try
     {
         if (ModelState.IsValid)
         {
             DALClientes oCliente = new DALClientes();
             if (oCliente.InsertarCliente(cliente))
             {
                 ViewBag.Mensaje = "Cliente insertado exitosamente";
             }
             else
             {
                 ViewBag.Mensaje = "Ocurrió un error en la inclusi[on del cliente";
             }
         }
     }catch (Exception ex)
     {
         ex = null;
     }
     return(View());
 }
Пример #14
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (ValidarPersonas())
     {
         ModelClientes agregar = new ModelClientes();
         agregar.Nombre          = txtNombre.Text;
         agregar.Apellidos       = txtApellido.Text;
         agregar.Documento       = txtCorreo.Text;
         agregar.Telefono        = txtDireccion.Text;
         agregar.IdGenero        = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
         agregar.IdEstado        = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
         agregar.IdUsuario       = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
         agregar.IdTipoDocumento = Convert.ToInt32(cmbMunicipio.SelectedValue.ToString());
         int datos = DALClientes.agregar(agregar);
         if (datos > 0)
         {
             MessageBox.Show("Usuario ingresado");
             txtIdPersonas.Clear();
             txtNombre.Clear();
             txtApellido.Clear();
             txtCorreo.Clear();
             txtDireccion.Clear();
             cmbTipoDoc.SelectedIndex = 0;
             txtNumDoc.Clear();
             txtTelefono.Clear();
             txtEstadoCivil.Clear();
             cmbGenero.SelectedIndex    = 0;
             cmbMunicipio.SelectedIndex = 0;
         }
         else
         {
             MessageBox.Show("Usuario no registrado");
         }
     }
     else
     {
     }
 }
Пример #15
0
 private void btnActualizar_Click(object sender, EventArgs e)
 {
     if (ValidarPersonas())
     {
         ModelClientes actualizar = new ModelClientes();
         actualizar.IdClientes      = Convert.ToInt32(txtIdPersonas.Text);
         actualizar.Nombre          = txtNombre.Text;
         actualizar.Apellidos       = txtApellido.Text;
         actualizar.Documento       = txtCorreo.Text;
         actualizar.Telefono        = txtDireccion.Text;
         actualizar.IdGenero        = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
         actualizar.IdEstado        = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
         actualizar.IdUsuario       = Convert.ToInt32(cmbTipoDoc.SelectedIndex.ToString());
         actualizar.IdTipoDocumento = Convert.ToInt32(cmbMunicipio.SelectedValue.ToString());
         int datos = DALClientes.actualizar(actualizar);
         if (datos > 0)
         {
             MessageBox.Show("Usuario Modificado");
             dgvPersonas.DataSource = DALClientes.mostrartabla();
             txtNombre.Clear();
             txtApellido.Clear();
             txtCorreo.Clear();
             txtDireccion.Clear();
             cmbTipoDoc.SelectedIndex = -1;
             txtNumDoc.Clear();
             txtEstadoCivil.Clear();
             txtTelefono.Clear();
             cmbGenero.SelectedIndex    = -1;
             cmbMunicipio.SelectedIndex = -1;
         }
         else
         {
             MessageBox.Show("Usuario no modificado");
         }
     }
 }
Пример #16
0
 public Task <ClienteModel> ClienteLogin(ClienteModel t)
 {
     dal = new DALClientes();
     return(dal.ClienteLogin(t));
 }
Пример #17
0
 public Task Update(IEnumerable <ClienteModel> r, int c, int?u)
 {
     dal = new DALClientes();
     return(dal.AtualizaItens(r, c, u));
 }
Пример #18
0
 public Task <IEnumerable <ClienteModel> > Search(ClienteModel g, string s, int?u)
 {
     dal = new DALClientes();
     return(dal.BuscarItens(g, s, u));
 }
Пример #19
0
 public Task Remove(IEnumerable <ClienteModel> r, int c, int?u)
 {
     dal = new DALClientes();
     return(dal.ExcluirItens(r, c, u));
 }
Пример #20
0
 public Task <IEnumerable <ClienteModel> > GetAll(ClienteModel t, int?u)
 {
     dal = new DALClientes();
     return(dal.ObterTodos(t, u));
 }
Пример #21
0
 public Task <ClienteModel> FindById(ClienteModel t, int?u)
 {
     dal = new DALClientes();
     return(dal.BuscarItemByID(t, u));
 }
Пример #22
0
 private void button4_Click(object sender, EventArgs e)
 {
     dgvPersonas.DataSource = DALClientes.mostrartabla();
 }
Пример #23
0
 //MOSTRAR CLIENTES
 private void btnMostrar_Click(object sender, EventArgs e)
 {
     dgvClientes.DataSource = DALClientes.mostrartabla();
 }
Пример #24
0
 private void btnLimpiar_Click(object sender, EventArgs e)
 {
     dgvPersonas.DataSource = DALClientes.mostrartabla();
     txtBuscar.Clear();
 }
Пример #25
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     dgvPersonas.DataSource = DALClientes.buscar(txtBuscar.Text);
 }
Пример #26
0
 public Task <IEnumerable <FornecedorModel> > FornecedoresCliente(ClienteModel t, int?u)
 {
     dal = new DALClientes();
     return(dal.FornecedoresCliente(t, u));
 }
Пример #27
0
 public Task <dynamic> GetInfoEnvio(int c, int u)
 {
     dal = new DALClientes();
     return(dal.GetInfoEnvio(c, u));
 }
Пример #28
0
 public Task <int> AddCliente(IEnumerable <ClienteModel> r)
 {
     dal = new DALClientes();
     return(dal.AdicionarItens(r));
 }