Beispiel #1
0
        public ActionResult Add([Bind] Hre_StopWorkingModel model)
        {
            var service = new RestServiceClient <Hre_StopWorkingModel>(UserLogin);

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

            return(Json(result));
        }
Beispiel #2
0
 public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Hre_StopWorkingModel StopWorking)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Hre_StopWorkingModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Hre_StopWorking/", StopWorking);
         ViewBag.MsgUpdate = "Update success";
     }
     return(View());
 }
Beispiel #3
0
 public ActionResult Create(Hre_StopWorkingModel model)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Hre_StopWorkingModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Hre_StopWorking/", model);
         ViewBag.MsgInsert = "Insert success";
     }
     return(View());
 }
        public Hre_StopWorkingModel GetById(Guid id)
        {
            string        status  = string.Empty;
            var           model   = new Hre_StopWorkingModel();
            ActionService service = new ActionService(UserLogin);
            var           entity  = service.GetData <Hre_StopWorkingEntity>(Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_StopWorkingById, ref status).FirstOrDefault();

            if (entity != null)
            {
                model = entity.CopyData <Hre_StopWorkingModel>();
            }
            model.ActionStatus = status;
            return(model);
        }
        public Hre_StopWorkingModel Post([Bind] Hre_StopWorkingModel model)
        {
            ActionService service = new ActionService(UserLogin);

            #region Validate
            var ValiteConfig = "Hre_StopWorking";
            if (model.RequestDateComeBack != null)
            {
                ValiteConfig = "Hre_StopWorking_RegisterComeBack";
            }
            else if (model.DateStop != null && model.RequestDate != null && model.TypeSuspense != null)
            {
                ValiteConfig = "Hre_StopWorking_RegisterSuspense";
            }
            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Hre_StopWorkingModel>(model, ValiteConfig, ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            string status = "";
            var    result = service.GetData <Hre_StopWorkingEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_StopWorkingByProId, ref status);
            if (result.Count > 0 && result.FirstOrDefault().ID != model.ID)
            {
                model.ActionStatus = ConstantMessages.RegisterDuplicate.TranslateString();
                return(model);
            }
            if (model.Status == null)
            {
                model.Status = EnumDropDown.StopWorkStatus.E_WAITAPPROVE.ToString();
            }

            #endregion


            return(service.UpdateOrCreate <Hre_StopWorkingEntity, Hre_StopWorkingModel>(model, model.UserID));
        }