Ejemplo n.º 1
0
        public void CutOffAttendance_UpdateStatus(Guid id, CUT_OFF_ATTENDANCE status)
        {
            var userId = this.GetCurrentUserId();
            var upt    = this._repoCutOffAttendance.Find(id);

            upt.status      = (int)status;
            upt.updatedBy   = userId;
            upt.updatedDate = DateTime.Now;
            this._repoCutOffAttendance.Update(upt);
            this._unitOfWork.Save();
        }
Ejemplo n.º 2
0
        public void CutOffAttendanceUpdateStatus(Guid id, CUT_OFF_ATTENDANCE status, string remarks)
        {
            var data = this._repoCutOffAttendance.Find(id);

            var currentStatus = (CUT_OFF_ATTENDANCE)data.status;

            switch (status)
            {
            case CUT_OFF_ATTENDANCE.Draft:
                break;

            case CUT_OFF_ATTENDANCE.Submitted:
                if (new[] { CUT_OFF_ATTENDANCE.Draft, CUT_OFF_ATTENDANCE.Reject }.Contains(currentStatus) == false)
                {
                    throw new Exception("Only Status \"Draft\" and \"Reject\" can submit Cut Off Attendance.");
                }
                break;

            case CUT_OFF_ATTENDANCE.Posted:
                if (currentStatus != CUT_OFF_ATTENDANCE.Submitted)
                {
                    throw new Exception("Only status Submitted Cut Off Attendance can be process");
                }
                break;

            case CUT_OFF_ATTENDANCE.Reject:
                if (currentStatus != CUT_OFF_ATTENDANCE.Submitted)
                {
                    throw new Exception("Only status Submitted Cut Off Attendance can be rejected.");
                }
                break;

            case CUT_OFF_ATTENDANCE.Cancel:
                break;

            default:
                break;
            }

            data.remarks          = remarks;
            data.status           = (int)CUT_OFF_ATTENDANCE.Submitted;
            data.changeStatusBy   = this.GetCurrentUserId();
            data.changeStatusDate = DateTime.Now;
            data.updatedBy        = data.changeStatusBy;
            data.updatedDate      = DateTime.Now;

            this._repoCutOffAttendance.Update(data);
            this._unitOfWork.Save();
        }