public Rec_JobConditionModel GetById(Guid id)
        {
            string status = string.Empty;
            var model = new Rec_JobConditionModel();

            ActionService service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<Rec_JobConditionEntity>(id, ConstantSql.hrm_rec_sp_get_JobConditionById, ref status);//note
            if (entity != null)
            {
                model = entity.CopyData<Rec_JobConditionModel>();
                if (model.ConditionName == ConditionName.E_DISEASEIDS.ToString() && !string.IsNullOrEmpty(model.Value1))
                {
                    var service1 = new BaseService();
                    var lst = service1.GetData<Cat_ComputingLevelMultiEntity>(model.Value1, ConstantSql.hrm_cat_sp_get_LevelGeneralByIds, UserLogin ,ref status).ToList();
                    var ids = model.Value1
                            .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                            .Select(x => Common.OracleToDotNet(x.ToString()))
                            .ToList();

                    model.Value1 = string.Join(",", ids);
                    model.DiseaseIDs = string.Join(",", ids);
                    //   model.ArrDisease = lst;

                }

            }
            model.ActionStatus = status;
            return model;
        }
 public Can_MealAllowanceTypeSettingModel Post([Bind]Can_MealAllowanceTypeSettingModel model)
 {
     
     ActionService service = new ActionService(UserLogin);
     model.Standard = true;
     return service.UpdateOrCreate<Can_MealAllowanceTypeSettingEntity, Can_MealAllowanceTypeSettingModel>(model);
 }
        public FIN_ApproveCashAdvanceModel Post([Bind]FIN_ApproveCashAdvanceModel model)
        {

            #region Validate

            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<FIN_ApproveCashAdvanceModel>(model, "FIN_ApproveCashAdvance", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }

            #endregion
            ActionService service = new ActionService(UserLogin);
            if(!string.IsNullOrEmpty(model.Other))
            {
                model.IsEntertaiment = null;
                model.TravelRequestID = null;
            }
            if(model.IsEntertaiment == true)
            {
                model.TravelRequestID = null;
            }

            return service.UpdateOrCreate<Fin_ApproveCashAdvanceEntity, FIN_ApproveCashAdvanceModel>(model);
        }
 public Sys_LockObjectItemModel Post(Sys_LockObjectItemModel model)
 {
     ActionService service = new ActionService(UserLogin);
     var lockItemServices = new Sys_LockObjectItemServices();
     string message = string.Empty;
     if(model.ObjectName.IndexOf(',') > 1)
     {
        string[] objName = model.ObjectName.Split(',');
        if (objName.Length > 0)
        {
            foreach (var item in objName)
            {
                Sys_LockObjectItemEntity entity = new Sys_LockObjectItemEntity();
                entity = model.CopyData<Sys_LockObjectItemEntity>();
                entity.ObjectName = item;
               // model = service.UpdateOrCreate<Sys_LockObjectItemEntity, Sys_LockObjectItemModel>(model);
               model.ActionStatus =  lockItemServices.Add(entity);
            }
        
        }
       
        return model;
     }
     return service.UpdateOrCreate<Sys_LockObjectItemEntity, Sys_LockObjectItemModel>(model);
 }
        public Eva_PerformanceModel GetById(Guid id)
        {
            string status = string.Empty;
            var performanceService = new Eva_PerformanceServices();
                       
            var model = new Eva_PerformanceModel();
            var service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<Eva_PerformanceEntity>(id, ConstantSql.hrm_eva_sp_get_PerformanceById, ref status);
            if (entity != null)
            {
                model = entity.CopyData<Eva_PerformanceModel>();
                // model.AttachFileLast = model.AttachFile;

                #region Đọc Xml từ db và chuyển sang string

                if (model != null)
                {
                    var doc = performanceService.ReadXml(model.AttachFile, AttachFileEntity.FieldNames.FullName);
                    model.AttachFileLast = string.Join(",", doc.ToArray());
                    model.AttachFile = model.AttachFileLast;
                    model.AttachFiles = doc;
                }
                #endregion
            }

            model.ActionStatus = status;
            return model;
        }
        /// <summary>
        /// [Chuc.Nguyen] - Xóa hoặc chuyển đổi trạng thái của Ngân Hàng(Tra_Certificate) sang IsDelete
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Tra_TraineeCertificateModel DeleteOrRemove(string id)
        {
            ActionService service = new ActionService(UserLogin);
            var traineeCertificateServices = new Tra_TraineeCertificateServices();
            string status = string.Empty;
            var result = new Tra_TraineeCertificateModel();
            Guid[] _TraineeIds = null;
            var Ids = id.Substring(7);
            if(Ids != null)
            {
                _TraineeIds = Ids.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }
            var objTraineeCertificate = new List<object>();
            objTraineeCertificate.Add(1);
            objTraineeCertificate.Add(int.MaxValue -1);
            var lstTraineeCertificate = traineeCertificateServices.GetData<Tra_TraineeCertificateEntity>(objTraineeCertificate, ConstantSql.hrm_tra_sp_get_TraineeCertificate,UserLogin, ref status).ToList();
            if (lstTraineeCertificate != null)
            {
                lstTraineeCertificate = lstTraineeCertificate.Where(s => _TraineeIds.Contains(s.TraineeID.Value)).ToList();
            }
            var lstTraineeCertificateIds = lstTraineeCertificate.Select(s => s.ID).ToList();
            var strIds = string.Join(",", lstTraineeCertificateIds.ToArray());
            if (!string.IsNullOrEmpty(strIds))
            {
                var  strRemoveIds = DeleteType.Remove.ToString() + "," + strIds;
                result = service.DeleteOrRemove<Tra_TraineeCertificateEntity, Tra_TraineeCertificateModel>(strRemoveIds);
                return result;
            }

            return result;
            
        }
 public Rec_InterviewCampaignDetailModel Post([Bind]Rec_InterviewCampaignDetailModel model)
 {
     ActionService service = new ActionService(UserLogin);
     string status = string.Empty;
     if (model.InterviewCampaignID != null)
     {
         var interviewcampaign = service.GetData<Rec_InterviewCampaignEntity>(Common.DotNetToOracle(model.InterviewCampaignID.ToString()), ConstantSql.hrm_rec_sp_get_InterviewCampaignById, ref status).FirstOrDefault();
         if (interviewcampaign != null)
         {
             model.DateFrom = interviewcampaign.DateInterviewFrom;
             model.DateTo = interviewcampaign.DateInterviewTo;
             model.LevelInterview = interviewcampaign.LevelInterview;
         }
     }
     #region Validate
     string message = string.Empty;
     var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Rec_InterviewCampaignDetailModel>(model, "Rec_InterviewCampaignDetail", ref message);
     if (!checkValidate)
     {
         model.ActionStatus = message;
         return model;
     }
     #endregion
    
     return service.UpdateOrCreate<Rec_InterviewCampaignDetailEntity, Rec_InterviewCampaignDetailModel>(model);
 }
 public FIN_ApproveTravelCostModel DeleteOrRemove(string id)
 {
     ActionService service = new ActionService(UserLogin);
     var result1 = service.DeleteOrRemove<FIN_TravelRequestEntity, FIN_TravelRequestModel>(id);
     var result=  result1.CopyData<FIN_ApproveTravelCostModel>();
     return result;
 }
Beispiel #9
0
        /// <summary>
        /// [Chuc.Nguyen] - Lấy dữ liệu bảng Tai Nạn(Hre_Accident) theo Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FIN_ClaimModel GetById(Guid id)
        {
            string status = string.Empty;
            var model = new FIN_ClaimModel();
            ActionService service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<FIN_ClaimEntity>(id, ConstantSql.hrm_hr_sp_get_ClaimById, ref status);
            if (entity != null)
            {
                model = entity.CopyData<FIN_ClaimModel>();
                if (!string.IsNullOrEmpty(model.Other))
                {
                    model.IsManufactureName = true;
                }
                else {
                    model.IsProfile = true;
                }

                if(model.IsCashAdvance != null && model.IsCashAdvance == false)
                {
                    model.IsNoneCashAdvance = true;
                }
                if (model.IsCashAdvance != null  && model.IsCashAdvance == true)
                {
                    model.IsNoneCashAdvance = false;
                }
                
                
                
            }
            model.ActionStatus = status;
            return model;
        }
 /// <summary>
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Tra_RequirementTrainModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Tra_RequirementTrainModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Tra_RequirementTrainEntity>(id, ConstantSql.hrm_tra_sp_get_RequirementTrainIds, ref status);
     if (entity!=null)
     {
         model = entity.CopyData<Tra_RequirementTrainModel>();
         if (entity.PersonRequirement != null)
         {
             Guid profileid = Guid.Parse(entity.PersonRequirement);
             var entityprofile = service.GetByIdUseStore<Tra_RequirementTrainEntity>(profileid, ConstantSql.hrm_hr_sp_get_ProfileById, ref status);
             if (entityprofile != null && entityprofile.ProfileID != null && entityprofile.ProfileName != null)
             {
                 model.ProfileID = entityprofile.ID;
                 model.ProfileName = entityprofile.ProfileName;
                 model.CodeEmp = entityprofile.CodeEmp;
             }
         }
     }
     if (model.IsTrainingOutside != null && model.IsTrainingOutside == false)
         model.IsTrainingInside = true;
     model.ActionStatus = status;
     return model;
 }
        public Rec_RecruitmentHistoryModel DeleteOrRemove(string id)
        {

            ActionService service = new ActionService(UserLogin);
            var result = service.DeleteOrRemove<Rec_RecruitmentHistoryEntity, Rec_RecruitmentHistoryModel>(id);
            return result;
        }
