public List <DtoEmployee> loginEmployee(DtoEmployee emp)
        {
            Entities_Visit ctx;

            using (ctx = new Entities_Visit())
            {
                var listEmployee = (from empl in ctx.EMPLOYEE
                                    join rol in ctx.ROLE on empl.ROL_ID equals rol.ROL_ID
                                    where empl.EMP_MAIL == emp.sEmp_mail && empl.EMP_PASSWORD == emp.sEmp_password && empl.EMP_STATE == true
                                    select new DtoEmployee()
                {
                    iRol_id = (int)empl.ROL_ID,
                    sRol_name = rol.ROL_NAME,
                    iBra_buis_id = (int)empl.BRA_BUIS_ID,
                    sEmp_document = empl.EMP_DOCUMENT,
                    sEmp_name = empl.EMP_NAME,
                    sEmp_surname = empl.EMP_SURNAME,
                    sEmp_phone = empl.EMP_PHONE,
                    sEmp_phone2 = empl.EMP_PHONE,
                    sEmp_cell_phone = empl.EMP_CELL_PHONE,
                    sEmp_cell_phone2 = empl.EMP_CELL_PHONE2,
                    sEmp_addres = empl.EMP_ADDRES,
                    sEmp_mail = empl.EMP_MAIL,
                    sEmp_mail2 = empl.EMP_MAIL2
                }
                                    ).ToList();
                return(listEmployee);
            }
        }
        public bool InsertUpdateEmployee(DtoEmployee emp)
        {
            Entities_Visit ctx;
            bool           bResult = false;

            using (ctx = new Entities_Visit())
            {
                try
                {
                    var query = ctx.PR_INSET_UPDATE_EMPLOYEE
                                (
                        emp.iRol_id, emp.iBra_buis_id, emp.sEmp_document, emp.sEmp_name, emp.sEmp_surname,
                        emp.sEmp_phone, emp.sEmp_phone2, emp.sEmp_cell_phone, emp.sEmp_cell_phone, emp.sEmp_addres,
                        emp.sEmp_mail, emp.sEmp_mail2, emp.sEmp_password, emp.bemp_state, emp.sEmp_permission, emp.sEmp_photo
                                );
                    // int result =Int32.Parse(query.ToString());
                    bResult = true;
                }
                catch (Exception e)
                {
                    bResult = false;
                }
            }
            return(bResult);
        }
Пример #3
0
        public List <DtoClient> ListClitSelect(DtoClient c**t)
        {
            Entities_Visit ctx;

            using (ctx = new Entities_Visit())
            {
                List <DtoClient> list = new List <DtoClient>();
                DtoClient        objClient;
                try
                {
                    var query = ctx.PR_SEARCH_CLIENT_SELECTION(c**t.sCli_bus_document, c**t.sCli_bus_name);
                    foreach (var client in query)
                    {
                        objClient = new DtoClient();
                        objClient.sCli_bus_name     = client.CLI_BUS_NAME;
                        objClient.sCli_bus_document = client.CLI_BUS_DOCUMENT;
                        objClient.sCit_name         = client.CIT_NAME;
                        objClient.sCont_name        = client.CONT_NAME;
                        objClient.sBra_off_address  = client.BRA_OFF_ADDRESS;
                        objClient.sBra_off_phone    = client.BRA_OFF_PHONE;

                        list.Add(objClient);
                    }
                    list.ToList();
                }
                catch (Exception e)
                {
                }
                return(list);
            }
        }
        public List <DtoBusiness> ListBraBusiness(DtoBusiness bus)
        {
            Entities_Visit     ctx;
            List <DtoBusiness> listBranchOffice = null;

            try
            {
                using (ctx = new Entities_Visit())
                {
                    listBranchOffice = (from bra in ctx.BRANCH_COMPANY
                                        where bra.BUS_ID == bus.iBus_id
                                        select new DtoBusiness()
                    {
                        iBra_buis_id = bra.BRA_BUIS_ID,
                        sBra_buis_name = bra.BRA_BUIS_NAME
                    }
                                        ).ToList();
                    return(listBranchOffice);
                }
            }
            catch (Exception e)
            {
            }
            return(listBranchOffice);
        }
        public List <DtoEmployee> ListRole()
        {
            Entities_Visit ctx;

            using (ctx = new Entities_Visit())
            {
                var listRole = (from rol in ctx.ROLE

                                select new DtoEmployee()
                {
                    iRol_id = rol.ROL_ID,
                    sRol_name = rol.ROL_NAME
                }
                                ).ToList();

                return(listRole);
            }
        }
