Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 /// [Hieu.Van] - 2014/07/02 Lấy Mã Thẻ(CardCode) theo mã Nhân Viên(Hre_Profile)
 public JsonResult GetCardCodeByProfileId(Guid id)
 {
     var service = new ActionService(UserLogin);
     var status = string.Empty;
     var fieldData = service.GetFirstData<Hre_ProfileCodeEntity>(id, ConstantSql.hrm_hre_sp_get_Profile_CardCodeByProfileID, ref status);
     List<object> listObj = new List<object>();
     listObj.Add(status);
     listObj.Add(fieldData);
     return Json(listObj, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 4
0
        public Hre_ContractEntity SetNewDateEndNextContractByContractAndNextContractID(Hre_ContractEntity contractEntity, Guid nextContractID)
        {
            if (contractEntity != null)
            {
                var actionService = new ActionService(UserLogin);
                var status = string.Empty;
                var objContractType = actionService.GetFirstData<Cat_ContractTypeEntity>(Common.DotNetToOracle(nextContractID.ToString()), ConstantSql.hrm_cat_sp_get_ContractTypeById, ref status);
                if (objContractType != null)
                {
                    var contractTypeEntity = (Cat_ContractTypeEntity)objContractType;
                    if (!string.IsNullOrEmpty(contractTypeEntity.Formula))
                    {
                        var formula = contractTypeEntity.Formula.Replace("\n", "").Replace("\t", "").Replace("\r", "");
                        ElementFormula elementContactType = new ElementFormula("ContractType", contractTypeEntity.Type, 0);
                        ElementFormula elementUnitType = new ElementFormula("UnitType", contractTypeEntity.UnitTime, 0);
                        ElementFormula elementValueTime = new ElementFormula("ValueTime", contractTypeEntity.ValueTime, 0);
                        ElementFormula elementDateStart = new ElementFormula("DateStart", contractEntity.DateStart, 0);

                        var result = FormulaHelper.ParseFormula(formula, new List<ElementFormula>() { elementContactType, elementUnitType, elementDateStart, elementValueTime });

                        if (result != null && string.IsNullOrEmpty(result.ErrorMessage))
                        {
                            if (result.Value.GetType().Name == "DateTime")
                            {
                                contractEntity.DateEndNextContract = (DateTime)result.Value;
                            }
                            else
                            {
                                contractEntity.ErrorMessage = contractEntity.ProfileName;

                            }

                        }
                    }
                }

            }
            return contractEntity;
        }
Ejemplo n.º 5
0
        public Hre_ContractEntity SetNewCodeContract(Hre_ContractEntity contractEntity, string strIdConstract)
        {
            if (contractEntity != null)
            {
                var actionService = new ActionService(UserLogin);
                var status = string.Empty;
                var objContractType1 = actionService.GetFirstData<Cat_ContractTypeEntity>(Common.DotNetToOracle(contractEntity.ContractTypeID.ToString()), ConstantSql.hrm_cat_sp_get_ContractTypeById, ref status);
                var objProfile1 = actionService.GetFirstData<Hre_ProfileEntity>(Common.DotNetToOracle(contractEntity.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, ref status);
                if (objContractType1 != null)
                {
                    var contractType = (Cat_ContractTypeEntity)objContractType1;
                    var profileEntity = (Hre_ProfileEntity)objProfile1;
                    if (!string.IsNullOrEmpty(contractType.Type))
                    {
                        var objSysConfig = actionService.GetFirstData<Sys_AllSettingEntity>(AppConfig.HRM_HRE_GENERATE_CODE_CONTRACT.ToString(), ConstantSql.hrm_sys_sp_get_AllSettingByKey, ref status);
                        if (objSysConfig != null)
                        {
                            var sysConfig = (Sys_AllSettingEntity)objSysConfig;
                            if (sysConfig != null && !string.IsNullOrEmpty(sysConfig.Value1))
                            {
                                ElementFormula elementContactType = new ElementFormula("ContactType", contractType.Type, 0);
                                ElementFormula elementCodeEmp = new ElementFormula("CodeEmp", profileEntity.CodeEmp, 0);
                                ElementFormula elementOrdinal = new ElementFormula("Ordinal", 1, 0);

                                var result = FormulaHelper.ParseFormula(sysConfig.Value1, new List<ElementFormula>() { elementContactType, elementCodeEmp });
                                if (result != null && string.IsNullOrEmpty(result.ErrorMessage))
                                {
                                    var value = result.Value;
                                    if (value != null)
                                    {
                                        string newCode = value.ToString();
                                        if (newCode.EndsWith("Ordinal"))
                                        {
                                            var strNewCode = newCode.Substring(0, newCode.Length - 7);
                                            if (!string.IsNullOrEmpty(strIdConstract))
                                            {
                                                var listContractType = actionService.GetData<Cat_ContractTypeEntity>(Common.DotNetToOracle(strIdConstract), ConstantSql.hrm_cat_sp_get_ContractTypeByIds, ref status);
                                                if (listContractType != null)
                                                {
                                                    var listContractTypeById = listContractType.Where(d => d.Type == contractType.Type).FirstOrDefault();
                                                    if (listContractTypeById != null)
                                                    {
                                                        var listId = strIdConstract.Split(',').ToList();
                                                        var count = listId.Where(s => listContractTypeById.ID.ToString() == s).Select(d => d == listContractTypeById.ToString()).Count();
                                                        //var count = listContractTypeById.Count();
                                                        newCode = strNewCode + "-" + (count + 1);
                                                    }
                                                    else
                                                    {
                                                        //var listId = strIdConstract.Split(',').ToList();
                                                        //var count = listId.Select(d => d == listContractTypeById.ID.ToString()).Count();
                                                        newCode = strNewCode + "-" + "1";
                                                    }
                                                }
                                                else
                                                {
                                                    newCode = strNewCode + "-" + 1;
                                                }
                                            }
                                            else
                                            {
                                                newCode = strNewCode + "-" + 1;
                                            }

                                        }
                                        contractEntity.ContractNo = newCode;
                                    }
                                }
                            }
                        }
                    }
                }
                contractEntity.ActionStatus = status;
            }
            return contractEntity;
        }