Beispiel #12
0
        /// <summary>
        /// [Son.Vo] - Lấy dữ liệu OrgStructure(Cat_OrgStructure) theo Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public CatOrgStructureModel GetById(Guid id)
        {
            string status = string.Empty;
            var model = new CatOrgStructureModel();

            var orgServices = new Cat_OrgMoreInforServices();
            ActionService service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<Cat_OrgStructureEntity>(id,ConstantSql.hrm_cat_sp_get_OrgStructureById ,ref status);
            var objs = new List<object>();
            objs.Add(Common.DotNetToOracle(id.ToString()));
            var orgInfoEntity = orgServices.GetData<Cat_OrgMoreInforEntity>(objs, ConstantSql.hrm_hr_sp_get_OrgMoreInfoByOrgID, UserLogin, ref status).FirstOrDefault();
            if (entity != null)
            {

                model = entity.CopyData<CatOrgStructureModel>();
                if (orgInfoEntity != null)
                {
                    model.ServicesType = orgInfoEntity.ServicesType;
                    model.BillingAddress = orgInfoEntity.BillingAddress;
                    model.ContractFrom = orgInfoEntity.ContractFrom;
                    model.ContractTo = orgInfoEntity.ContractTo;
                    model.BillingCompanyName = orgInfoEntity.BillingCompanyName;
                    model.TaxCode = orgInfoEntity.TaxCode;
                    model.DescriptionInfo = orgInfoEntity.Description;
                    model.DurationPay = orgInfoEntity.DurationPay;
                    model.RecipientInvoice = orgInfoEntity.RecipientInvoice;
                    model.TelePhone = orgInfoEntity.TelePhone;
                    model.CellPhone = orgInfoEntity.CellPhone;
                    model.EmailInfo = orgInfoEntity.Email;
                    model.OrgMoreInforID = (Guid?)orgInfoEntity.ID;
                }
            }
            model.ActionStatus = status;
            return model;
        }
        // GET api/<controller>/5
        public Cat_UnusualAllowanceCfgModel Get(Guid id)
        {
            var profileName = string.Empty;
            var service = new Cat_UnusualAllowanceCfgServices();
          
            ActionService actionService = new ActionService(UserLogin);
            var result = actionService.GetByIdUseStore<Cat_UnusualAllowanceCfgEntity>(id, ConstantSql.hrm_cat_sp_get_UnusualAllowanceCfgId, ref status);
            
            if (result == null)
            {
                return new Cat_UnusualAllowanceCfgModel();
            }
            
            var cat_UnsualAllowanceCfgEntity = new Cat_UnusualAllowanceCfgModel
            {
                ID = result.ID,
                Code = result.Code,
                Comment = result.Comment,
                UnusualAllowanceCfgName = result.UnusualAllowanceCfgName,
                IsAddToHourlyRate = result.IsAddToHourlyRate,
                IsChargePIT = result.IsChargePIT,
                IsExcludePayslip = result.IsExcludePayslip,
                MethodCalculation = result.MethodCalculation,
                Formula = result.Formula,
                EDType = result.EDType,
                Amount = result.Amount,
                Type = result.Type
            };
            return cat_UnsualAllowanceCfgEntity;

        }
        public Cat_RateInsuranceModel GetById(Guid id)
        {
            string status = string.Empty;
            var model = new Cat_RateInsuranceModel();
            ActionService service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<Cat_RateInsuranceEntity>(id, ConstantSql.hrm_cat_sp_get_RateInsuranceById, ref status);
            if (entity!=null)
            {
                model = entity.CopyData<Cat_RateInsuranceModel>();

                #region nhân 100 cho các tỉ lệ (để hiển thị %)
                if (model != null)
                {
                    model.SocialInsCompRate = model.SocialInsCompRate*100 ;
                    model.SocialInsEmpRate = model.SocialInsEmpRate * 100;
                    model.HealthInsCompRate = model.HealthInsCompRate * 100;
                    model.HealthInsEmpRate = model.HealthInsEmpRate * 100;
                    model.UnemployInsCompRate = model.UnemployInsCompRate * 100;
                    model.UnemployInsEmpRate = model.UnemployInsEmpRate * 100;
                }
                #endregion

            }
            model.ActionStatus = status;
            return model;
        }
        public Cat_RateInsuranceModel Post([Bind]Cat_RateInsuranceModel model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Cat_RateInsuranceModel>(model, "Cat_RateInsurance", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion
            ActionService service = new ActionService(UserLogin);

            #region chia 100 cho các tỉ lệ (để hiển thị %)
            if (model != null)
            {
                model.SocialInsCompRate = model.SocialInsCompRate / 100;
                model.SocialInsEmpRate = model.SocialInsEmpRate / 100;
                model.HealthInsCompRate = model.HealthInsCompRate / 100;
                model.HealthInsEmpRate = model.HealthInsEmpRate / 100;
                model.UnemployInsCompRate = model.UnemployInsCompRate / 100;
                model.UnemployInsEmpRate = model.UnemployInsEmpRate / 100;
            }
            #endregion

            return service.UpdateOrCreate<Cat_RateInsuranceEntity, Cat_RateInsuranceModel>(model);
        }
Beispiel #16
0
 /// <summary>
 /// [Chuc.Nguyen] - Xóa hoặc chuyển đổi trạng thái của Ngân Hàng(Tra_Certificate) sang IsDelete
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Tra_ClassModel DeleteOrRemove(string id)
 {
     var model = new Tra_ClassModel();
     ActionService service = new ActionService(UserLogin);
     var baseServices = new Tra_ClassServices();
     //var baseService = new BaseService();
     bool isDelete = true;
     string status = "";
     var idItem = id.Split(',');
     foreach (var item in idItem)
     {
         var idInt = Guid.Empty;
         Guid.TryParse(item, out idInt);
         if (idInt != Guid.Empty)
         {
             var objs = new List<object>();
             objs.Add(Guid.Parse(item));
             var result = baseServices.GetData<Tra_TraineeEntity>(objs, ConstantSql.hrm_cat_sp_get_TraineeByClassID, UserLogin, ref status);
             if (result != null && result.Count > 0)
             {
                 isDelete = false;
                 break;
             }
         }
     }
     if (isDelete)
         model = service.DeleteOrRemove<Tra_ClassEntity, Tra_ClassModel>(id);
     else
     {
         status = ConstantMessages.YouMustDeleteDetailRecord.TranslateString();
         model.SetPropertyValue(Constant.ActionStatus, status);
     }
     return model;
 }
 public FIN_ClaimCostPaymentApproveModel DeleteOrRemove(string id)
 {
     ActionService service = new ActionService(UserLogin);
     var result1 = service.DeleteOrRemove<FIN_ClaimEntity, FIN_ClaimModel>(id);
     var result = result1.CopyData<FIN_ClaimCostPaymentApproveModel>();
     return result;
 }
Beispiel #18
0
 /// <summary>
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Tra_ClassModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Tra_ClassModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Tra_ClassEntity>(id, ConstantSql.hrm_tra_sp_get_ClassById, ref status);
     if (entity!=null)
     {
         if (entity.TrainerOtherList != null)
             entity.TrainerOtherList = entity.TrainerOtherList.Replace(" ", "");
         model = entity.CopyData<Tra_ClassModel>();
         if(model.IsTrainingOut == false)
         {
             model.IsTrainingInside = true;
         }
             if (entity.Teacher != null)
             {
                 //Guid profileid = Guid.Parse(entity.Teacher);
                 var lstEntityprofile = service.GetData<Tra_RequirementTrainEntity>(entity.Teacher, ConstantSql.hrm_hr_sp_get_ProfileById, ref status);
                 if (lstEntityprofile!=null && lstEntityprofile.Count > 0)
                 {
                     var entityprofile = lstEntityprofile[0];
                     if (entityprofile != null && entityprofile.ProfileID != null && entityprofile.ProfileName != null)
                     {
                         model.ProfileID = entityprofile.ID;
                         model.ProfileName = entityprofile.ProfileName;
                         model.CodeEmp = entityprofile.CodeEmp;
                     }
                 }
                 
             }
     }
     model.ActionStatus = status;
     return model;
 }
Beispiel #19
0
 public Cat_HDTJobGroupModel Post([Bind]Cat_HDTJobGroupModel model)
 {
     #region Validate
     string message = string.Empty;
     var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Cat_HDTJobGroupModel>(model, "Cat_HDTJobGroup", ref message);
     if (!checkValidate)
     {
         model.ActionStatus = message;
         return model;
     }
     ActionService action = new ActionService(UserLogin);
     string status = string.Empty;
     if(model.ID!= null)
     {
         var resut = action.GetByIdUseStore<Cat_HDTJobGroupEntity>(model.ID, ConstantSql.hrm_cat_sp_get_HDTJobGroupById, ref status);
         if (resut != null && resut.Status == EnumDropDown.Status.E_APPROVED.ToString())
         {
             model.ActionStatus = ConstantDisplay.StatusApproveCannotEdit.TranslateString();
             return model;
         }
     }
     #endregion
     ActionService service = new ActionService(UserLogin);
     return service.UpdateOrCreate<Cat_HDTJobGroupEntity, Cat_HDTJobGroupModel>(model);
 }