Пример #6
0
        public List <DtoClient> ListCitys(int idCountry)
        {
            Entities_Visit ctx;

            using (ctx = new Entities_Visit())
            {
                var listCitys = (from city in ctx.CITIES
                                 where city.CONT_ID == idCountry
                                 select new DtoClient()
                {
                    iCit_id = city.CIT_ID,
                    sCit_name = city.CIT_NAME
                }
                                 ).ToList();

                return(listCitys);
            }
        }
Пример #7
0
        public List <DtoClient> ListCountry()
        {
            Entities_Visit ctx;

            using (ctx = new Entities_Visit())
            {
                var listCountry = (from coun in ctx.COUNTRY

                                   select new DtoClient()
                {
                    iCont_id = coun.CONT_ID,
                    sCont_name = coun.CONT_NAME
                }
                                   ).ToList();

                return(listCountry);
            }
        }
Пример #8
0
        public List <DtoEmployee> ListEmployeeSelect(DtoEmployee emp)
        {
            Entities_Visit ctx;

            using (ctx = new Entities_Visit())
            {
                List <DtoEmployee> list = new List <DtoEmployee>();
                DtoEmployee        objEmployee;
                try
                {
                    var query = ctx.PR_SEARCH_EMPLOYEE_SELECTION(emp.bemp_state, emp.iBra_buis_id, emp.sEmp_name, emp.sEmp_surname, emp.sEmp_document, emp.sEmp_mail, emp.sRol_name);
                    foreach (var employee in query)
                    {
                        objEmployee                  = new DtoEmployee();
                        objEmployee.iEmp_id          = (int)employee.EMP_ID;
                        objEmployee.iRol_id          = (int)employee.ROL_ID;
                        objEmployee.iBra_buis_id     = (int)employee.BRA_BUIS_ID;
                        objEmployee.sRol_name        = employee.ROL_NAME;
                        objEmployee.sEmp_document    = employee.EMP_DOCUMENT;
                        objEmployee.sEmp_name        = employee.EMP_NAME;
                        objEmployee.sEmp_surname     = employee.EMP_SURNAME;
                        objEmployee.sEmp_phone       = employee.EMP_PHONE;
                        objEmployee.sEmp_phone2      = employee.EMP_PHONE;
                        objEmployee.sEmp_cell_phone  = employee.EMP_CELL_PHONE;
                        objEmployee.sEmp_cell_phone2 = employee.EMP_CELL_PHONE2;
                        objEmployee.sEmp_addres      = employee.EMP_ADDRES;
                        objEmployee.sEmp_mail        = employee.EMP_MAIL;
                        objEmployee.sEmp_mail2       = employee.EMP_MAIL2;
                        objEmployee.sEmp_password    = employee.EMP_PASSWORD;
                        objEmployee.sEmp_password    = employee.EMP_PASSWORD;
                        objEmployee.sEmp_permission  = employee.EMP_PER;
                        list.Add(objEmployee);
                    }
                    list.ToList();
                }
                catch (Exception e)
                {
                }
                return(list);
            }
        }
        public List <DtoEmployee> ResetPasswordEmployee(DtoEmployee emp)
        {
            Entities_Visit ctx;

            using (ctx = new Entities_Visit())
            {
                var listEmployee = (from empl in ctx.EMPLOYEE
                                    where empl.EMP_MAIL == emp.sEmp_mail && empl.EMP_STATE == true
                                    select new DtoEmployee()
                {
                    iEmp_id = empl.EMP_ID,
                    bemp_state = empl.EMP_STATE,
                    sEmp_name = empl.EMP_NAME,
                    sEmp_surname = empl.EMP_SURNAME,
                    sEmp_mail = empl.EMP_MAIL
                }
                                    ).ToList();

                return(listEmployee);
            }
        }
