public ActionResult SaveBoSungCong(HR_WorkingDaySupplement entity) { var db = new Timekeeping_TimeSSNDal(); DateTime now = DateTime.Now; //entity.StaffID = Global.CurrentUser.UserID; entity.CreatedBy = entity.StaffID; entity.CreatedDate = now; int checkduyetbosung = 0; var result = new SystemMessage(); checkduyetbosung = db.HR_WorkingDaySupplement_CheckExists(entity); if (checkduyetbosung == 1) { if (((entity.HourOff == null || entity.TimeOfActual == null) && entity.Type == 1) || ((entity.FromTime == null || entity.ToTime == null) && entity.Type != 1)) { result.Message = "4"; } else { if (entity.Type != 5 && entity.Type != 4) { entity.PercentPayrollID = null; } result = db.SaveBoSungCong(entity); if (result.IsSuccess == true) { result.Message = AppRes.MS_Update_success; } } } else if (checkduyetbosung == 0) { result.Message = "0"; } else if (checkduyetbosung == 2) { result.Message = "2"; } else if (checkduyetbosung == 3) { result.Message = "3"; } else if (checkduyetbosung == 6) { result.Message = "6"; } return(Content(JsonConvert.SerializeObject(new { result }))); }
public SystemMessage SaveBoSungCong(HR_WorkingDaySupplement entity) { SystemMessage systemMessage = new SystemMessage(); try { var param = new DynamicParameters(); param.Add("@AutoID", entity.AutoID); param.Add("@StaffID", entity.StaffID); param.Add("@Type", entity.Type); param.Add("@Date", entity.Date); param.Add("@FromTime", entity.FromTime); param.Add("@ToTime", entity.ToTime); param.Add("@HourOff", entity.HourOff); param.Add("@TimeOfActual", entity.TimeOfActual); param.Add("@DayOff", entity.DayOff); param.Add("@MonthVacation", entity.MonthVacation); param.Add("@CreatedBy", entity.CreatedBy); param.Add("@CreatedDate", entity.CreatedDate); param.Add("@SuperiorBy", entity.SuperiorBy); param.Add("@SuperiorDate", entity.SuperiorDate); param.Add("@ConfirmBy", entity.ConfirmBy); param.Add("@ConfirmDate", entity.ConfirmDate); param.Add("@Status", entity.Status); param.Add("@Note", entity.Note); param.Add("@ManagerNote", entity.ManagerNote); param.Add("@HRNote", entity.HRNote); param.Add("@ReasonType", entity.ReasonType); param.Add("@CustomerID", entity.CustomerID); param.Add("@PercentPayrollID", entity.PercentPayrollID); param.Add("@CustomerContactID", entity.CustomerContactID); param.Add("@CustomerReasonType", entity.CustomerReasonType); UnitOfWork.ProcedureExecute("HR_WorkingDaySupplement_Add", param); systemMessage.IsSuccess = true; if (Global.CurrentLanguage == 5) { systemMessage.Message = "Thêm mới thành công"; } else { systemMessage.Message = "Add successfully"; } return(systemMessage); } catch (Exception e) { systemMessage.IsSuccess = false; systemMessage.Message = e.ToString(); return(systemMessage); } }
public int HR_WorkingDaySupplement_CheckExists(HR_WorkingDaySupplement entity) { var param = new DynamicParameters(); int TypeCheck = 0; var date = entity.Date.ToString("yyyy-MM-dd"); param.Add("@Date", date); param.Add("@FromTime", entity.FromTime); param.Add("@ToTime", entity.ToTime); if (entity.Type == 4 || entity.Type == 2 || entity.Type == 3) { TypeCheck = 1; param.Add("@FromTime", entity.FromTime); } else if (entity.Type == 5) { TypeCheck = 2; param.Add("@FromTime", entity.FromTime); } else { TypeCheck = 4; } param.Add("@TypeCheck", TypeCheck); param.Add("@AutoID", entity.AutoID); param.Add("@UserID", entity.StaffID); param.Add("@TimeOfActual", entity.HourOff); param.Add("@ReasonType", entity.ReasonType); param.Add("@MonthVacation", entity.MonthVacation); param.Add("@Type", entity.Type); param.Add("@CheckExists", 0, DbType.Int32, ParameterDirection.InputOutput); UnitOfWork.ProcedureExecute("HR_WorkingDaySupplement_CheckExists", param); var check = param.GetDataOutput <int>("@CheckExists"); if (check == 1) { if (entity.Type == 4 || entity.Type == 2) { var param1 = new DynamicParameters(); param1.Add("@Date", date); param1.Add("@FromTime", entity.FromTime); param1.Add("@ToTime", entity.ToTime); param1.Add("@AutoID", entity.AutoID); param1.Add("@UserID", entity.StaffID); param1.Add("@CheckExists", 0, DbType.Int32, ParameterDirection.InputOutput); UnitOfWork.ProcedureExecute("HR_WorkingDaySupplement_CheckBoSung", param1); check = param1.GetDataOutput <int>("@CheckExists"); } } return(check); }
public int HR_CheckFurlough(HR_WorkingDaySupplement entity, int langId) { var param = new DynamicParameters(); int year = Convert.ToInt32(entity.MonthVacation.Substring(3, 4)); int month = Convert.ToInt32(entity.MonthVacation.Substring(0, 2)); param.Add("@UserId", entity.StaffID); param.Add("@Year", year); param.Add("@Month", month); param.Add("@LanguageId", langId); param.Add("@Furlough", entity.DayOff); param.Add("@CheckFurlough", 0, DbType.Int32, ParameterDirection.InputOutput); UnitOfWork.ProcedureExecute("HR_CheckFurlough", param); var statusId = param.GetDataOutput <int>("@CheckFurlough"); return(statusId); }