Beispiel #20
0
        public Att_LeaveDayModel GetById(Guid id)
        {
            string status = string.Empty;
            var model = new Att_LeaveDayModel();
            ActionService service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<Att_LeaveDayEntity>(id, ConstantSql.hrm_att_sp_get_LeaveDayById, ref status);
            if (entity != null)
            {
                model = entity.CopyData<Att_LeaveDayModel>();
                if (model.LeaveHours != null && model.LeaveHours > 0)
                {
                    if (model.DurationType == LeaveDayDurationType.E_FIRSTHALFSHIFT.ToString() || model.DurationType == LeaveDayDurationType.E_LASTHALFSHIFT.ToString())
                    {
                        var guiId = model.ProfileID;
                        var start = model.DateStart;
                        var end = model.DateEnd;
                        if (guiId != null && guiId != Guid.Empty && start != null && end != null)
                        {
                            var listRoster = service.GetData<Att_RosterEntity>(guiId, ConstantSql.hrm_att_sp_get_RosterByProfileId, ref status);
                            if (listRoster != null)
                            {
                                for (DateTime i = start; i <= end; i = i.AddDays(1))
                                {
                                    var roster = listRoster.Where(d => d.DateStart <= i && d.DateEnd >= i).FirstOrDefault();
                                    if (roster != null)
                                    {
                                        var shift = SearchShift(roster, i);
                                        if (shift != null && shift != Guid.Empty)
                                        {
                                            var catShift = service.GetByIdUseStore<Cat_ShiftEntity>((Guid)shift, ConstantSql.hrm_cat_sp_get_ShiftById, ref status);
                                            if (catShift != null)
                                            {
                                                if (model.DurationType == LeaveDayDurationType.E_FIRSTHALFSHIFT.ToString())
                                                {
                                                    model.HoursFrom = catShift.InTime;
                                                    model.HoursTo = catShift.InTime.AddHours(catShift.CoBreakOut);
                                                    break;
                                                }
                                                else
                                                {
                                                    model.HoursFrom = catShift.InTime.AddHours(catShift.CoBreakIn);
                                                    model.HoursTo = catShift.InTime.AddHours(catShift.CoOut);
                                                    break;
                                                }
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
            model.ActionStatus = status;
            return model;

        }
Beispiel #21
0
 /// <summary>
 /// [Tin.Nguyen] - Xóa hoặc chuyển đổi trạng thái của Dân Tộc(Cat_ExportItem) sang IsDelete
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Sys_AutoBackupModel DeleteOrRemove(string id)
 {
     //var spitId = id.Split(',');
     var model = new Sys_AutoBackupModel();
     //LibraryService.StartTaskScheduler(Common.ConvertToGuid(spitId[1]));
     ActionService service = new ActionService(UserLogin);
     var result = service.DeleteOrRemove<Sys_AutoBackupEntity, Sys_AutoBackupModel>(id);
     return model;
 }
Beispiel #22
0
 /// <summary>
 /// [Son.Vo] - Xóa hoặc chuyển đổi trạng thái của Att_RosterGroup (Att_RosterGroup) sang IsDelete
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Att_RosterGroupModel DeleteOrRemove(string id)
 {
     ActionService service = new ActionService(UserLogin);
     var result = service.DeleteOrRemove<Att_RosterGroupEntity, Att_RosterGroupModel>(id);
     return result;
     //Att_RosterGroupServices service = new Att_RosterGroupServices();
     //var result = service.Remove<Att_RosterGroupEntity>(id);
     //return new Att_RosterGroupModel();
 }
Beispiel #23
0
        /// <summary>
        /// [Son.Vo] - Xóa hoặc chuyển đổi trạng thái của OrgStructure(Cat_OrgStructure) sang IsDelete
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public CatOrgStructureModel DeleteOrRemove(string id)
        {
            //Xóa cache lưu lại của cây phòng ban
            HttpContext.Current.Cache.Remove("List_OrgStructureTreeView");
            HttpContext.Current.Cache.Remove("List_OrgStructureTreeViewSumProfile");

            ActionService service = new ActionService(UserLogin);
            var result = service.DeleteOrRemove<Cat_OrgStructureEntity, CatOrgStructureModel>(id);
            return result;
        }
 public Cat_GradeAttendanceModel Post([Bind]Cat_GradeAttendanceModel model)
 {
     model.RosterType = GradeRosterType.E_ISROSTER.ToString();
     ActionService service = new ActionService(UserLogin);
     if (model.FormulaAnnualLeave != null)
     {
         model.FormulaAnnualLeave = model.FormulaAnnualLeave.Replace("[+]", "+");
     }
     return service.UpdateOrCreate<Cat_GradeAttendanceEntity, Cat_GradeAttendanceModel>(model);
 }
Beispiel #25
0
        public ActionResult GetCan_SumryMealRecord([DataSourceRequest] DataSourceRequest request, Can_SumryMealRecordSearchModel model)
        {
            ActionService action = new ActionService(UserLogin);
            string status = string.Empty;
            var Cutoffduration = action.GetByIdUseStore<Att_CutOffDurationEntity>((Guid)model.CutoffdurationID, ConstantSql.hrm_att_sp_get_CutOffDurationById, ref status);

            model.DateFrom = Cutoffduration.DateStart;
            model.DateTo = Cutoffduration.DateEnd;

            return GetListDataAndReturn<Can_SumryMealRecordModel, Can_SumryMealRecordEntity, Can_SumryMealRecordSearchModel>(request, model, ConstantSql.hrm_can_sp_get_SumMealRecord);
        }
        public void GetHost_SomeName_SomeHost()
        {
            var data = JsonConvert.DeserializeObject<Entities.Action[]>(File.ReadAllText(_actionGet), _settings);

            _context.Stub(x => x.SendRequest<Entities.Action[]>(Arg<object>.Is.Anything, Arg<string>.Is.Anything)).Return(data);

            var target = new ActionService(_context) as IActionService;

            var result = target.Get();

            Assert.AreEqual(5, result.Count());
        }
Beispiel #27
0
 /// <summary>
 /// Chú ý là mượn page để get list Master
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public List<Rep_MasterModel> GetById(Guid id)
 {
     string status = string.Empty;
     var model = new List<Rep_MasterModel>();
     ActionService service = new ActionService(UserLogin);
     var listModel = new List<object>();
     listModel.AddRange(new object[3]);
     listModel[1] = 1;
     listModel[2] = Int32.MaxValue - 1;
     var entity = service.GetData<Rep_MasterModel>(listModel, ConstantSql.hrm_rep_sp_get_Master, ref status);
     return entity != null ? entity.ToList() : new List<Rep_MasterModel>();
 }
Beispiel #28
0
        public Sys_AllSettingModel Get(string id)
        {
            string status = string.Empty;
            ActionService service = new ActionService(UserLogin);
            var model = service.GetFirstData<Sys_AllSettingModel>(id, ConstantSql.hrm_sys_sp_get_AllSettingByKey, ref status);
            if (model != null)
            {
                return (Sys_AllSettingModel)model;
            }

            return null;
        }
 /// <summary>
 /// [Quoc.Do] - Lấy dữ liệu Mức Độ Trợ Cấp( Cat_UsualAllowanceLevel) theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_UsualAllowanceLevelModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Cat_UsualAllowanceLevelModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Cat_UsualAllowanceLevelEntity>(id, ConstantSql.hrm_cat_sp_get_UsualAllowanceLevelById, ref status);
     if (entity!=null)
     {
         model = entity.CopyData<Cat_UsualAllowanceLevelModel>();
     }
     model.ActionStatus = status;
     return model;
 }
Beispiel #30
0
 public Rec_TagModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Rec_TagModel();
     var service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Rec_TagEntity>(id, ConstantSql.hrm_rec_sp_get_TagById, ref status);
     if (entity != null)
     {
         model = entity.CopyData<Rec_TagModel>();
     }
     model.ActionStatus = status;
     return model;
 }
Beispiel #31
0
        public Att_RosterModel Post([Bind] Att_RosterModel model)
        {
            ActionService service               = new ActionService(UserLogin);
            var           baseService           = new BaseService();
            string        status                = string.Empty;
            var           hrService             = new Hre_ProfileServices();
            string        strMessages           = string.Empty;
            var           rosterService         = new Att_RosterServices();
            var           sysAllSetttingService = new Sys_AllSettingServices();

            #region Validate
            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Att_RosterModel>(model, "Att_Roster", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Att_RosterModel>(model, "Att_ProfileNotRoster", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            if (string.IsNullOrEmpty(model.OrgStructureIDs) && string.IsNullOrEmpty(model.ProfileIds) && model.ProfileID == Guid.Empty)
            {
                message            = string.Format(ConstantMessages.FieldNotAllowNull.TranslateString(), ("ProfileID").TranslateString());
                model.ActionStatus = message;
                return(model);
            }
            #endregion

            List <Guid> lstProfileIDs = new List <Guid>();

            if (!string.IsNullOrEmpty(model.OrgStructureIDs))
            {
                List <object> listObj = new List <object>();
                listObj.Add(model.OrgStructureIDs);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData <Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, UserLogin, ref status).Select(s => s.ID).ToList();
                lstProfileIDs.AddRange(lstProfile);
            }
            else if (model.ProfileIds != null && model.ProfileIds != "")
            {
                var listGuid = model.ProfileIds.Split(',').Select(s => Guid.Parse(s)).ToArray();
                lstProfileIDs.AddRange(listGuid);
            }
            var lstRosterEntity_Validate = new List <Att_RosterEntity>();
            foreach (var item in lstProfileIDs)
            {
                Att_RosterEntity rosterEntity = model.CopyData <Att_RosterEntity>();
                rosterEntity.ProfileID = item;
                if (rosterEntity.ID != null && rosterEntity.ID != Guid.Empty)
                {
                }
                else
                {
                    rosterEntity.ID = Guid.NewGuid();
                }
                lstRosterEntity_Validate.Add(rosterEntity);
            }
            var key = AppConfig.HRM_ATT_ALLOWSAVEDUPLICATE.ToString();
            var lstSysAllSetting = sysAllSetttingService.GetData <Sys_AllSettingEntity>(key, ConstantSql.hrm_sys_sp_get_AllSettingByKey, UserLogin, ref status).FirstOrDefault();


            var ValidateLess12Hour = AppConfig.HRM_ATT_VALIDATE_ROSTER_NON_CONTINUE_12HOUR.ToString();
            var lstSysSetting_ValidateLess12Hour = sysAllSetttingService.GetData <Sys_AllSettingEntity>(ValidateLess12Hour, ConstantSql.hrm_sys_sp_get_AllSettingByKey, UserLogin, ref status).FirstOrDefault();
            if (lstSysSetting_ValidateLess12Hour != null && lstSysSetting_ValidateLess12Hour.Value1 == bool.TrueString)
            {
                string Err = string.Empty;
                Err = rosterService.ValidateShiftHourContinue(lstRosterEntity_Validate);
                if (Err != string.Empty)
                {
                    model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error + "," + Err);
                    return(model);
                }
            }

            if (!string.IsNullOrEmpty(model.OrgStructureIDs))
            {
                List <object> listObj = new List <object>();
                listObj.Add(model.OrgStructureIDs);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData <Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, UserLogin, ref status).Select(s => s.ID).ToList();
                if (lstProfile.Count == 0 || lstProfile == null)
                {
                    model.SetPropertyValue(Constant.ActionStatus, NotificationType.Info + "," + strMessages + ConstantMessages.FieldDuplicate);
                    return(model);
                }
                if (lstProfile != null && model.ProfileIds != null)
                {
                    Guid[] listGuid = null;
                    listGuid   = model.ProfileIds.Split(',').Select(s => Guid.Parse(s)).ToArray();
                    lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                }
                List <Att_RosterEntity> lstRosterEntity = new List <Att_RosterEntity>();
                List <object>           paraRoster      = new List <object>();
                paraRoster.AddRange(new object[4]);
                paraRoster[0] = (object)model.OrgStructureIDs;
                paraRoster[1] = null;
                paraRoster[2] = null;
                paraRoster[3] = null;
                var listRosterData = rosterService.GetData <Att_RosterEntity>(paraRoster, ConstantSql.hrm_att_getdata_Roster, UserLogin, ref status);
                foreach (var item in lstProfile)
                {
                    Att_RosterModel modelSave  = model.CopyData <Att_RosterModel>();
                    var             listRoster = listRosterData.Where(s => s.ProfileID == item);
                    if (modelSave.Type != RosterType.E_CHANGE_SHIFT.ToString() &&
                        modelSave.Type != RosterType.E_TIME_OFF.ToString() &&
                        listRoster != null &&
                        listRoster.Any(d => d.DateStart <= model.DateEnd && d.DateEnd >= model.DateStart))
                    {
                        strMessages += listRoster.FirstOrDefault().ProfileName + ", ";
                        continue;
                    }
                    modelSave.ProfileID = item;
                    Att_RosterEntity rosterEntity = modelSave.CopyData <Att_RosterEntity>();
                    lstRosterEntity.Add(rosterEntity);
                }
                if (strMessages == "" && lstRosterEntity.Count > 0)
                {
                    model.ActionStatus = rosterService.Add(lstRosterEntity);
                }
                else
                {
                    if (lstSysAllSetting != null && lstSysAllSetting.Value1 == bool.TrueString && lstRosterEntity.Count > 0)
                    {
                        model.ActionStatus = rosterService.Add(lstRosterEntity);
                    }
                    else if (lstSysAllSetting.Value1 == bool.FalseString)
                    {
                        model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error + "," + strMessages + ConstantMessages.FieldDuplicate);
                        return(model);
                    }
                    else if (lstRosterEntity.Count == 0)
                    {
                        model.SetPropertyValue(Constant.ActionStatus, NotificationType.Info + "," + strMessages + ConstantMessages.FieldDuplicate);
                        return(model);
                    }
                }
                return(model);
            }
            //Xử lý khi chọn nhiều nhân viên
            if (model.ProfileIds != null && model.ProfileIds.IndexOf(',') > 0 && model.OrgStructureIDs == null)
            {
                Guid[] listGuid = null;
                listGuid = model.ProfileIds.Split(',').Select(s => Guid.Parse(s)).ToArray();
                List <Att_RosterEntity> lstRosterEntity = new List <Att_RosterEntity>();
                foreach (var item in listGuid)
                {
                    Att_RosterModel modelSave  = model.CopyData <Att_RosterModel>();
                    var             listRoster = service.GetData <Att_RosterEntity>(item, ConstantSql.hrm_att_sp_get_RosterByProfileId, ref status);
                    if (modelSave.Type != RosterType.E_CHANGE_SHIFT.ToString() &&
                        modelSave.Type != RosterType.E_TIME_OFF.ToString() &&
                        listRoster != null &&
                        listRoster.Any(d => d.DateStart <= model.DateEnd && d.DateEnd >= model.DateStart))
                    {
                        strMessages += listRoster.FirstOrDefault().ProfileName + ", ";
                        continue;
                    }
                    modelSave.ProfileID = item;
                    Att_RosterEntity rosterEntity = modelSave.CopyData <Att_RosterEntity>();
                    lstRosterEntity.Add(rosterEntity);
                }
                if (strMessages == "")
                {
                    model.ActionStatus = rosterService.Add(lstRosterEntity);
                }
                else
                {
                    if (lstSysAllSetting != null && lstSysAllSetting.Value1 == bool.TrueString)
                    {
                        model.ActionStatus = rosterService.Add(lstRosterEntity);
                    }
                    else
                    {
                        model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error + "," + strMessages + ConstantMessages.FieldDuplicate);
                        return(model);
                    }
                }
                return(model);
            }
            //Xử lý khi chỉ chọn 1 nhân viên
            if (model.ID == Guid.Empty)
            {
                var lstRoster = service.GetData <Att_RosterEntity>(model.ProfileID, ConstantSql.hrm_att_sp_get_RosterByProfileId, ref status);
                if (model.Type != RosterType.E_CHANGE_SHIFT.ToString() &&
                    model.Type != RosterType.E_TIME_OFF.ToString() &&
                    lstRoster != null &&
                    lstRoster.Any(d => d.DateStart <= model.DateEnd && d.DateEnd >= model.DateStart))
                {
                    strMessages = lstRoster.FirstOrDefault().ProfileName + ",";
                    model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error + "," + strMessages + ConstantMessages.FieldDuplicate);
                    return(model);
                }
                return(service.UpdateOrCreate <Att_RosterEntity, Att_RosterModel>(model));
            }
            return(service.UpdateOrCreate <Att_RosterEntity, Att_RosterModel>(model));
        }
Beispiel #32
0
 public ActionServiceTest()
 {
     _logger = A.Fake <ILogger <ActionService> >();
     _target = new ActionService(_context, _logger);
 }
Beispiel #33
0
        /// <summary>
        /// Xử lí eidt và add new truyền theo script
        /// </summary>
        /// <param name="contract"></param>
        /// <returns></returns>
        public Can_TamScanLogModel Post(Can_TamScanLogModel model)
        {
            ActionService service = new ActionService(UserLogin);

            return(service.UpdateOrCreate <Can_TamScanLogEntity, Can_TamScanLogModel>(model));
        }
Beispiel #34
0
        public CatExportItemModel Post([Bind] CatExportItemModel model)
        {
            ActionService service = new ActionService(UserLogin);

            return(service.UpdateOrCreate <Cat_ExportItemEntity, CatExportItemModel>(model));
        }
Beispiel #35
0
        public CatElementModel Post([Bind] CatElementModel model)
        {
            ActionService service = new ActionService(UserLogin);

            string status = string.Empty;

            //#region Validate
            //string message = string.Empty;
            //var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<CatElementModel>(model, "Cat_Element", ref message);
            //if (!checkValidate)
            //{
            //    model.ActionStatus = message;
            //    return model;
            //}
            //#endregion
            if (model.IsSalaryTime)
            {
                CatElementModel SalaryTimeModel = new CatElementModel();
                SalaryTimeModel.ElementCode    = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_TIME.ToString();
                SalaryTimeModel.MethodPayroll  = MethodPayroll.E_NORMAL.ToString();
                SalaryTimeModel.ElementName    = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryTime.ToString();
                SalaryTimeModel.GradePayrollID = model.GradePayrollID.Value;
                SalaryTimeModel.Formula        = "([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "*" + "[" + PayrollElement.ATT_WORKING_DAY + "]";
                return(service.UpdateOrCreate <Cat_ElementEntity, CatElementModel>(SalaryTimeModel));
            }
            if (model.IsSalaryOvertime)
            {
                CatElementModel SalaryOvertimeModel = new CatElementModel();
                SalaryOvertimeModel.ElementCode    = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_OVERTIME.ToString();
                SalaryOvertimeModel.MethodPayroll  = MethodPayroll.E_NORMAL.ToString();
                SalaryOvertimeModel.ElementName    = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryOvertime.ToString();
                SalaryOvertimeModel.GradePayrollID = model.GradePayrollID.Value;
                SalaryOvertimeModel.Formula        = "(([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "/" + "[" + PayrollElement.ATT_HOURS_PER_DAY + "])" + "*" + "[" + PayrollElement.ATT_OVERTIME_HOURS + "]";
                return(service.UpdateOrCreate <Cat_ElementEntity, CatElementModel>(SalaryOvertimeModel));
            }

            if (model.IsSalaryLeaveDay)
            {
                CatElementModel SalaryLeaveDayModel = new CatElementModel();
                SalaryLeaveDayModel.ElementCode    = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_LEAVEDAY.ToString();
                SalaryLeaveDayModel.MethodPayroll  = MethodPayroll.E_NORMAL.ToString();
                SalaryLeaveDayModel.ElementName    = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryLeaveDay.ToString();
                SalaryLeaveDayModel.GradePayrollID = model.GradePayrollID.Value;
                SalaryLeaveDayModel.Formula        = "(([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "/" + "[" + PayrollElement.ATT_HOURS_PER_DAY + "])" + "*" + "[" + PayrollElement.ATT_TOTAL_PAID_LEAVEDAY_HOURS + "]";

                return(service.UpdateOrCreate <Cat_ElementEntity, CatElementModel>(SalaryLeaveDayModel));
            }

            if (model.IsSalaryUsualAllowance)
            {
                var UsualAllowanceServices = new Cat_UnusualAllowanceCfgServices();
                var elementServices        = new Cat_ElementServices();
                var lstObj = new List <object>();
                lstObj.Add(null);
                lstObj.Add(null);
                lstObj.Add(1);
                lstObj.Add(int.MaxValue - 1);

                var lstUsualAllowance = UsualAllowanceServices.GetData <Cat_UsualAllowanceEntity>(lstObj, ConstantSql.hrm_cat_sp_get_UsualAllowance, UserLogin, ref status).ToList();

                if (lstUsualAllowance != null)
                {
                    List <CatElementModel> lstElement = new List <CatElementModel>();
                    foreach (var item in lstUsualAllowance)
                    {
                        CatElementModel SalaryUsualAllowanceModel = new CatElementModel();
                        SalaryUsualAllowanceModel.ElementCode    = item.Code;
                        SalaryUsualAllowanceModel.MethodPayroll  = MethodPayroll.E_NORMAL.ToString();
                        SalaryUsualAllowanceModel.ElementName    = item.UsualAllowanceName;
                        SalaryUsualAllowanceModel.GradePayrollID = model.GradePayrollID.Value;
                        SalaryUsualAllowanceModel.Formula        = "[" + item.Code + "]";
                        lstElement.Add(SalaryUsualAllowanceModel);
                    }
                    if (lstElement != null)
                    {
                        model.ActionStatus = elementServices.Add(lstElement);
                    }
                }
                return(model);
            }

            return(null);
        }
Beispiel #36
0
        public void GetDoesNotExist()
        {
            ActionService ActionService = new ActionService(_context);

            Assert.Throws <NotFoundInDBException>(() => ActionService.GetAction("some_action_id_that_does_not_exist"));
        }
Beispiel #37
0
 public override GameAction OnExecute(AgricolaPlayer player, Data.GameActionData data)
 {
     ActionService.BuildFences(player, eventTriggers, ResultingNotices, (BuildFencesActionData)data, pastures.ToImmutableArray());
     return(this);
 }
Beispiel #38
0
 public Task CreateAction([Remainder] string text) => ActionService.CreateAction(text, Context);
        public Sal_InsuranceSalaryModel Post([Bind] Sal_InsuranceSalaryModel model)
        {
            #region Validate

            ActionService service       = new ActionService(UserLogin);
            string        message       = string.Empty;
            bool          checkValidate = true;
            if (model.IsCreateByProfile != null && model.IsCreateByProfile == true)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalaryByProfile", ref message);
                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return(model);
                }
                return(service.UpdateOrCreate <Sal_InsuranceSalaryEntity, Sal_InsuranceSalaryModel>(model));
            }

            //var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalary", ref message);
            if (model.OrgStructureID != null && model.OrgStructureID != string.Empty)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalaryOrgStructure", ref message);
            }
            else
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalary", ref message);
            }
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion

            string status = string.Empty;

            var hrService         = new Hre_ProfileServices();
            var insuranceServices = new Sal_InsuranceSalaryServices();
            if (!string.IsNullOrEmpty(model.OrgStructureID))
            {
                List <Guid> listGuid = new List <Guid>();
                if (model.ProfileIDsExclude != null)
                {
                    var listStr = model.ProfileIDsExclude.Split(',');

                    if (listStr[0] != "")
                    {
                        foreach (var item in listStr)
                        {
                            listGuid.Add(Guid.Parse(item));
                        }
                    }
                }


                List <object> listObj = new List <object>();
                listObj.Add(model.OrgStructureID);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData <Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, userLogin, ref status).Select(s => s.ID).ToList();
                if (listGuid != null)
                {
                    lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                }

                if (lstProfile.Count == 0 && model.ProfileID == Guid.Empty)
                {
                    model.ActionStatus = ConstantDisplay.HRM_Common_NotEmployee.TranslateString();
                    return(model);
                }

                List <Sal_InsuranceSalaryEntity> lstGradeEntity = new List <Sal_InsuranceSalaryEntity>();

                foreach (var item in lstProfile)
                {
                    Sal_InsuranceSalaryEntity gradeEntity = new Sal_InsuranceSalaryEntity
                    {
                        ProfileID       = item,
                        DateCreate      = model.DateCreate,
                        DateLock        = model.DateLock,
                        CurrencyID      = model.CurrencyID,
                        InsuranceAmount = model.InsuranceAmount,
                        ID                = model.ID,
                        DateEffect        = model.DateEffect,
                        IsSocialIns       = model.IsSocialIns,
                        IsMedicalIns      = model.IsMedicalIns,
                        IsUnimploymentIns = model.IsUnimploymentIns,
                        IsDelete          = model.IsDelete,
                        UserUpdate        = model.UserCreate,
                        UserCreate        = model.UserCreate,
                        DecisionNo        = model.DecisionNo
                    };
                    //model.ActionStatus =  gradeServices.Add(gradeEntity);
                    lstGradeEntity.Add(gradeEntity);
                }
                model.ActionStatus = insuranceServices.Add(lstGradeEntity);
                return(model);
            }
            if (!string.IsNullOrEmpty(model.ProfileIDs))
            {
                var         listStr  = model.ProfileIDs.Split(',');
                List <Guid> listGuid = new List <Guid>();
                if (listStr[0] != "")
                {
                    foreach (var item in listStr)
                    {
                        listGuid.Add(Guid.Parse(item));
                    }
                }
                List <Sal_InsuranceSalaryEntity> lstGradeEntity = new List <Sal_InsuranceSalaryEntity>();
                foreach (var item in listGuid)
                {
                    Sal_InsuranceSalaryEntity gradeEntity = new Sal_InsuranceSalaryEntity
                    {
                        ProfileID       = item,
                        DateCreate      = model.DateCreate,
                        DateLock        = model.DateLock,
                        CurrencyID      = model.CurrencyID,
                        InsuranceAmount = model.InsuranceAmount,
                        ID                = model.ID,
                        DateEffect        = model.DateEffect,
                        IsSocialIns       = model.IsSocialIns,
                        IsMedicalIns      = model.IsMedicalIns,
                        IsUnimploymentIns = model.IsUnimploymentIns,
                        IsDelete          = model.IsDelete,
                        UserUpdate        = model.UserCreate,
                        UserCreate        = model.UserCreate,
                        DecisionNo        = model.DecisionNo
                    };
                    //model.ActionStatus =  gradeServices.Add(gradeEntity);
                    lstGradeEntity.Add(gradeEntity);
                }
                model.ActionStatus = insuranceServices.Add(lstGradeEntity);
                return(model);
            }

            return(service.UpdateOrCreate <Sal_InsuranceSalaryEntity, Sal_InsuranceSalaryModel>(model));
        }
