Exemplo n.º 1
0
        public ActionResult <CommonResponeModel> GetDataTransferHasFilter([FromQuery] EmployeeFilterRequestModel filterModel)
        {
            Data   = employeeRepository.GetDataTransferHasFilter(filterModel?.DepartmentCode, filterModel?.GroupCode, filterModel?.LaborGroupCode, filterModel?.StatusCode, filterModel?.StartFromDate, filterModel?.StartToDate);
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 2
0
        public ActionResult <CommonResponeModel> GetDataTransfers()
        {
            Data   = navigationRepository.GetDataTransfers();
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 3
0
        public ActionResult <CommonResponeModel> Get()
        {
            Data   = userRepository.Get().ToList();
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 4
0
        public ActionResult <CommonResponeModel> GetByEntity(CategoryGetRequestModel model)
        {
            Data   = categoryRepository.GetByEntity(model.Entity).ToList();
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
        public ActionResult <CommonResponeModel> GetTimeRangeDataTransfer(DateTime?FromDate, DateTime?ToDate)
        {
            Data   = employeeCheckInOutRepository.GetTimeRangeDataTransfer(FromDate, ToDate);
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 6
0
        public ActionResult <CommonResponeModel> DashboardOverview(DateTime fromDate, DateTime toDate)
        {
            Data   = this._statisticRepository.GetDataTransferDashboardOverview(fromDate, toDate);
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 7
0
        public ActionResult <CommonResponeModel> GetModelTemplates()
        {
            Data   = employeeRepository.GetModelTemplates();
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
        public ActionResult <CommonResponeModel> Get(string employeeCode)
        {
            var result = this._employeeRelativeRepository.GetFilteredItems(employeeCode);

            Data   = result;
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 9
0
        public ActionResult <CommonResponeModel> Get(string employeeCode, DateTime?fromDate, DateTime?toDate)
        {
            var result = this._employeeDayOffRepository.GetFilteredItems(employeeCode, fromDate, toDate);

            Data   = result;
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 10
0
        public ActionResult <CommonResponeModel> Identity(long Id)
        {
            var employee = employeeRepository.GetById(Id) ?? new Model.Models.Employee();

            Data   = employee.MapTo <EmployeeIdentityDetailResponeModel>();
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 11
0
 public ActionResult <CommonResponeModel> GetUserNavigationRole(string username)
 {
     if (string.IsNullOrEmpty(username))
     {
         username = RequestUsername;
     }
     Result = Result = new SuccessResultFactory().Factory(ActionType.Select);
     Data   = roleRepository.GetAllowedDataTransfersByUserName(username).GenerateTree(item => item.Navigation.Code,
                                                                                      item => item.Navigation.ParentCode, string.Empty);
     return(GetCommonRespone());
 }
        public ActionResult <CommonResponeModel> GetById(long id)
        {
            var currentObj = this._employeeRelativeRepository.GetById(id);

            if (currentObj == null || currentObj.Deleted == true)
            {
                Result = new ErrorResult(ActionType.Select, "Lỗi 404");
            }

            Data   = currentObj;
            Result = new SuccessResultFactory().Factory(ActionType.Select);

            return(GetCommonRespone());
        }
Exemplo n.º 13
0
        public ActionResult <CommonResponeModel> Delete(long Id)
        {
            int result = trainingCourseEmployeeRepository.Delete(Id);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Delete);
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Delete);
            }

            return(GetCommonRespone());
        }
        public ActionResult <CommonResponeModel> Delete(long Id)
        {
            int result = recruitmentPlanRepository.Delete(Id);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Delete);
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Delete);
            }

            return(GetCommonRespone());
        }
Exemplo n.º 15
0
        public ActionResult <CommonResponeModel> DeleteByCode(string Code)
        {
            int result = categoryRepository.Delete(Code);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Delete);
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Delete);
            }

            return(GetCommonRespone());
        }
Exemplo n.º 16
0
        public ActionResult <CommonResponeModel> Update(ShiftUpdateRequestModel model)
        {
            var databaseObject = model.MapTo <Shift>();

            databaseObject.InitBeforeSave(RequestUsername, InitType.Create);
            int result = shiftRepository.Update(databaseObject);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Edit);
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Edit);
            }
            return(GetCommonRespone());
        }
        public ActionResult <CommonResponeModel> Create(RecruitmentPlanCreateRequestModel model)
        {
            var validator = new RecruitmentPlanCreateValidator(categoryRepository);

            var databaseObject = model.MapTo <RecruitmentPlan>();

            //empty code
            if (string.IsNullOrEmpty(databaseObject.Code))
            {
                var code = entityCenterRepository.GetCodeByEntity(nameof(RecruitmentPlan));

                if (string.IsNullOrEmpty(code))
                {
                    Result = new ErrorResult(ActionType.Insert, AppGlobal.MakeCodeError);
                    Data   = model;
                    return(GetCommonRespone());
                }

                databaseObject.Code = code;
            }

            //check exist in db
            if (recruitmentPlanRepository.IsExistCode(databaseObject.Code))
            {
                Result = new ErrorResult(ActionType.Insert, AppGlobal.ExistCodeError);
                return(GetCommonRespone());
            }

            databaseObject.InitBeforeSave(RequestUsername, InitType.Create);

            int result = recruitmentPlanRepository.Insert(databaseObject);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Insert);
                Data   = databaseObject;
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Insert);
                Data   = databaseObject;
            }

            return(GetCommonRespone());
        }
