Beispiel #1
0
 public ActionResult Create(Hre_HDTJobModel model)
 {
     //var isAccess = CheckPermission(UserId, PrivilegeType.Create, ConstantPermission.Hre_HDTJob);
     //if (!isAccess)
     //{
     //    return PartialView("AccessDenied");
     //}
     //if (ModelState.IsValid)
     //{
     //    var service = new RestServiceClient<Hre_HDTJobModel>(UserLogin);
     //    service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
     //    var result = service.Put(_hrm_Hr_Service, "api/Hre_HDTJob/", model);
     //    ViewBag.MsgInsert = "Insert success";
     //}
     //return View();
     //var isAccess = CheckPermission(UserId, PrivilegeType.Create, ConstantPermission.Hre_HDTJob);
     //if (!isAccess)
     //{
     //    return PartialView("AccessDenied");
     //}
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Hre_HDTJobModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Hre_HDTJob/", model);
         ViewBag.MsgInsert = ConstantDisplay.HRM_Hr_HDTJob_CreateSuccess.TranslateString();
     }
     return(View());
 }
 public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Hre_HDTJobModel HDTJob)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Hre_HDTJobModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Hre_HDTJob/", HDTJob);
         ViewBag.MsgUpdate = "Update success";
     }
     return(View());
 }
 public ActionResult Create(Hre_HDTJobModel model)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Hre_HDTJobModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Hre_HDTJob/", model);
         ViewBag.MsgInsert = ConstantDisplay.HRM_Hr_HDTJob_CreateSuccess.TranslateString();
     }
     return(View());
 }
Beispiel #4
0
        public ActionResult Add([Bind] Hre_HDTJobModel model)
        {
            //var isAccess = CheckPermission(UserId, PrivilegeType.Create, ConstantPermission.Hre_HDTJob);
            //if (!isAccess)
            //{
            //    return PartialView("AccessDenied");
            //}
            var service = new RestServiceClient <Hre_HDTJobModel>(UserLogin);

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

            return(Json(result));
        }
Beispiel #5
0
        /// <summary>
        /// [Son.Vo] - Lấy dữ liệu HDTJob(Hre_HDTJob) theo Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Hre_HDTJobModel GetById(Guid id)
        {
            string        status  = string.Empty;
            var           model   = new Hre_HDTJobModel();
            ActionService service = new ActionService(UserLogin);
            //var entity = service.GetByIdUseStore<Hre_HDTJobEntity>(id, ConstantSql.hrm_hr_sp_get_HDTJobById, ref status);
            var entity = service.GetData <Hre_HDTJobEntity>(Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_HDTJobById, ref status).FirstOrDefault();

            if (entity != null)
            {
                model = entity.CopyData <Hre_HDTJobModel>();
            }
            model.ActionStatus = status;
            return(model);
        }
Beispiel #6
0
 public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Hre_HDTJobModel HDTJob)
 {
     //var isAccess = CheckPermission(UserId, PrivilegeType.Modify, ConstantPermission.Hre_HDTJob);
     //if (!isAccess)
     //{
     //    return PartialView("AccessDenied");
     //}
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Hre_HDTJobModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Hre_HDTJob/", HDTJob);
         //return Json(result);
         ViewBag.MsgUpdate = "Update success";
     }
     return(View());
 }
Beispiel #7
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);
        }