예제 #1
0
        public Hre_WorkHistoryModel Post([Bind] Hre_WorkHistoryModel model)
        {
            #region Validate
            BaseService BaseService   = new BaseService();
            string      status        = string.Empty;
            string      message       = string.Empty;
            var         checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Hre_WorkHistoryModel>(model, "Hre_WorkHistory", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion
            var WorkHistoryServices  = new Hre_WorkHistoryServices();
            var SalaryClassServices  = new Cat_SalaryClassServices();
            var OrgStructureServices = new Cat_OrgStructureServices();
            var JobTitleServices     = new Cat_JobTitleServices();
            var PositionServices     = new Cat_PositionServices();
            var WorkHistoryOld       = BaseService.GetData <Hre_WorkHistoryEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_WorkHistoryByProfileId, UserLogin, ref status).OrderByDescending(s => s.DateEffective).FirstOrDefault();
            if (WorkHistoryOld != null)
            {
                model.SalaryClassNameOld = WorkHistoryOld.SalaryClassName;
                model.JobTitleOld        = WorkHistoryOld.JobTitleName;
                model.PositionOld        = WorkHistoryOld.PositionName;
                model.OrgStructureOldID  = WorkHistoryOld.OrganizationStructureID;
                model.WorkLocationOld    = WorkHistoryOld.WorkLocation;
            }

            if (model.SalaryClassID != null)
            {
                var abilityTitleBySalaryClass = BaseService.GetData <Cat_AbilityTileEntity>(Common.DotNetToOracle(model.SalaryClassID.ToString()), ConstantSql.hrm_cat_sp_get_AbilityTileBySalaryClassId, UserLogin, ref status).FirstOrDefault();
                if (abilityTitleBySalaryClass != null)
                {
                    model.AbilityTileID = abilityTitleBySalaryClass.ID;
                }
            }
            // Son.Vo - 20140107 - Xử lý cập nhật ngược lại bảng profile
            if (model.Status == WorkHistoryStatus.E_APPROVED.ToString() && model.DateEffective != null && model.DateEffective <= DateTime.Now.Date)
            {
                Hre_ProfileServices profileServices = new Hre_ProfileServices();
                Hre_ProfileEntity   profile         = BaseService.GetData <Hre_ProfileEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
                if (profile != null)
                {
                    profile.OrgStructureID = model.OrganizationStructureID;
                    profile.JobTitleID     = model.JobTitleID;
                    profile.PositionID     = model.PositionID;
                    profile.DateOfEffect   = model.DateEffective;
                    profile.LaborType      = model.LaborType;
                    profile.CostCentreID   = model.CostCentreID;
                    profile.FormType       = model.FormType;
                    profile.EmpTypeID      = model.EmployeeTypeID;
                    profile.WorkingPlace   = model.WorkLocation;
                    profile.AbilityTileID  = model.AbilityTileID;
                    profileServices.Edit(profile);
                }
            }

            ActionService service = new ActionService(UserLogin);
            return(service.UpdateOrCreate <Hre_WorkHistoryEntity, Hre_WorkHistoryModel>(model));
        }
예제 #2
0
        /// <summary>
        /// Tạo mời một WorkHistory
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult Add([Bind] Hre_WorkHistoryModel model)
        {
            var service = new RestServiceClient <Hre_WorkHistoryModel>(UserLogin);

            service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
            var result = service.Put(_hrm_Hr_Service, "api/Hre_WorkHistory/", model);

            return(Json(result));
        }
예제 #3
0
 public ActionResult Create(Hre_WorkHistoryModel model)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Hre_WorkHistoryModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Hre_WorkHistory/", model);
         ViewBag.MsgInsert = ConstantDisplay.HRM_HR_SoftSkill_InsertSuccess.TranslateString();
     }
     return(View());
 }
예제 #4
0
        /// <summary>
        /// [Son.Vo] - Lấy dữ liệu WorkHistory(Hre_WorkHistory) theo Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        public Hre_WorkHistoryModel GetById(Guid id)
        {
            string status  = string.Empty;
            var    model   = new Hre_WorkHistoryModel();
            var    service = new ActionService(UserLogin);
            var    entity  = service.GetByIdUseStore <Hre_WorkHistoryEntity>(id, ConstantSql.hrm_hr_sp_get_WorkHistoryById, ref status);

            if (entity != null)
            {
                model = entity.CopyData <Hre_WorkHistoryModel>();
            }
            if (model != null && model.DateEffective != null)
            {
                model.DateEffectiveOld = model.DateEffective;
            }
            model.ActionStatus = status;
            return(model);
        }