Exemplo n.º 18
0
        public ActionResult <CommonResponeModel> Create(TrainingCourseEmployeeCreateRequestModel model)
        {
            var databaseObject = model.MapTo <TrainingCourseEmployee>();

            databaseObject.InitBeforeSave(RequestUsername, InitType.Create);
            int result = trainingCourseEmployeeRepository.Insert(databaseObject);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Insert);
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Insert);
            }

            return(GetCommonRespone());
        }
Exemplo n.º 19
0
        public ActionResult <CommonResponeModel> GetItemsByEmployeeCode(string employeeCode)
        {
            if (string.IsNullOrEmpty(employeeCode))
            {
                Result = new ErrorResult(ActionType.Select, AppGlobal.Error);
            }
            else
            {
                var result = this._employeeDayOffRepository.GetItemsByEmployeeCode(employeeCode);

                Data   = result;
                Result = new SuccessResultFactory().Factory(ActionType.Select);
            }



            return(GetCommonRespone());
        }
Exemplo n.º 20
0
        public ActionResult <CommonResponeModel> Create(CandidatePaperCreateRequestModel model)
        {
            var databaseObject = model.MapTo <CandidatePaper>();

            //empty code
            if (string.IsNullOrEmpty(databaseObject.Code))
            {
                var code = entityCenterRepository.GetCodeByEntity(nameof(CandidatePaper));

                if (string.IsNullOrEmpty(code))
                {
                    Result = new ErrorResult(ActionType.Insert, AppGlobal.MakeCodeError);
                    return(GetCommonRespone());
                }

                databaseObject.Code = code;
            }

            //check exist in db
            if (candidatePaperRepository.IsExistCode(databaseObject.Code))
            {
                Result = new ErrorResult(ActionType.Insert, AppGlobal.ExistCodeError);
                return(GetCommonRespone());
            }

            databaseObject.InitBeforeSave(RequestUsername, InitType.Create);
            int result = candidatePaperRepository.Insert(databaseObject);

            //result
            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Insert);
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Insert);
            }

            return(GetCommonRespone());
        }
Exemplo n.º 21
0
        public ActionResult <CommonResponeModel> Create(Navigation model)
        {
            //empty code
            if (string.IsNullOrEmpty(model.Code))
            {
                var code = entityCenterRepository.GetCodeByEntity(nameof(Navigation));

                if (string.IsNullOrEmpty(code))
                {
                    Result = new ErrorResult(ActionType.Insert, AppGlobal.MakeCodeError);
                    return(GetCommonRespone());
                }

                model.Code = code;
            }

            //check exist in db
            if (navigationRepository.IsExistCode(model.Code))
            {
                Result = new ErrorResult(ActionType.Insert, AppGlobal.ExistCodeError);
                return(GetCommonRespone());
            }

            model.InitBeforeSave(RequestUsername, InitType.Create);
            model.InitDefault();
            int result = navigationRepository.Insert(model, out model);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Insert);
                Data   = model;
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Insert);
                Data   = model;
            }

            return(GetCommonRespone());
        }
Exemplo n.º 22
0
        public ActionResult <CommonResponeModel> Create(CandidateCreateRequestModel model)
        {
            var databaseObject = model.MapTo <Candidate>();

            databaseObject.InitBeforeSave(RequestUsername, InitType.Create);

            if (string.IsNullOrEmpty(databaseObject.Code))
            {
                var code = this._entityCenterRepository.GetCodeByEntity(nameof(Candidate));

                if (string.IsNullOrEmpty(code))
                {
                    Result = new ErrorResult(ActionType.Insert, AppGlobal.MakeCodeError);
                    return(GetCommonRespone());
                }

                databaseObject.Code = code;
            }

            if (this._candidateRepository.GetByCode(databaseObject.Code) != null)
            {
                Result = new ErrorResult(ActionType.Insert, AppGlobal.ExistCodeError);
                return(GetCommonRespone());
            }

            int result = this._candidateRepository.Insert(databaseObject);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Insert);
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Insert);
            }

            return(GetCommonRespone());
        }
