public ActionResult Create(Att_OvertimeModel model)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient<Att_OvertimeModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
         var result = service.Put(_Hrm_Hre_Service, "api/Att_Overtime/", model);
         ViewBag.MsgInsert = ConstantDisplay.HRM_Attendance_Overtime_CreateSuccess.TranslateString();
     }
     return View();
 }
 /// <summary>
 /// Xử lí lưu xác nhận tăng ca
 /// </summary>
 /// <param name="contract"></param>
 /// <returns></returns>       
 public Att_OvertimeModel Post(IEnumerable<Att_OvertimeModel> listmodel)
 {
     Att_OvertimeModel model = new Att_OvertimeModel();
     var service = new Att_OvertimeServices();            
     string result = service.SaveOvertimeConfirm(listmodel.Select(item => new Att_OvertimeEntity
     {
         ID = item.ID,
         ConfirmHours = item.ConfirmHours
     }
     ));
     return model;
 }
 public ActionResult RemoveSelected(List<Guid> selectedIds)
 {
     var ot = new Att_OvertimeModel();
     if (selectedIds != null || selectedIds.Count>0)
     {
         var service = new RestServiceClient<Att_OvertimeModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
         foreach (var id in selectedIds)
         {
             service.Delete(_Hrm_Hre_Service, "api/Att_Overtime/", id);
         }
     }
     return Json("");
 }
 /// <summary>
 /// Xử lí thay doi trang thai cua overtime
 /// </summary>
 /// <param name="contract"></param>
 /// <returns></returns>      
 public ActionResult SetStatusSelected(string selectedIds, string status)
 {
     var ot = new Att_OvertimeModel();
     if (selectedIds != null)
     {
         var lstSelectedIds = selectedIds.Split(',');
         var service = new RestServiceClient<Att_OvertimeModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
         foreach (var id in lstSelectedIds)
         {
             ot.ID = Guid.Parse(id);
             ot.Status = status;
             service.Put(_Hrm_Hre_Service, "api/Att_OvertimeCustom/", ot);
         }
     }
     return Json("");
 } 
示例#5
0
        public Att_OvertimeModel Post([Bind]List<Att_OvertimeModel> lstModel)
        {
            ActionService service = new ActionService(UserLogin);
            Att_ProcessApprovedServices smService = new Att_ProcessApprovedServices();
            List<Att_OvertimeEntity> lstSM = new List<Att_OvertimeEntity>();
            Att_OvertimeModel result = new Att_OvertimeModel();

            foreach (var model in lstModel)
            {
                if (model.WorkDateTime != null && model.WorkDateTime.Length < 8)
                {
                    model.WorkDateTime = model.WorkDateTime + ":00";
                }

                //[Hien.Nguyen] reset hours datetime
                //model.WorkDate = new DateTime(model.WorkDate.Year, model.WorkDate.Month, model.WorkDate.Day, 12, 0, 0);
                //model.WorkDate = Common.JoinTimeInDate(model.WorkDate, model.WorkDateTime);

                model.WorkDateRoot = model.WorkDate;
                if (model.Status == EnumDropDown.OverTimeStatus.E_APPROVED.ToString()
                && model.RegisterHours != model.ApproveHours)
                {
                    model.ApproveHours = model.RegisterHours;
                }
                result = service.UpdateOrCreate<Att_OvertimeEntity, Att_OvertimeModel>(model);
                if (result.ActionStatus == "Success")
                {
                    lstSM.Add(model.Copy<Att_OvertimeEntity>());
                }
            }
            smService.GetEmailToSend_Overtime(lstSM,UserLogin);
            return result;
        }
示例#6
0
 /// <summary>
 /// [Hieu.Van] - Lấy dữ liệu theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Att_OvertimeModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Att_OvertimeModel();
     ActionService service = new ActionService(userLogin);
     var entity = service.GetByIdUseStore<Att_OvertimeEntity>(id, ConstantSql.hrm_att_sp_get_OvertimeById, ref status);
     if (entity != null)
     {
         model = entity.CopyData<Att_OvertimeModel>();
     }
     model.ActionStatus = status;
     return model;
 }
 public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Att_OvertimeModel AttOvertime)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient<Att_OvertimeModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
         var result = service.Put(_Hrm_Hre_Service, "api/Att_Overtime/", AttOvertime);             
         ViewBag.MsgUpdate = ConstantDisplay.HRM_Attendance_Overtime_UpdateSuccess.TranslateString();
     }
     return View();
 }
        public ActionResult SetAllowOvertimeSelected(List<Guid> selectedIds, string status)
        {
            var model = new Att_OvertimeModel();
            if (selectedIds != null || selectedIds.Count > 0)
            {

                var service = new RestServiceClient<Att_OvertimeModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
                model.ProfileIds = String.Join(",", selectedIds);
                if (status == "true")
                    model.IsNonOvertime = false;
                else
                    model.IsNonOvertime = true;
                model = service.Put(_Hrm_Hre_Service, "api/Att_Overtime/", model);
            }
            return Json(model);
        }
        public ActionResult SetMethodPaymentSelected(List<Guid> selectedIds, string status)
        {
            var model = new Att_OvertimeModel();
            if (selectedIds != null || selectedIds.Count >0)
            {

                var service = new RestServiceClient<Att_OvertimeModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
                model.ProfileIds = String.Join(",", selectedIds);
                model.MethodPayment = status;
                model = service.Put(_Hrm_Hre_Service, "api/Att_Overtime/", model);
            }
            return Json(model);
        }
 /// <summary>
 /// Xử lí thay doi trang thai cua overtime
 /// </summary>
 /// <param name="contract"></param>
 /// <returns></returns>    
 /// 
 public ActionResult SetStatusSelected(List<Guid> selectedIds, string status, string userApproved)
 {
     var model = new Att_OvertimeModel();
     if (selectedIds != null)
     {
         var service = new RestServiceClient<Att_OvertimeModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
         model.ProfileIds = String.Join(",", selectedIds);
         model.Status = status;
         Guid Approved = Guid.Empty;
         Guid.TryParse(userApproved, out Approved);
         if (Approved == Guid.Empty)
         {
             model.ActionStatus = "NoPermission";
             return Json(model);
         }
         model.UserApproveID = Approved;
         model.UserApproveID2 = Approved;
         model = service.Put(_Hrm_Hre_Service, "api/Att_Overtime/", model);
     }
     return Json(model);
 }
        public ActionResult GetOvertimeList([DataSourceRequest] DataSourceRequest request, Att_OvertimeModel model123)
        {

            return View();
        }