public decimal InsertLeaveIncDec(decimal personId, string day, string time, LeaveIncDecAction action, string description, string date) { try { LeaveIncDec l = new LeaveIncDec(); l.Person = new Person() { ID = personId }; l.Description = description; if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi) { l.Date = Utility.ToMildiDate(date); } else { l.Date = Utility.ToMildiDateTime(date); } l.Day = Utility.ToInteger(day); l.Minute = Utility.RealTimeToIntTime(time); if (action == LeaveIncDecAction.Decrease) { l.Day *= -1; l.Minute *= -1; } this.SaveChanges(l, UIActionType.ADD); return(l.ID); } catch (Exception ex) { LogException(ex, "BLeaveIncDec", "DeleteLeaveIncDec"); throw ex; } }
public string[] UpdateLeaveReserve_LeaveReservePage(string state, string LeaveRemainID, string PersonnelID, string SelectedLeaveReserveID, string LeaveReserveOperationType, string LeaveReserveDay, string LeaveReserveHour, string LeaveReserveDate, string LeaveReserveDescription) { this.InitializeCulture(); string[] retMessage = new string[4]; try { decimal LeaveReserveID = 0; decimal leaveRemainID = decimal.Parse(this.StringBuilder.CreateString(LeaveRemainID)); decimal personnelID = decimal.Parse(this.StringBuilder.CreateString(PersonnelID)); decimal selectedLeaveReserveID = decimal.Parse(this.StringBuilder.CreateString(SelectedLeaveReserveID)); LeaveIncDecAction leaveReserveOperationType = (LeaveIncDecAction)Enum.Parse(typeof(LeaveIncDecAction), this.StringBuilder.CreateString(LeaveReserveOperationType)); LeaveReserveDay = this.StringBuilder.CreateString(LeaveReserveDay); LeaveReserveHour = this.StringBuilder.CreateString(LeaveReserveHour); LeaveReserveDate = this.StringBuilder.CreateString(LeaveReserveDate); LeaveReserveDescription = this.StringBuilder.CreateString(LeaveReserveDescription); UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper()); switch (uam) { case UIActionType.ADD: LeaveReserveID = this.LeaveReserveBusiness.InsertLeaveIncDec(personnelID, LeaveReserveDay, LeaveReserveHour, leaveReserveOperationType, LeaveReserveDescription, LeaveReserveDate); break; case UIActionType.DELETE: if (selectedLeaveReserveID == 0) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoLeaveReserveSelectedforDelete").ToString()), retMessage); return(retMessage); } this.LeaveReserveBusiness.DeleteLeaveIncDec(selectedLeaveReserveID); LeaveReserveID = selectedLeaveReserveID; break; default: break; } string SuccessMessageBody = string.Empty; switch (uam) { case UIActionType.ADD: SuccessMessageBody = GetLocalResourceObject("AddComplete").ToString(); break; case UIActionType.DELETE: SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString(); break; default: break; } retMessage[1] = SuccessMessageBody; retMessage[2] = "success"; retMessage[3] = LeaveReserveID.ToString(); return(retMessage); } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); return(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); return(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); return(retMessage); } }