public CatOvertimeTypeModel Post([Bind] CatOvertimeTypeModel model)
 {
     if (model.TypeTemp == EnumDropDown.OverTimeType.E_HOLIDAY.ToString())
     {
         model.IsHoliday    = true;
         model.IsWeeked     = false;
         model.IsWorkDay    = false;
         model.IsNightShift = false;
     }
     else if (model.TypeTemp == EnumDropDown.OverTimeType.E_HOLIDAY_NIGHTSHIFT.ToString())
     {
         model.IsHoliday    = true;
         model.IsWeeked     = false;
         model.IsWorkDay    = false;
         model.IsNightShift = true;
     }
     else if (model.TypeTemp == EnumDropDown.OverTimeType.E_WEEKEND.ToString())
     {
         model.IsHoliday    = false;
         model.IsWeeked     = true;
         model.IsWorkDay    = false;
         model.IsNightShift = false;
     }
     else if (model.TypeTemp == EnumDropDown.OverTimeType.E_WEEKEND_NIGHTSHIFT.ToString())
     {
         model.IsHoliday    = false;
         model.IsWeeked     = true;
         model.IsWorkDay    = false;
         model.IsNightShift = true;
     }
     else if (model.TypeTemp == EnumDropDown.OverTimeType.E_WORKDAY.ToString())
     {
         model.IsHoliday    = false;
         model.IsWeeked     = false;
         model.IsWorkDay    = true;
         model.IsNightShift = false;
     }
     else if (model.TypeTemp == EnumDropDown.OverTimeType.E_WORKDAY_NIGHTSHIFT.ToString())
     {
         model.IsHoliday    = false;
         model.IsWeeked     = false;
         model.IsWorkDay    = true;
         model.IsNightShift = true;
     }
     #region Validate
     string message       = string.Empty;
     var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <CatOvertimeTypeModel>(model, "Cat_OvertimeType", ref message);
     if (!checkValidate)
     {
         model.ActionStatus = message;
         return(model);
     }
     #endregion
     ActionService service = new ActionService(UserLogin);
     return(service.UpdateOrCreate <Cat_OvertimeTypeEntity, CatOvertimeTypeModel>(model));
 }
        /// <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);
        }
Beispiel #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));
     }
 }
Beispiel #4
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)));
        }