Example #1
0
        /// <summary>
        /// Tạo mời một CatCountry
        /// </summary>
        /// <param name="request"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult Create([DataSourceRequest] DataSourceRequest request, [Bind] CatOvertimeTypeModel model)
        {
       
            var serviceGet = new RestServiceClient<IEnumerable<CatOvertimeTypeModel>>(UserLogin);
            var list = serviceGet.Get(_hrm_Hr_Service, "api/CatOvertimeType/");
            var l = serviceGet.Get(_hrm_Hr_Service, "api/CatOvertimeType/", model.ID);
            foreach (var item in list)
            {
                if (model.Code == item.Code && model.TypeTemp == item.TypeTemp)
                {
                    ModelState.AddModelError("PaymentType", "Đã tồn tại phương thức chi trả với mã này!");
                }

            }
            var result = new CatOvertimeTypeModel();
            if (ModelState.IsValid)
            {
                var service = new RestServiceClient<CatOvertimeTypeModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
                result = service.Put(_hrm_Hr_Service, "api/CatOvertimeType/", model);
                return Json(result);
            }
            return Json(new[] { result }.ToDataSourceResult(request, ModelState));

        }
Example #2
0
 /// <summary>
 /// [Tin.Nguyen] - Lấy dữ liệu Loại Ngày Nghỉ(Cat_LeaveDayType) theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public CatOvertimeTypeModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new CatOvertimeTypeModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Cat_OvertimeTypeEntity>(id,ConstantSql.hrm_cat_sp_get_OvertimeTypeById ,ref status);
     if (entity != null)
     {
         model = entity.CopyData<CatOvertimeTypeModel>();
     }
     model.ActionStatus = status;
     return model;
 }
Example #3
0
     public ActionResult CatOvertimeTypeInfo(string id)
     {
 
         if (!string.IsNullOrEmpty(id))
         {
             var id1 = Common.ConvertToGuid(id);
             var service = new RestServiceClient<CatOvertimeTypeModel>(UserLogin);
             service.SetCookies(Request.Cookies, _hrm_Hr_Service);
             var model = service.Get(_hrm_Hr_Service, "api/CatOvertimeType/", id1);
             if (model.IsHoliday == true && model.IsNightShift == true)
             {
                 model.TypeTemp = EnumDropDown.OverTimeType.E_HOLIDAY_NIGHTSHIFT.ToString();
             }
             else if (model.IsWeeked == true && model.IsNightShift == true)
             {
                 model.TypeTemp = EnumDropDown.OverTimeType.E_WEEKEND_NIGHTSHIFT.ToString();
             }
             else if (model.IsWorkDay == true && model.IsNightShift == true)
             {
                 model.TypeTemp = EnumDropDown.OverTimeType.E_WORKDAY_NIGHTSHIFT.ToString();
             }
             else if (model.IsHoliday == true)
             {
                 model.TypeTemp = EnumDropDown.OverTimeType.E_HOLIDAY.ToString();
             }
             else if (model.IsWeeked == true)
             {
                 model.TypeTemp = EnumDropDown.OverTimeType.E_WEEKEND.ToString();
             }
             else if (model.IsWorkDay == true)
             {
                 model.TypeTemp = EnumDropDown.OverTimeType.E_WORKDAY.ToString();
             }
             return View(model);
         }
         else
         {
             CatOvertimeTypeModel model = new CatOvertimeTypeModel();
             return View(model);
         }
     }