Beispiel #40
0
 protected override BotCommandAction GetAction()
 {
     return(ActionService.GetAll().OfType <BotCommandAction>().FirstOrDefault(a =>
                                                                              a.UserCommandProperties != null && a.UserCommandProperties.Name == Interaction.Data.Name));
 }
Beispiel #41
0
 public override GameAction OnExecute(AgricolaPlayer player, GameActionData data)
 {
     base.OnExecute(player, data);
     ActionService.AssignTakeResources(player, eventTriggers, ResultingNotices, Caches);
     return(this);
 }
Beispiel #42
0
        public Att_TimeSheetModel Post([Bind] Att_TimeSheetModel model)
        {
            #region Validate
            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Att_TimeSheetModel>(model, "Att_TimeSheet", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion

            ActionService service           = new ActionService(UserLogin);
            string        status            = string.Empty;
            var           hrService         = new Hre_ProfileServices();
            var           timeSheetServices = new Att_TimeSheetServices();
            if (!string.IsNullOrEmpty(model.OrgStructureID))
            {
                List <Guid> listGuid = new List <Guid>();
                if (model.ProfileIDs != null)
                {
                    var listStr = model.ProfileIDs.Split(',');

                    if (listStr[0] != "")
                    {
                        foreach (var item in listStr)
                        {
                            listGuid.Add(Guid.Parse(item));
                        }
                    }
                }

                List <object> listObj = new List <object>();
                listObj.Add(model.OrgStructureID);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData <Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, UserLogin, ref status).Select(s => s.ID).ToList();
                if (listGuid != null)
                {
                    lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                }

                List <Att_TimeSheetEntity> lstTimeSheetEntity = new List <Att_TimeSheetEntity>();

                foreach (var item in lstProfile)
                {
                    Att_TimeSheetEntity timeSheetEntity = new Att_TimeSheetEntity
                    {
                        ProfileID  = item,
                        DateCreate = model.DateCreate,
                        DateLock   = model.DateLock,
                        RoleID     = model.RoleID,
                        JobTypeID  = model.JobTypeID,
                        ID         = model.ID,
                        NoHour     = model.NoHour,
                        Date       = model.Date,
                        Sector     = model.Sector,
                        Note       = model.Note,
                        IsDelete   = model.IsDelete,
                        UserUpdate = model.UserCreate,
                        UserCreate = model.UserCreate,
                    };
                    lstTimeSheetEntity.Add(timeSheetEntity);
                }
                model.ActionStatus = timeSheetServices.Add(lstTimeSheetEntity);
                return(model);
            }
            if (model.ProfileIDs != null && model.ProfileIDs.IndexOf(',') > 0)
            {
                var         listStr  = model.ProfileIDs.Split(',');
                List <Guid> listGuid = new List <Guid>();
                if (listStr[0] != "")
                {
                    foreach (var item in listStr)
                    {
                        listGuid.Add(Guid.Parse(item));
                    }
                }
                List <Att_TimeSheetEntity> lstTimeSheetEntity = new List <Att_TimeSheetEntity>();
                foreach (var item in listGuid)
                {
                    Att_TimeSheetEntity TimeSheetEntity = new Att_TimeSheetEntity
                    {
                        ProfileID  = item,
                        DateCreate = model.DateCreate,
                        DateLock   = model.DateLock,
                        RoleID     = model.RoleID,
                        JobTypeID  = model.JobTypeID,
                        ID         = model.ID,
                        NoHour     = model.NoHour,
                        Date       = model.Date,
                        Note       = model.Note,
                        Sector     = model.Sector,
                        IsDelete   = model.IsDelete,
                        UserUpdate = model.UserCreate,
                        UserCreate = model.UserCreate,
                    };
                    lstTimeSheetEntity.Add(TimeSheetEntity);
                }
                model.ActionStatus = timeSheetServices.Add(lstTimeSheetEntity);
                return(model);
            }

            return(service.UpdateOrCreate <Att_TimeSheetEntity, Att_TimeSheetModel>(model));
        }
