Beispiel #1
0
        public static Workers getWorkerByID(int id)
        {
            var worker = WorkerDataBase.getWorkerByID(id, "Employee_Status");

            GarageModels.Workers workersDTO = new GarageModels.Workers()
            {
                User = new GarageModels.User()
                {
                    first_name = worker.User.first_name,
                    last_name  = worker.User.last_name,
                    tel_number = worker.User.tel_number,
                    address    = worker.User.address
                },
                id_worker      = worker.id_worker,
                num_of_credits = worker.num_of_credits ?? 0,
                password       = worker.User.password,
                employee_code  = new GarageModels.Employee_kind()
                {
                    description_of_the_kind = worker.Employee_kind.description_of_the_kind,
                    employee_kind_code      = worker.Employee_kind.employee_kind_code
                }
            };

            return(workersDTO);
        }
Beispiel #2
0
        public static Workers GetUser(int userID, string password)
        {
            var worker = WorkerDataBase.getWorker(userID, password, "Employee_Status");

            GarageModels.Workers workersDTO = new GarageModels.Workers()
            {
                User = new GarageModels.User
                {
                    first_name        = worker.User.first_name,
                    last_name         = worker.User.last_name,
                    tel_number        = worker.User.tel_number,
                    address           = worker.User.address,
                    password          = worker.User.password,
                    mail_address      = worker.User.mail_address,
                    registertion_date = DateTime.Now
                },


                num_of_credits = worker.num_of_credits ?? 0,

                employee_code = new GarageModels.Employee_kind()
                {
                    description_of_the_kind = worker.Employee_kind.description_of_the_kind,
                    employee_kind_code      = worker.Employee_kind.employee_kind_code
                }
            };

            return(workersDTO);
        }
Beispiel #3
0
        public static List <GarageModels.Workers> getAllWorker()
        {
            List <GarageModels.Workers> workersDTO = new List <GarageModels.Workers>();

            //Mapper.Initialize(cfg => {
            //    cfg.CreateMap<Workers, Worker>();
            //    cfg.CreateMap<GarageDAL.Employee_Status, GarageModels.Employee_Status>();
            //});

            var workers = WorkerDataBase.getAllWorkers("Employee_Status");

            foreach (var worker in workers)
            {
                //workersDTO.Add(Mapper.Map<Worker>(worker));
                workersDTO.Add(new GarageModels.Workers()
                {
                    User = new GarageModels.User
                    {
                        first_name = worker.User.first_name,
                        last_name  = worker.User.last_name,
                        tel_number = worker.User.tel_number,
                        address    = worker.User.address,
                        password   = worker.User.password,
                    },
                    id_worker = worker.id_worker,

                    num_of_credits = worker.num_of_credits ?? 0,

                    employee_code = new GarageModels.Employee_kind()
                    {
                        description_of_the_kind = worker.Employee_kind.description_of_the_kind,
                        employee_kind_code      = worker.Employee_kind.employee_kind_code
                    },
                });
            }
            return(workersDTO);
        }
Beispiel #4
0
 public static void deleteWorker(int id)
 {
     WorkerDataBase.deleteWorkerByID(id);
 }