Exemplo n.º 1
0
 public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Att_WorkdayModel AttWorkDay)
 {           
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient<Att_WorkdayModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
         var result = service.Put(_Hrm_Hre_Service, "api/Att_WorkDay/", AttWorkDay);                
         ViewBag.MsgInsert = ConstantDisplay.HRM_Attendance_WorkDay_UpdateSuccess.TranslateString();
     }
     return View();
 }
Exemplo n.º 2
0
        public ActionResult Create(Att_WorkdayModel model)
        {

            if (ModelState.IsValid)
            {
                var service = new RestServiceClient<Att_WorkdayModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
                var result = service.Put(_Hrm_Hre_Service, "api/Att_WorkDay/", model);
                ViewBag.MsgInsert = ConstantDisplay.HRM_Attendance_WorkDay_InsertSuccess.TranslateString();
            }
            return View();
        }
Exemplo n.º 3
0
 /// <summary>
 /// [Son.Vo] - Lấy dữ liệu Lịch Sử Thẻ(Att_WorkDay) theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Att_WorkdayModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Att_WorkdayModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Att_WorkdayEntity>(id, ConstantSql.hrm_att_sp_get_WorkDayById, ref status);
     if (entity != null)
     {
         model = entity.CopyData<Att_WorkdayModel>();
     }
     model.ActionStatus = status;
     return model;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Xử lí thay doi trang thai cua ngày công
 /// </summary>
 /// <param name="contract"></param>
 /// <returns></returns>      
 public ActionResult SetStatusSelected(List<Guid> selectedIds, string status)
 {
     var model = new Att_WorkdayModel();
     if (selectedIds != null)
     {
         var selectedIdsOrcl = String.Join(",", selectedIds);
         var service = new RestServiceClient<Att_WorkdayModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
         model.ProfileIds = selectedIdsOrcl;
         model.Status = status;
         model = service.Put(_Hrm_Hre_Service, "api/Att_WorkDay/", model);
     }
     return Json(model);
 } 
Exemplo n.º 5
0
        /// <summary>
        /// Tạo mời chỉnh sửa Nghỉ Phép Và Trễ Sớm page ComputeWorkDayAdjust
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult CreateInlineAdjust([Bind(Prefix = "models")] List<Att_WorkdayModel> model)
        {
            var service = new RestServiceClient<Att_WorkdayModel>(UserLogin);
            service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
            Att_WorkdayModel result = new Att_WorkdayModel();
            for (int i = 0; i < model.Count; i++)
            {

                #region [Hien.Nguyen] xử lý gộp time vào datetime
                //Nếu date == null
                if (model[i].InTime1 == null)
                {
                    model[i].InTime1 = model[i].WorkDate;//gán bằng với workdate
                    if (model[i].TempTimeIn != null)//Nếu giờ khác null thì gán giờ vào
                    {
                        model[i].InTime1 = new DateTime(model[i].InTime1.Value.Year, model[i].InTime1.Value.Month,
                            model[i].InTime1.Value.Day, int.Parse(model[i].TempTimeIn.Split(':').ToList()[0]),
                            int.Parse(model[i].TempTimeIn.Split(':').ToList()[1]), int.Parse(model[i].TempTimeIn.Split(':').ToList()[2]));
                    }
                }
                else//Nếu date != null 
                {
                    if (model[i].TempTimeIn != null)//Nếu time khác null thì gán time vào cho date
                    {
                        model[i].InTime1 = new DateTime(model[i].InTime1.Value.Year, model[i].InTime1.Value.Month,
                           model[i].InTime1.Value.Day, int.Parse(model[i].TempTimeIn.Split(':').ToList()[0]),
                           int.Parse(model[i].TempTimeIn.Split(':').ToList()[1]), int.Parse(model[i].TempTimeIn.Split(':').ToList()[2]));
                    }
                }
                if (model[i].OutTime1 == null)
                {
                    model[i].OutTime1 = model[i].WorkDate;//gán bằng với workdate
                    if (model[i].TempTimeOut != null)//Nếu giờ khác null thì gán giờ vào
                    {
                        model[i].OutTime1 = new DateTime(model[i].OutTime1.Value.Year, model[i].OutTime1.Value.Month,
                            model[i].OutTime1.Value.Day, int.Parse(model[i].TempTimeOut.Split(':').ToList()[0]),
                             int.Parse(model[i].TempTimeOut.Split(':').ToList()[1]), int.Parse(model[i].TempTimeOut.Split(':').ToList()[2]));
                    }
                }
                else
                {
                    if (model[i].TempTimeOut != null)//Nếu time khác null thì gán time vào cho date
                    {
                        model[i].OutTime1 = new DateTime(model[i].OutTime1.Value.Year, model[i].OutTime1.Value.Month,
                           model[i].OutTime1.Value.Day, int.Parse(model[i].TempTimeOut.Split(':').ToList()[0]),
                            int.Parse(model[i].TempTimeOut.Split(':').ToList()[1]), int.Parse(model[i].TempTimeOut.Split(':').ToList()[2]));
                    }
                }
                #endregion
                result = service.Post(_Hrm_Hre_Service, "api/Att_WorkDay/", model[i]);
            }
            return Json(result);
        }
Exemplo n.º 6
0
 /// <summary>
 /// [Hieu.Van] Update status 
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public Att_WorkdayModel Put(Att_WorkdayModel model)
 {
     model.ProfileIds = Common.DotNetToOracle(model.ProfileIds);
     BaseService service = new BaseService();
     string status = string.Empty;
     List<object> lstObj = new List<object>();
     lstObj.Add(model.ProfileIds);
     List<Att_WorkdayModel> rs = null;
     if (model.Status == "UpdateInOut")
     {
         rs = service.UpdateData<Att_WorkdayModel>(lstObj, ConstantSql.hrm_att_sp_set_WorkDay_addInOut, ref status);
     }
     if (model.Status == "ChangeInOut")
     {
         rs = service.UpdateData<Att_WorkdayModel>(lstObj, ConstantSql.hrm_att_sp_set_WorkDay_ChangeInOut, ref status);
     }
     if (model.Status == "CancelLateEarly")
     {
         lstObj.Add(0);
         rs = service.UpdateData<Att_WorkdayModel>(lstObj, ConstantSql.hrm_att_sp_set_WorkDay_LateEarlyDuration, ref status);
     }
     if (model.Status == AttendanceDataStatus.E_WAIT_APPROVED.ToString() || model.Status == AttendanceDataStatus.E_APPROVED.ToString())
     {
         lstObj.Add(model.Status);
         rs = service.UpdateData<Att_WorkdayModel>(lstObj, ConstantSql.hrm_att_sp_get_WorkDay_UpdateStatus, ref status);
     }
     model.ActionStatus = status;
     return model;
     //if (rs != null)
     //{
     //    return model;
     //}
     //return null;
 }