Beispiel #43
0
 public Task UseAction([Remainder] string text) => ActionService.UseAction(Context, text);
Beispiel #44
0
        public Sal_GradeModel Post([Bind] Sal_GradeModel model)
        {
            #region Validate
            ActionService service       = new ActionService(UserLogin);
            string        message       = string.Empty;
            var           checkValidate = false;
            if (model.IsProfileNotGrade)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Sal_GradeModel>(model, "Sal_Grade", ref message);
            }
            else if (model.IsCreateByProfile)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Sal_GradeModel>(model, "Sal_GradeByProfile", ref message);
                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return(model);
                }
                return(service.UpdateOrCreate <Sal_GradeEntity, Sal_GradeModel>(model));
            }
            else
            {
                if (model.OrgStructureID != null && model.OrgStructureID != string.Empty)
                {
                    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Sal_GradeModel>(model, "Sal_GradeOrg", ref message);
                }
                else
                {
                    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Sal_GradeModel>(model, "Sal_Grade", ref message);
                }
            }
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion


            string status = string.Empty;
            //string message = string.Empty;
            var hrService     = new Hre_ProfileServices();
            var gradeServices = new Sal_GradeServices();
            if (!string.IsNullOrEmpty(model.OrgStructureID))
            {
                List <Guid> listGuid = new List <Guid>();
                if (model.ProfileIDsExclude != null)
                {
                    var listStr = model.ProfileIDsExclude.Split(',');

                    if (listStr[0] != "")
                    {
                        foreach (var item in listStr)
                        {
                            listGuid.Add(Guid.Parse(item));
                        }
                    }
                }
                List <object> listObj = new List <object>();
                listObj.Add(model.OrgStructureID);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData <Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, userLogin, ref status).Select(s => s.ID).ToList();
                if (listGuid != null)
                {
                    lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                }
                if (lstProfile.Count == 0 && model.ProfileID == Guid.Empty)
                {
                    model.ActionStatus = ConstantDisplay.HRM_Common_NotEmployee.TranslateString();
                    return(model);
                }

                List <Sal_GradeEntity> lstGradeEntity = new List <Sal_GradeEntity>();

                foreach (var item in lstProfile)
                {
                    Sal_GradeEntity gradeEntity = new Sal_GradeEntity
                    {
                        ProfileID      = item,
                        DateCreate     = model.DateCreate,
                        DateLock       = model.DateLock,
                        GradeCfgName   = model.GradeCfgName,
                        GradePayrollID = model.GradePayrollID,
                        ID             = model.ID,
                        MonthEnd       = model.MonthEnd,
                        MonthStart     = model.MonthStart,
                        IsDelete       = model.IsDelete,
                        UserUpdate     = model.UserCreate,
                        UserCreate     = model.UserCreate,
                    };
                    //model.ActionStatus =  gradeServices.Add(gradeEntity);
                    lstGradeEntity.Add(gradeEntity);
                }
                model.ActionStatus = gradeServices.Add(lstGradeEntity);
                return(model);
            }
            if (model.ProfileIDs != null && model.ProfileIDs != string.Empty)
            {
                var         listStr  = model.ProfileIDs.Split(',');
                List <Guid> listGuid = new List <Guid>();
                if (listStr[0] != "")
                {
                    foreach (var item in listStr)
                    {
                        listGuid.Add(Guid.Parse(item));
                    }
                }
                else
                {
                    model.ActionStatus = ConstantDisplay.HRM_Common_NotEmployee.TranslateString();
                    return(model);
                }
                List <Sal_GradeEntity> lstGradeEntity = new List <Sal_GradeEntity>();
                foreach (var item in listGuid)
                {
                    Sal_GradeEntity gradeEntity = new Sal_GradeEntity
                    {
                        ProfileID      = item,
                        DateCreate     = model.DateCreate,
                        DateLock       = model.DateLock,
                        GradeCfgName   = model.GradeCfgName,
                        GradePayrollID = model.GradePayrollID,
                        ID             = model.ID,
                        MonthEnd       = model.MonthEnd,
                        MonthStart     = model.MonthStart,
                        IsDelete       = model.IsDelete,
                        UserUpdate     = model.UserCreate,
                        UserCreate     = model.UserCreate,
                    };
                    //model.ActionStatus =  gradeServices.Add(gradeEntity);
                    lstGradeEntity.Add(gradeEntity);
                }
                model.ActionStatus = gradeServices.Add(lstGradeEntity);
                return(model);
            }
            if (model.ProfileID == Guid.Empty)
            {
                model.ActionStatus = ConstantDisplay.HRM_Common_NotEmployee.TranslateString();
                return(model);
            }
            return(service.UpdateOrCreate <Sal_GradeEntity, Sal_GradeModel>(model));
        }
