Beispiel #1
0
 public Entities.tb_employees VerificarRecuperação(Entities.tb_employees employees)
 {
     Entities.tb_employees verificar = db.tb_employees.FirstOrDefault(l => l.nr_cpf == employees.nr_cpf ||
                                                                      l.nr_rg == employees.nr_rg ||
                                                                      l.nr_cellphone == employees.nr_cellphone);
     return(verificar);
 }
Beispiel #2
0
        public void Alterar(Entities.tb_employees emp, int id)
        {
            Entities.tb_employees tb = db.tb_employees.FirstOrDefault(t => t.id_emp == id);
            tb.nm_firstName   = emp.nm_firstName;
            tb.nm_lastName    = emp.nm_lastName;
            tb.nr_cpf         = emp.nr_cpf;
            tb.nr_rg          = emp.nr_rg;
            tb.nr_dependents  = emp.nr_dependents;
            tb.ds_sex         = emp.ds_sex;
            tb.dt_birth       = emp.dt_birth;
            tb.ds_state       = emp.ds_state;
            tb.nr_cep         = emp.nr_cep;
            tb.ds_address     = emp.ds_address;
            tb.ds_note        = emp.ds_note;
            tb.nr_cellphone   = emp.nr_cellphone;
            tb.nr_tellphone   = emp.nr_tellphone;
            tb.ds_email       = emp.ds_email;
            tb.pw_password    = emp.pw_password;
            tb.dt_hiring      = emp.dt_hiring;
            tb.dt_resignation = emp.dt_resignation;
            tb.bt_employee    = emp.bt_employee;
            tb.bt_manager     = emp.bt_manager;
            tb.bt_crm         = emp.bt_crm;
            tb.bt_provider    = emp.bt_provider;
            tb.bt_stock       = emp.bt_stock;
            tb.bt_rh          = emp.bt_rh;
            tb.bt_financial   = emp.bt_financial;

            db.SaveChanges();
        }
Beispiel #3
0
        public void ConsultarPorFunc(string func)
        {
            List <Entities.tb_deptfunction> listFunc = db.tb_deptfunction.Where(t => t.nm_function == func).ToList();
            List <Entities.tb_employees>    list     = new List <Entities.tb_employees>();

            foreach (Entities.tb_deptfunction item in listFunc)
            {
                list.Add(item.tb_employees);
            }

            if (listEmployees == null)
            {
                listEmployees = list;
            }
            else
            {
                List <Entities.tb_employees> listEmp = new List <Entities.tb_employees>();
                foreach (Entities.tb_employees item in list)
                {
                    Entities.tb_employees emp = new Entities.tb_employees();
                    emp = listEmployees.FirstOrDefault(t => t.id_emp == item.id_emp);

                    if (emp != null)
                    {
                        listEmp.Add(emp);
                    }
                }

                listEmployees = listEmp;
            }
        }
Beispiel #4
0
        public int Insirir(Entities.tb_employees emp)
        {
            int idEmp = db.tb_employees.Max(t => t.id_emp) + 1;

            emp.id_emp = idEmp;

            db.tb_employees.Add(emp);
            db.SaveChanges();

            return(idEmp);
        }
Beispiel #5
0
        public int Consultar(string rg)
        {
            try
            {
                Entities.tb_employees tb = DB.tb_employees.First(t => t.nr_rg == rg);

                return(tb.id_emp);
            }
            catch (Exception)
            {
                throw new ArgumentException("Não foi possivel encontar o Funcionário!");
            }
        }
Beispiel #6
0
        public bool Login(Entities.tb_employees emp)
        {
            Entities.tb_employees tb = db.tb_employees.FirstOrDefault(t => t.ds_email.ToLower() == emp.ds_email &&
                                                                      t.pw_password.ToLower() == emp.pw_password);

            if (tb != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #7
0
 public void AlterarRecuperação(Entities.tb_employees employees)
 {
     if (employees.nr_cpf != string.Empty)
     {
         Entities.tb_employees novo = db.tb_employees.First(u => u.pw_password == employees.pw_password);
         novo.pw_password = employees.pw_password;
         db.SaveChanges();
     }
     else if (employees.nr_rg != string.Empty)
     {
         Entities.tb_employees novo = db.tb_employees.First(u => u.nr_rg == employees.nr_rg);
         novo.pw_password = employees.pw_password;
         db.SaveChanges();
     }
     else if (employees.nr_cellphone != string.Empty)
     {
         Entities.tb_employees novo = db.tb_employees.First(u => u.nr_cellphone == employees.nr_cellphone);
         novo.pw_password = employees.pw_password;
         db.SaveChanges();
     }
 }
Beispiel #8
0
        public void Remover(Entities.tb_employees emp)
        {
            db.tb_employees.Remove(emp);

            db.SaveChanges();
        }
Beispiel #9
0
 public Entities.tb_employees ConsultarPorID(int id)
 {
     Entities.tb_employees emp = db.tb_employees.FirstOrDefault(t => t.id_emp == id);
     return(emp);
 }