Esempio n. 1
0
        public void DeleteEmpleados()
        {
            int      idempleado         = Convert.ToInt32(comboBox1.SelectedValue);
            empleado objTiendaVerificar = new empleado();

            using (agrosysEntitiesFull VerificarTiendaEntidad = new agrosysEntitiesFull())
            {
                objTiendaVerificar = VerificarTiendaEntidad.empleadoes.Where(s => s.id_empleado == idempleado).FirstOrDefault <empleado>();
            }

            if (objTiendaVerificar != null)
            {
                using (agrosysEntitiesFull empleadoEntidad = new agrosysEntitiesFull())
                {
                    objTiendaVerificar = empleadoEntidad.empleadoes.Where(s => s.id_empleado == idempleado).FirstOrDefault <empleado>();
                    empleadoEntidad.Set <empleado>().Remove(objTiendaVerificar);
                    empleadoEntidad.SaveChanges();
                }

                HideButtom();
                ShowNotification("Su registro a sido Eliminado!");
            }
            else
            {
                ShowNotification("El registro no Existe!");
            }
        }
Esempio n. 2
0
        public void DeleteEmpleados()
        {
            int  idempleado = Convert.ToInt32( comboBox1.SelectedValue);
               empleado objTiendaVerificar = new empleado();

            using (agrosysEntitiesFull VerificarTiendaEntidad = new agrosysEntitiesFull())
            {
                objTiendaVerificar = VerificarTiendaEntidad.empleadoes.Where(s => s.id_empleado == idempleado).FirstOrDefault<empleado>();
            }

            if (objTiendaVerificar != null)
            {
                using (agrosysEntitiesFull empleadoEntidad = new agrosysEntitiesFull())
                {
                    objTiendaVerificar = empleadoEntidad.empleadoes.Where(s => s.id_empleado == idempleado).FirstOrDefault<empleado>();
                    empleadoEntidad.Set<empleado>().Remove(objTiendaVerificar);
                    empleadoEntidad.SaveChanges();
                }

                HideButtom();
                ShowNotification("Su registro a sido Eliminado!");
            }
            else
            {
                ShowNotification("El registro no Existe!");
            }
        }
Esempio n. 3
0
 public void Fillempleado()
 {
     empleado objempleado = new empleado();
     int empleadoID = Convert.ToInt32(comboBox1.SelectedValue);
     // Get tienda from DB
     using (agrosysEntitiesFull empleadoEntidad = new agrosysEntitiesFull())
     {
         objempleado = empleadoEntidad.empleadoes.Where(s => s.id_empleado == empleadoID).FirstOrDefault<empleado>();
     }
     txtN.Text = objempleado.primer_nombre.ToString();
     txtN2.Text = objempleado.segundo_nombre.ToString();
     txtA.Text = objempleado.primer_apellido.ToString();
     txtA2.Text = objempleado.segundo_apellido.ToString();
     txtD.Text = objempleado.direccion.ToString();
     txtT.Text = objempleado.telefono.ToString();
     txtNIT.Text = objempleado.nit.ToString();
     txtDPI.Text = objempleado.dpi.ToString();
 }
Esempio n. 4
0
        public void Fillempleado()
        {
            empleado objempleado = new empleado();
            int      empleadoID  = Convert.ToInt32(comboBox1.SelectedValue);

            // Get tienda from DB
            using (agrosysEntitiesFull empleadoEntidad = new agrosysEntitiesFull())
            {
                objempleado = empleadoEntidad.empleadoes.Where(s => s.id_empleado == empleadoID).FirstOrDefault <empleado>();
            }
            txtN.Text   = objempleado.primer_nombre.ToString();
            txtN2.Text  = objempleado.segundo_nombre.ToString();
            txtA.Text   = objempleado.primer_apellido.ToString();
            txtA2.Text  = objempleado.segundo_apellido.ToString();
            txtD.Text   = objempleado.direccion.ToString();
            txtT.Text   = objempleado.telefono.ToString();
            txtNIT.Text = objempleado.nit.ToString();
            txtDPI.Text = objempleado.dpi.ToString();
        }
Esempio n. 5
0
        public void SetEmpleados(string primerNombre, string segundoNombre, string primerApellido, string segundoApellido, string telefono, string direccion, string nit, string dpi, int tiendaId)
        {
            try
            {
                empleado objEmpleadoVerificar = new empleado();
                using (agrosysEntitiesFull VerificarEmpleadoEntidad = new agrosysEntitiesFull())
                {
                    objEmpleadoVerificar = VerificarEmpleadoEntidad.empleadoes.Where(s => s.nit == nit || s.dpi == dpi).FirstOrDefault<empleado>();
                }

                if (objEmpleadoVerificar == null)
                {
                    using (agrosysEntitiesFull EmpleadoEntidad = new agrosysEntitiesFull())
                    {
                        empleado objEmpleado = new empleado();

                        objEmpleado.primer_nombre = primerNombre;
                        objEmpleado.segundo_nombre = segundoNombre;
                        objEmpleado.primer_apellido = primerApellido;
                        objEmpleado.segundo_apellido = segundoApellido;
                        objEmpleado.nit = nit;
                        objEmpleado.telefono = telefono;
                        objEmpleado.direccion = direccion;
                        objEmpleado.dpi = dpi;
                        objEmpleado.tienda_id_tienda = tiendaId;
                        EmpleadoEntidad.empleadoes.Add(objEmpleado);
                        EmpleadoEntidad.SaveChanges();
                        string mensaje = "El Empleado con el NIT " + nit + " a sido guardado";
                        ShowNotification(mensaje);
                    }
                }
                else
                {
                    ShowNotification("No se a podido guardar el registro");
                }

            }
            catch (Exception)
            {
                throw new Exception("Hay un problema al guardar la tienda, por favor intente de nuevo.");
            }
        }
Esempio n. 6
0
        public void SetEmpleados(string primerNombre, string segundoNombre, string primerApellido, string segundoApellido, string telefono, string direccion, string nit, string dpi, int tiendaId)
        {
            try
            {
                empleado objEmpleadoVerificar = new empleado();
                using (agrosysEntitiesFull VerificarEmpleadoEntidad = new agrosysEntitiesFull())
                {
                    objEmpleadoVerificar = VerificarEmpleadoEntidad.empleadoes.Where(s => s.nit == nit || s.dpi == dpi).FirstOrDefault <empleado>();
                }

                if (objEmpleadoVerificar == null)
                {
                    using (agrosysEntitiesFull EmpleadoEntidad = new agrosysEntitiesFull())
                    {
                        empleado objEmpleado = new empleado();

                        objEmpleado.primer_nombre    = primerNombre;
                        objEmpleado.segundo_nombre   = segundoNombre;
                        objEmpleado.primer_apellido  = primerApellido;
                        objEmpleado.segundo_apellido = segundoApellido;
                        objEmpleado.nit              = nit;
                        objEmpleado.telefono         = telefono;
                        objEmpleado.direccion        = direccion;
                        objEmpleado.dpi              = dpi;
                        objEmpleado.tienda_id_tienda = tiendaId;
                        EmpleadoEntidad.empleadoes.Add(objEmpleado);
                        EmpleadoEntidad.SaveChanges();
                        string mensaje = "El Empleado con el NIT " + nit + " a sido guardado";
                        ShowNotification(mensaje);
                    }
                }
                else
                {
                    ShowNotification("No se a podido guardar el registro");
                }
            }
            catch (Exception)
            {
                throw new Exception("Hay un problema al guardar la tienda, por favor intente de nuevo.");
            }
        }