Beispiel #45
0
 public override bool CanExecute(AgricolaPlayer player, Data.GameActionData data)
 {
     ResourceCache[] costs;
     return(ActionService.CanBuildFences(player, Id, (BuildFencesActionData)data, out pastures, out costs));
 }
Beispiel #46
0
        [TestCase("API Endpoints", "API Resource Endpoint,API Spreadsheet Endpoint", true)] //#27489
        public void Test_GetActions_Security_Create(string reportName, string typeNames, bool admin)
        {
            ActionRequestExtended actionRequest;
            ActionResponse        response;
            Report      report;
            UserAccount userAccount;
            IList <ActionMenuItemInfo> flattenedResults;

            string[]        splitTypeNames;
            SecurableEntity securableEntity;

            splitTypeNames = typeNames.Split(',');

            userAccount      = Entity.Create <UserAccount>();
            userAccount.Name = "Action service test " + Guid.NewGuid( ).ToString( );
            userAccount.Save();

            new AccessRuleFactory( ).AddAllowReadQuery(
                userAccount.As <Subject>( ),
                Entity.Get <SecurableEntity>(Entity.Get <EntityType>("core:report")),
                TestQueries.Entities(new EntityRef("core:report")).ToReport( ));

            if (!string.IsNullOrWhiteSpace(typeNames))
            {
                foreach (string typeName in splitTypeNames)
                {
                    securableEntity = Entity.GetByName <SecurableEntity>(typeName).FirstOrDefault();
                    Assert.That(securableEntity, Is.Not.Null,
                                string.Format("{0} is not a type", typeName));

                    new AccessRuleFactory().AddAllowCreate(
                        userAccount.As <Subject>(),
                        securableEntity);
                }
            }

            report = Entity.GetByName <Report>(reportName).FirstOrDefault();
            Assert.That(report, Is.Not.Null, string.Format("{0} is not a report", reportName));

            actionRequest = new ActionRequestExtended
            {
                SelectedResourceIds    = new long[0],
                LastSelectedResourceId = 0,
                CellSelectedResourceId = -1,
                ReportId             = report.Id,
                HostResourceIds      = new long[0],
                HostTypeIds          = new List <long>(),
                AdditionalData       = new Dictionary <string, object>(),
                ActionDisplayContext = ActionContext.ActionsMenu
            };

            if (admin)
            {
                response = new ActionService( ).GetActions(actionRequest);
            }
            else
            {
                using (new SetUser(userAccount))
                {
                    response = new ActionService( ).GetActions(actionRequest);
                }
            }

            flattenedResults = response.Actions.SelectMany(Flatten).ToList();

            if (!string.IsNullOrWhiteSpace(typeNames))
            {
                foreach (string typeName in splitTypeNames)
                {
                    string expectState = typeName == "API Resource Endpoint" ? "resourceEndpointNew" : ActionService.CreateMenuItemActionState;

                    Assert.That(flattenedResults,
                                Has.Exactly(1).Property("HtmlActionState").EqualTo(expectState)
                                .And.Property("Name").EqualTo(typeName));
                }
            }
            else
            {
                Assert.That(flattenedResults,
                            Has.Exactly(0).Property("HtmlActionState").EqualTo(ActionService.CreateMenuItemActionState));
            }
        }
Beispiel #47
0
        public Lau_MarkerModel Post([Bind] Lau_MarkerModel model)
        {
            ActionService service = new ActionService(UserLogin);

            return(service.UpdateOrCreate <LMS_MarkerEntity, Lau_MarkerModel>(model));
        }
Beispiel #48
0
        public void Test_GetActions_Security_MultipleSelection(string entity1Name, string entity2Name, bool expectedResult)
        {
            ActionRequestExtended actionRequest;
            ActionResponse        response;
            Report                     report;
            UserAccount                userAccount;
            ActionMenuItem             deleteActionMenuItem;
            IList <ActionMenuItemInfo> flattenedResults;
            EntityType                 entityType;
            IEntity                    entity1;
            IEntity                    entity2;

            entityType = Entity.Create <EntityType>();
            entityType.Inherits.Add(UserResource.UserResource_Type);
            entityType.Save();

            entity1 = Entity.Create(entityType);
            entity1.SetField("core:name", entity1Name);
            entity1.Save();

            entity2 = Entity.Create(entityType);
            entity2.SetField("core:name", entity2Name);
            entity2.Save();

            userAccount      = Entity.Create <UserAccount>();
            userAccount.Name = "Action service test " + Guid.NewGuid( ).ToString( );
            userAccount.Save();

            new AccessRuleFactory( ).AddAllowReadQuery(
                userAccount.As <Subject>( ),
                Entity.Get <SecurableEntity>(Entity.Get <EntityType>("core:report")),
                TestQueries.Entities(new EntityRef("core:report")).ToReport( ));

            deleteActionMenuItem = Entity.Get <ActionMenuItem>("console:deleteResourceAction");
            Assert.That(deleteActionMenuItem, Is.Not.Null, "No delete menu item");

            new AccessRuleFactory().AddAllowByQuery(
                userAccount.As <Subject>(),
                entityType.As <SecurableEntity>(),
                new [] { Permissions.Read, Permissions.Delete },
                TestQueries.EntitiesWithNameA(entityType).ToReport());

            report = TestQueries.EntitiesWithNameA(entityType).ToReport();
            report.Save();

            actionRequest = new ActionRequestExtended
            {
                SelectedResourceIds    = new[] { entity1.Id, entity2.Id },
                LastSelectedResourceId = entity1.Id,
                CellSelectedResourceId = -1,
                ReportId             = report.Id,
                HostResourceIds      = new long[0],
                HostTypeIds          = new List <long>(),
                AdditionalData       = new Dictionary <string, object>(),
                ActionDisplayContext = ActionContext.ContextMenu
            };

            using (new SetUser(userAccount))
            {
                response = new ActionService().GetActions(actionRequest);
            }

            flattenedResults = response.Actions.SelectMany(Flatten).ToList();

            Assert.That(flattenedResults,
                        Has.Exactly(expectedResult ? 1 : 0).Property("Id").EqualTo(deleteActionMenuItem.Id),
                        "Delete menu incorrect");
        }