Пример #10
0
        public List <DtoEmployee> ListEmployeeUpdate(DtoEmployee emp)
        {
            Entities_Visit     ctx;
            List <DtoEmployee> list = null;

            using (ctx = new Entities_Visit())
            {
                try
                {
                    list = (from empl in ctx.EMPLOYEE
                            join rol in ctx.ROLE on empl.ROL_ID equals rol.ROL_ID
                            where empl.EMP_STATE == true && empl.EMP_DOCUMENT == emp.sEmp_document || empl.EMP_MAIL == emp.sEmp_mail
                            select new DtoEmployee()
                    {
                        iEmp_id = empl.EMP_ID,
                        iRol_id = empl.ROL_ID,
                        iBra_buis_id = empl.BRA_BUIS_ID,
                        sRol_name = rol.ROL_NAME,
                        sEmp_document = empl.EMP_DOCUMENT,
                        sEmp_name = empl.EMP_NAME,
                        sEmp_surname = empl.EMP_SURNAME,
                        sEmp_phone = empl.EMP_PHONE,
                        sEmp_phone2 = empl.EMP_PHONE2,
                        sEmp_cell_phone = empl.EMP_CELL_PHONE,
                        sEmp_cell_phone2 = empl.EMP_CELL_PHONE2,
                        sEmp_addres = empl.EMP_ADDRES,
                        sEmp_mail = empl.EMP_MAIL,
                        sEmp_mail2 = empl.EMP_MAIL2,
                        sEmp_password = empl.EMP_PASSWORD,
                        sEmp_permission = empl.EMP_PER
                    }).ToList();
                    return(list);
                }
                catch (Exception e)
                {
                }
                return(list);
            }
        }
        public List <DtoEmployee> UpdateEmployeePassword(DtoEmployee emp)
        {
            Entities_Visit ctx;

            using (ctx = new Entities_Visit())
            {
                var objEmployee = (from empl in ctx.EMPLOYEE
                                   where empl.EMP_ID == emp.iEmp_id
                                   select empl).FirstOrDefault();
                objEmployee.EMP_PASSWORD = emp.sEmp_password;
                ctx.SaveChanges();

                var ListEmployee = (from empl in ctx.EMPLOYEE
                                    where empl.EMP_PASSWORD == emp.sEmp_password
                                    orderby empl.EMP_NAME
                                    select new DtoEmployee()
                {
                    sEmp_name = empl.EMP_NAME,
                    sEmp_surname = empl.EMP_SURNAME,
                }).ToList();
                return(ListEmployee);
            }
        }
        public bool DeleteEmployee(DtoEmployee emp)
        {
            Entities_Visit ctx     = new Entities_Visit();
            bool           bResult = false;

            using (ctx = new Entities_Visit())
            {
                try
                {
                    var query = ctx.PR_UPADTE_STATE_EMPLOYEE
                                (
                        emp.iEmp_id, emp.sEmp_document
                                );
                    string result = query.ToString();

                    bResult = true;
                }
                catch (Exception e)
                {
                    bResult = false;
                }
            }
            return(bResult);
        }
Пример #13
0
        public bool InsertUpdateClit(DtoClient c**t)
        {
            Entities_Visit ctx;
            bool           bResult = false;

            using (ctx = new Entities_Visit()) {
                try
                {
                    var query = ctx.PR_INSERT_UPDATE_CLIENT
                                (
                        c**t.sCli_bus_name, c**t.sCli_bus_document, c**t.sCli_bus_type, c**t.iCit_id, c**t.iEmp_id,
                        c**t.sBra_off_phone, c**t.sBra_off_address, c**t.sBra_com_name, c**t.sBra_com_phone, c**t.sBra_com_mail,
                        c**t.sBra_com_mail2
                                );
                    // int result =Int32.Parse(query.ToString());
                    bResult = true;
                }
                catch (Exception e)
                {
                    bResult = false;
                }
            }
            return(bResult);
        }