Exemplo n.º 23
0
        public ActionResult <CommonResponeModel> Login(LoginUserRequestModel model)
        {
            var LoginResponeModel = new LoginResponeModel();

            //login success
            if (userRepository.IsValidUser(model.Username, model.Password))
            {
                Result = new SuccessResultFactory().Factory(ActionType.Login);

                LoginResponeModel.TokenExpireDate = DateTime.Now.AddDays(1);
                LoginResponeModel.Token           = TokenProvider.GenerateTokenString(model.ToDictionaryStringString());
                LoginResponeModel.User            = userRepository.GetDataTransferByUsername(model.Username);
            }
            else //login fail
            {
                Result = new ErrorResultFactory().Factory(ActionType.Login);
            }

            //set data
            Data = LoginResponeModel;

            return(GetCommonRespone());
        }
Exemplo n.º 24
0
        public ActionResult <CommonResponeModel> Update(Navigation model)
        {
            model.InitBeforeSave(RequestUsername, InitType.Update);
            model.InitDefault();

            var existModel = navigationRepository.GetById(model.Id);

            ObjectExtensions.CopyValues(existModel, model);

            int result = navigationRepository.Update(existModel, out existModel);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Edit);
                Data   = existModel;
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Edit);
                Data   = existModel;
            }

            return(GetCommonRespone());
        }
Exemplo n.º 25
0
 public ActionResult <CommonResponeModel> GetAll()
 {
     Data   = trainingCourseEmployeeRepository.Get().ToList();
     Result = new SuccessResultFactory().Factory(ActionType.Select);
     return(GetCommonRespone());
 }
 public ActionResult <CommonResponeModel> GetById(long Id)
 {
     Data   = recruitmentPlanRepository.GetById(Id);
     Result = new SuccessResultFactory().Factory(ActionType.Select);
     return(GetCommonRespone());
 }
Exemplo n.º 27
0
 public ActionResult <CommonResponeModel> GetByRoleGroupCode(string RoleGroupCode)
 {
     Data   = roleGroupDetailRepository.GetByRoleGroupCode(RoleGroupCode).ToList();
     Result = new SuccessResultFactory().Factory(ActionType.Select);
     return(GetCommonRespone());
 }
Exemplo n.º 28
0
        public ActionResult <CommonResponeModel> CheckFileEmployees([FromForm] IFormFile file)
        {
            if (file == null || string.IsNullOrWhiteSpace(file.FileName))
            {
                Result = new ErrorResult(ActionType.CheckFileExcel, CommonMessageGlobal.Require("File Excel"));
                return(GetCommonRespone());
            }

            try
            {
                string path         = Path.Combine(AppGlobal.ExcelImportDestFolder, DateTime.Now.ToString("yyyyMMddHHmmss") + file.FileName);
                string pathXmlCheck = Path.Combine(AppGlobal.XmlTemplateImportFolder, "Employee.xml");

                //save file to server
                file.SaveTo(path);

                //read file to check
                System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
                using (var stream = System.IO.File.Open(path, FileMode.Open, FileAccess.Read))
                {
                    using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream))
                    {
                        var dataSet = reader.AsDataSet(new ExcelDataSetConfiguration
                        {
                            ConfigureDataTable = _ => new ExcelDataTableConfiguration
                            {
                                UseHeaderRow = true // Use first row is ColumnName here
                            }
                        });

                        if (dataSet.Tables.Count > 0)
                        {
                            SheetTemplateImport templateImport = new SheetTemplateImport(pathXmlCheck);

                            DataTable table = dataSet.Tables[templateImport.SheetName];

                            foreach (var column in templateImport.Columns)
                            {
                                if (!string.IsNullOrWhiteSpace(column.excelHeader))
                                {
                                    table.Columns[column.excelHeader].ColumnName = column.propertyName;
                                }
                            }

                            //validate data
                            var validator = new ImportEmployeeExcelFileValidator(categoryRepository);
                            List <EmployeeImportDataTransfer> employees = table.ToList <EmployeeImportDataTransfer>(true);
                            foreach (var employee in employees)
                            {
                                ValidationResult results = validator.Validate(employee);

                                if (!results.IsValid)
                                {
                                    foreach (var failure in results.Errors)
                                    {
                                        employee.IsError = true;
                                        employee.ErrorMessage.Add(failure.ErrorMessage);
                                    }
                                }
                            }

                            Data = employees;
                        }
                    }
                }

                Result = new SuccessResultFactory().Factory(ActionType.CheckFileExcel);
            }
            catch (Exception)
            {
                Result = new ErrorResultFactory().Factory(ActionType.CheckFileExcel);
            }

            return(GetCommonRespone());
        }