Beispiel #49
0
        private void BuildHeader()
        {
            header_table = new Table(2, 2, false);
            header_table.Show();
            primary_vbox.PackStart(header_table, false, false, 0);

            main_menu = new MainMenu();

            if (!PlatformDetection.IsMac && !PlatformDetection.IsMeeGo)
            {
                main_menu.Show();
                header_table.Attach(main_menu, 0, 1, 0, 1,
                                    AttachOptions.Expand | AttachOptions.Fill,
                                    AttachOptions.Shrink, 0, 0);
            }

            Alignment toolbar_alignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);

            toolbar_alignment.TopPadding    = PlatformDetection.IsMeeGo ? 0u : 3u;
            toolbar_alignment.BottomPadding = PlatformDetection.IsMeeGo ? 0u : 3u;

            header_toolbar              = (Toolbar)ActionService.UIManager.GetWidget("/HeaderToolbar");
            header_toolbar.ShowArrow    = false;
            header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            header_toolbar.Show();

            if (PlatformDetection.IsMeeGo)
            {
                header_toolbar.IconSize = IconSize.LargeToolbar;
                header_toolbar.Name     = "meego-toolbar";
            }

            toolbar_alignment.Add(header_toolbar);
            toolbar_alignment.Show();

            header_table.Attach(toolbar_alignment, 0, 2, 1, 2,
                                AttachOptions.Expand | AttachOptions.Fill,
                                AttachOptions.Shrink, 0, 0);

            var next_button = new NextButton(ActionService, PlatformDetection.IsMeeGo);

            next_button.Show();
            ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/NextArrowButton", next_button);

            seek_slider = new ConnectedSeekSlider()
            {
                Resizable = ShowSeekSliderResizer.Get()
            };
            seek_slider.SeekSlider.WidthRequest   = SeekSliderWidth.Get();
            seek_slider.SeekSlider.SizeAllocated += (o, a) => {
                SeekSliderWidth.Set(seek_slider.SeekSlider.Allocation.Width);
            };
            seek_slider.ShowAll();
            ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider);

            var track_info_display = new ClassicTrackInfoDisplay();

            track_info_display.Show();
            track_info_container = TrackInfoDisplay.GetEditable(track_info_display);
            track_info_container.Show();
            ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_container, true);

            if (PlatformDetection.IsMeeGo)
            {
                track_info_display.ArtworkSpacing = 5;
                seek_slider.LeftPadding           = 20;
                seek_slider.RightPadding          = 20;

                var menu        = (Menu)(ActionService.UIManager.GetWidget("/ToolbarMenu"));
                var menu_button = new Hyena.Widgets.MenuButton(new Image(Stock.Preferences, IconSize.LargeToolbar), menu, true);
                menu_button.Show();
                ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/ToolbarMenuPlaceholder", menu_button);

                var close_button = new Button(Image.NewFromIconName("window-close", IconSize.LargeToolbar))
                {
                    TooltipText = Catalog.GetString("Close")
                };

                close_button.Clicked += (o, e) => {
                    if (ServiceManager.PlayerEngine.IsPlaying() &&
                        (ServiceManager.PlayerEngine.CurrentState != PlayerState.Paused) &&
                        ServiceManager.PlayerEngine.CurrentTrack.HasAttribute(TrackMediaAttributes.VideoStream))
                    {
                        ServiceManager.PlayerEngine.Pause();
                    }
                    Hide();
                };
                close_button.ShowAll();
                ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/ClosePlaceholder", close_button);
            }
            else
            {
                var volume_button = new ConnectedVolumeButton();
                volume_button.Show();
                ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/VolumeButton", volume_button);
            }
        }
Beispiel #50
0
        public void Test_GetActions_Security_ReadModifyDelete(string permissionAliases)
        {
            ActionRequestExtended actionRequest;
            ActionResponse        response;
            Report                     peopleReport;
            UserAccount                userAccount;
            Person                     person;
            ActionMenuItem             viewActionMenuItem;
            ActionMenuItem             editActionMenuItem;
            ActionMenuItem             deleteActionMenuItem;
            IList <ActionMenuItemInfo> flattenedResults;

            string[] splitPermissionAliases;

            splitPermissionAliases = permissionAliases.Split(',');

            userAccount = Entity.Create <UserAccount>();
            userAccount.Save();

            person = Entity.Create <Person>();
            person.Save();

            viewActionMenuItem = Entity.Get <ActionMenuItem>("console:viewResourceAction");
            Assert.That(viewActionMenuItem, Is.Not.Null, "No view menu item");
            editActionMenuItem = Entity.Get <ActionMenuItem>("console:editResourceAction");
            Assert.That(editActionMenuItem, Is.Not.Null, "No edit menu item");
            deleteActionMenuItem = Entity.Get <ActionMenuItem>("console:deleteResourceAction");
            Assert.That(deleteActionMenuItem, Is.Not.Null, "No delete menu item");

            if (!string.IsNullOrWhiteSpace(permissionAliases))
            {
                new AccessRuleFactory().AddAllowByQuery(
                    userAccount.As <Subject>(),
                    Entity.Get <SecurableEntity>(Entity.Get <EntityType>("core:person")),
                    splitPermissionAliases.Select(pa => new EntityRef(pa)),
                    TestQueries.Entities().ToReport());
            }

            peopleReport = Entity.GetByName <Report>("People").FirstOrDefault();
            Assert.That(peopleReport, Is.Not.Null, "No People report");

            actionRequest = new ActionRequestExtended
            {
                SelectedResourceIds    = new[] { person.Id },
                LastSelectedResourceId = person.Id,
                CellSelectedResourceId = -1,
                ReportId             = peopleReport.Id,
                HostResourceIds      = new long[0],
                HostTypeIds          = new List <long>(),
                AdditionalData       = new Dictionary <string, object>(),
                ActionDisplayContext = ActionContext.ActionsMenu
            };

            using (new SetUser(userAccount))
            {
                response = new ActionService().GetActions(actionRequest);
            }

            flattenedResults = response.Actions.SelectMany(Flatten).ToList();

            Assert.That(flattenedResults,
                        Has.Exactly(splitPermissionAliases.Contains("read") ? 1 : 0).Property("Id").EqualTo(viewActionMenuItem.Id),
                        "View menu incorrect");
            Assert.That(flattenedResults,
                        Has.Exactly(splitPermissionAliases.Contains("read") && splitPermissionAliases.Contains("modify") ? 1 : 0).Property("Id").EqualTo(editActionMenuItem.Id),
                        "Edit menu incorrect");
            Assert.That(flattenedResults,
                        Has.Exactly(splitPermissionAliases.Contains("read") && splitPermissionAliases.Contains("delete") ? 1 : 0).Property("Id").EqualTo(deleteActionMenuItem.Id),
                        "Delete menu incorrect");
        }
Beispiel #51
0
        public Hre_HDTJobModel Post([Bind] Hre_HDTJobModel model)
        {
            bool   warning = false;
            string status  = string.Empty;

            #region Validate
            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Hre_HDTJobModel>(model, "Hre_HDTJob", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion
            ActionService service = new ActionService(UserLogin);
            #region Kiểm tra quyền duyệt trong quá khi khi tạo HDT trong quá khứ

            if (model.DateFrom < DateTime.Now.Date)
            {
                List <object> lstobjUA = new List <object>();
                lstobjUA.Add(Common.DotNetToOracle(model.UserLoginID));
                lstobjUA.Add(ApproveType.E_HDTJOB_PAST.ToString());
                lstobjUA.Add(1);
                lstobjUA.Add(Int32.MaxValue - 1);
                var checkPermission = service.GetData <Sys_UserApproveEntity>(lstobjUA, ConstantSql.hrm_sys_sp_get_UserApprove, ref status);
                if (checkPermission == null || checkPermission.Count == 0)
                {
                    model.ActionStatus = ConstantDisplay.HRM_NotHavePermissionToCreatePastHDT.TranslateString();
                    return(model);
                }
            }

            #endregion
            var    baseService  = new BaseService();
            var    result       = baseService.GetData <Hre_HDTJobEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_HDTJobsByProfileId, UserLogin, ref status).ToList();
            string ActionStatus = null;

            if (result.Count > 0)
            {
                foreach (var item in result)
                {
                    #region Validate theo task 0050045
                    if (((model.ID != item.ID) && (item.DateFrom != null && item.DateTo != null && item.DateFrom <= model.DateFrom && model.DateFrom <= item.DateTo) ||
                         (model.DateFrom <= item.DateFrom && item.DateFrom <= model.DateTo && model.DateFrom != item.DateFrom)) && (item.StatusOut != HDTJobStatus.E_APPROVE.ToString()))
                    {
                        ActionStatus = ConstantDisplay.HRM_ProfileNotOutOfOldHDT.TranslateString();
                    }
                    if (((model.ID != item.ID) && (item.DateFrom != null && item.DateTo != null && item.DateFrom <= model.DateFrom && model.DateFrom <= item.DateTo) ||
                         (model.DateFrom <= item.DateFrom && item.DateFrom <= model.DateTo && model.DateFrom != item.DateFrom)) && (item.StatusOut == HDTJobStatus.E_APPROVE.ToString()))
                    {
                        ActionStatus = ConstantDisplay.HRM_DuplidateTimeHDT.TranslateString();
                    }
                    #endregion

                    #region Validate theo task 0050038
                    if (item.StatusOut != HDTJobStatus.E_APPROVE.ToString())
                    {
                        ActionStatus = ConstantDisplay.HRM_StatusOldNotApproved.TranslateString();
                    }
                    #endregion
                }
            }
            if (ActionStatus != null)
            {
                model.ActionStatus = ActionStatus;
                return(model);
            }

            var HDT = service.UpdateOrCreate <Hre_HDTJobEntity, Hre_HDTJobModel>(model);
            return(HDT);
        }
Beispiel #52
0
        public Sal_HoldSalaryModel Post([Bind] Sal_HoldSalaryModel model)
        {
            ActionService service = new ActionService(UserLogin);

            return(service.UpdateOrCreate <Sal_HoldSalaryEntity, Sal_HoldSalaryModel>(model));
        }
Beispiel #53
0
 public override GameAction OnExecute(AgricolaPlayer player, Data.GameActionData data)
 {
     ActionService.BuildStables(player, ImmutableArray.Create(((BuildStableActionData)data).StableData), Id, ResultingNotices);
     return(this);
 }
Beispiel #54
0
        protected MatchTestBase()
        {
            var randomnessProvider = new ThreadSafeRandomnessProvider();
            var actions            = new IAction[] { new Foul(randomnessProvider), new Shot(randomnessProvider) };
            var actionService      = new ActionService(actions, randomnessProvider);

            StubMatchEngine = new MatchEngine(actionService);

            StubHomePlayer = new Card
            {
                Id      = Guid.NewGuid(),
                Name    = "GK",
                Rating  = 80,
                Fitness = 100
            };

            StubHomeSub = new Card
            {
                Id      = Guid.NewGuid(),
                Name    = "ST",
                Rating  = 40,
                Fitness = 100
            };

            StubAwayPlayer = new Card
            {
                Id      = Guid.NewGuid(),
                Name    = "ST",
                Rating  = 40,
                Fitness = 100
            };

            StubAwaySub = new Card
            {
                Id      = Guid.NewGuid(),
                Name    = "ST",
                Rating  = 40,
                Fitness = 100
            };

            var stubHomeTeamLineup = new Dictionary <string, IEnumerable <Card> >
            {
                {
                    "GK", new List <Card>
                    {
                        StubHomePlayer
                    }
                },
                {
                    "DEF", new List <Card>
                    {
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "LB",
                            Rating  = 80,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "CB",
                            Rating  = 80,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "CB",
                            Rating  = 80,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "RB",
                            Rating  = 80,
                            Fitness = 100
                        }
                    }
                },
                {
                    "MID", new List <Card>
                    {
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "LM",
                            Rating  = 80,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "CM",
                            Rating  = 80,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "CM",
                            Rating  = 80,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "RM",
                            Rating  = 80,
                            Fitness = 100
                        }
                    }
                },
                {
                    "ATT", new List <Card>
                    {
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "ST",
                            Rating  = 80,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "ST",
                            Rating  = 80,
                            Fitness = 100
                        }
                    }
                }
            };

            var stubAwayTeamLineup = new Dictionary <string, IEnumerable <Card> >
            {
                {
                    "GK", new List <Card>
                    {
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "GK",
                            Rating  = 40,
                            Fitness = 100
                        }
                    }
                },
                {
                    "DEF", new List <Card>
                    {
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "LB",
                            Rating  = 40,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "CB",
                            Rating  = 40,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "CB",
                            Rating  = 40,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "RB",
                            Rating  = 40,
                            Fitness = 100
                        }
                    }
                },
                {
                    "MID", new List <Card>
                    {
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "LM",
                            Rating  = 40,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "CM",
                            Rating  = 40,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "CM",
                            Rating  = 40,
                            Fitness = 100
                        },
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "RM",
                            Rating  = 40,
                            Fitness = 100
                        }
                    }
                },
                {
                    "ATT", new List <Card>
                    {
                        StubAwayPlayer,
                        new Card
                        {
                            Id      = Guid.NewGuid(),
                            Name    = "ST",
                            Rating  = 40,
                            Fitness = 100
                        }
                    }
                }
            };

            StubHomeSquad = new Squad
            {
                Id     = Guid.NewGuid(),
                Lineup = stubHomeTeamLineup,
                Subs   = new[]
                {
                    StubHomeSub
                },
                Name = "Good FC"
            };

            StubAwaySquad = new Squad
            {
                Id     = Guid.NewGuid(),
                Lineup = stubAwayTeamLineup,
                Subs   = new[]
                {
                    StubAwaySub
                },
                Name = "Shitty FC"
            };

            StubHomeUserId = Guid.NewGuid();
            var stubAwayUserId = Guid.NewGuid();

            StubHomeTeamDetails = new TeamDetails
            {
                UserId = StubHomeUserId,
                Squad  = StubHomeSquad
            };

            StubMatch = new ApplicationCore.Models.Match
            {
                Id       = Guid.NewGuid(),
                KickOff  = DateTime.Now,
                HomeTeam = StubHomeTeamDetails,
                AwayTeam = new TeamDetails
                {
                    UserId = stubAwayUserId,
                    Squad  = StubAwaySquad
                }
            };
        }
 public ActionController(ActionService actionService)
 {
     _actionService = actionService;
 }
 public AutobotTest_1()
 {
     _service = new ActionService();
 }
Beispiel #57
0
 public override GameAction OnExecute(AgricolaPlayer player, Data.GameActionData data)
 {
     base.OnExecute(player, data);
     ActionService.AssignAnimals(player, (AnimalCacheActionData)data, ResultingNotices);
     return(this);
 }
Beispiel #58
0
        public string Post([Bind] Sys_UserModel user)
        {
            #region chuyển string sang list<guid> (MasterDataGroup)
            if (user != null && !string.IsNullOrEmpty(user.MasterDataGroupIDstr))
            {
                var  lstDataGroupIDstr = user.MasterDataGroupIDstr.Split(',');
                Guid dataGroupId       = Guid.Empty;
                user.MasterDataGroupID = new List <Guid?>();
                foreach (var item in lstDataGroupIDstr)
                {
                    Guid.TryParse(item, out dataGroupId);
                    if (dataGroupId != Guid.Empty)
                    {
                        user.MasterDataGroupID.Add(dataGroupId);
                    }
                }
            }

            #endregion

            var success         = string.Empty;
            var passwordEncrypt = string.Empty;

            #region Validate

            string message       = string.Empty;
            var    checkValidate = ValidatorService.OnValidateData <Sys_UserModel>(user, "Sys_UserInfo", ref message);
            if (!checkValidate)
            {
                user.ActionStatus = message;
                return(message);
            }
            else
            {
                user.UserInfoName = user.UserInfoName1;
            }
            #endregion

            if (user == null)
            {
                return(string.Empty);
            }

            var model = new Sys_UserInfoEntity
            {
                ID             = user.ID,
                Code           = user.Code,
                UserType       = user.UserType,
                ProfileID      = user.ProfileID,
                UserLogin      = user.UserLogin,
                UserInfoName   = user.UserInfoName,
                Email          = user.Email,
                IsActivate     = user.IsActivate,
                IsCheckLDAP    = user.IsCheckLDAP,
                LDAPDatasource = user.LDAPDatasource,
                DateEnd        = user.EffectedDate,
                DateStart      = DateTime.Now,
                FullName       = user.UserInfoName
            };

            var service = new Sys_UserServices();

            #region change password

            ActionService actionService = new ActionService(UserLogin);
            var           userInfo      = actionService.GetByIdUseStore <Sys_UserInfoEntity>(user.ID, ConstantSql.hrm_sys_sp_get_UserbyId, ref status);

            if (userInfo != null)
            {
                // neu password nhap vao co su thay doi => change password cho user
                if (user.Password != userInfo.Password)
                {
                    #region Change Password
                    //ma hoa password
                    if (user != null && !string.IsNullOrEmpty(user.Password))
                    {
                        passwordEncrypt = EncryptUtil.MD5(user.Password);//mã hoá giống bản 7
                    }
                    model.Password = passwordEncrypt;
                    #endregion
                }
                else
                {
                    //neu khong co su thay doi password => set giá tri password là password cua db vào model
                    model.Password = userInfo.Password;
                }
            }
            else
            {
                //tạo mới password cho user
                model.Password = passwordEncrypt;
            }
            #endregion

            if (user.ID != Guid.Empty)
            {
                model.ID = user.ID;
                success  = service.Edit <Sys_UserInfoEntity>(model) + ",0";
            }
            else
            {
                success = service.Add <Sys_UserInfoEntity>(model) + ",1";
            }

            if (user != null && user.MasterDataGroupID != null)
            {
                service.UpdateUserMasterDataGroup(user.ID, user.MasterDataGroupID);
            }

            return(success);
        }
Beispiel #59
0
        public Can_MealAllowanceTypeSettingModel Post([Bind] Can_MealAllowanceTypeSettingModel model)
        {
            ActionService service = new ActionService(UserLogin);

            return(service.UpdateOrCreate <Can_MealAllowanceTypeSettingEntity, Can_MealAllowanceTypeSettingModel>(model));
        }
Beispiel #60
0
        public Hre_RelativesModel Post([Bind] Hre_RelativesModel model)
        {
            #region Validate
            string status = string.Empty;
            if (model.YearOfBirth != string.Empty && model.YearOfBirth.Length >= 10)
            {
                string[] ArrayYearOfBirth = model.YearOfBirth.Split('/').ToArray();
                ArrayYearOfBirth[2] = ArrayYearOfBirth[2].Substring(0, 4);
                if (ArrayYearOfBirth[0].Length < 2)
                {
                    ArrayYearOfBirth[0] = "0" + ArrayYearOfBirth[0];
                }
                if (ArrayYearOfBirth[1].Length < 2)
                {
                    ArrayYearOfBirth[1] = "0" + ArrayYearOfBirth[1];
                }
                string _tmp = ArrayYearOfBirth[1];
                ArrayYearOfBirth[1] = ArrayYearOfBirth[0];
                ArrayYearOfBirth[0] = _tmp;
                model.YearOfBirth   = string.Join("/", ArrayYearOfBirth);

                //#region Kiểm tra tổi con nhỏ mà lớn hơn 18 tuổi thì không cho lưu

                //try
                //{
                //    DateTime bday = new DateTime(int.Parse(ArrayYearOfBirth[2]), int.Parse(ArrayYearOfBirth[1]), int.Parse(ArrayYearOfBirth[0]));
                //    DateTime today = DateTime.Today;
                //    int age = today.Year - int.Parse(ArrayYearOfBirth.LastOrDefault());
                //    if (bday > today.AddYears(-age))
                //    {
                //        age--;
                //    }
                //    if (age >= 18)
                //    {
                //        model.ActionStatus = "Con Nhỏ Không Thể Lớn Hơn 18 tuổi !";
                //        return model;
                //    }
                //}
                //catch
                //{

                //}
                //#endregion
            }

            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Hre_RelativesModel>(model, "Hre_Relatives", ref status);
            if (!checkValidate)
            {
                model.ActionStatus = status;
                return(model);
            }
            #endregion
            ActionService service = new ActionService(UserLogin);

            #region thêm hoặc update người phụ thuộc từ người thân
            if (model.CheckAddDependant.HasValue && model.CheckAddDependant.Value == false)
            {
                Hre_DependantServices Services1 = new Hre_DependantServices();
                Services1.AddOrUpdateDependant(model.Copy <Hre_RelativesEntity>());
            }
            #endregion

            #region Son.Vo - 20150120 - gán cột EmpCodeRelativesName = mã nv + tên người thân
            var    entityprofilebyRelative = service.GetData <Hre_ProfileEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, ref status).FirstOrDefault();
            string codeEmpByRelatives      = entityprofilebyRelative != null ? entityprofilebyRelative.CodeEmp : string.Empty;
            model.EmpCodeRelativesName = codeEmpByRelatives + model.RelativeName;
            #endregion

            var entity = service.GetData <Hre_RelativesEntity>(model.IDNo, ConstantSql.hrm_hr_sp_get_RelativesByIdNo, ref status);

            service.UpdateOrCreate <Hre_RelativesEntity, Hre_RelativesModel>(model);

            if (entity != null && entity.Count > 0)
            {
                model.ActionStatus += ",Số CMND đã tồn tại trong hệ thống";
            }
            return(model);
        }