예제 #1
0
        public ActionResult RequisitionList(DataTablesViewModel param, string fromDate, string toDate, string type)
        {
            try
            {
                if (!PermissionControl.CheckPermission(UserAppPermissions.Requisition_View))
                {
                    return(RedirectToAction("Restricted", "Home"));
                }

                if (string.IsNullOrEmpty(type) || type.Equals("undefined"))
                {
                    type = RequestStatus.My_Request;
                }

                DateTime frdate = DateTime.Now;
                if (!string.IsNullOrWhiteSpace(fromDate))
                {
                    frdate = DateTime.Parse(fromDate);
                }

                DateTime tdate = DateTime.Now;
                if (!string.IsNullOrWhiteSpace(toDate))
                {
                    tdate = DateTime.Parse(toDate);
                }


                logger.DebugFormat("Getting Requisition List with From Date [{0}] and To Date [{1}]", frdate.ToShortDateString(), tdate.ToShortDateString());

                IEnumerable <UserDepartment> userDepartments;
                bool IsAdmin = false;
                if (User.IsInRole("Admin"))
                {
                    IsAdmin = true;
                }

                var appUser = UserManager.FindById(User.Identity.GetUserId());
                userDepartments = userdepartmentManagement.GetAllUserDepartmentById(appUser.Id);


                RequisitionVM requisition = new RequisitionVM();
                requisition.DTObject = param;
                var list = requisitionManagement.GetAllRequisitionByParam(requisition, frdate, tdate, userDepartments, IsAdmin, type);
                logger.DebugFormat("Successfully Retrieve  Requisition List Records [{2}] with From Date [{0}] and To Date [1]", frdate.ToShortDateString(), tdate.ToShortDateString(), list.Count());

                return(Json(new
                {
                    sEcho = param.draw,
                    iTotalRecords = list.Select(i => i.DTObject.TotalRecordsCount).FirstOrDefault(),
                    iTotalDisplayRecords = list.Select(i => i.DTObject.TotalRecordsCount).FirstOrDefault(), // Filtered Count
                    aaData = list
                }));
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Exception Raised : Message[{0}] Stack Trace [{1}] ", ex.Message, ex.StackTrace);
                return(null);
            }
        }
        public ActionResult BankTransactionList(DataTablesViewModel param, string fromDate, string toDate)
        {
            try
            {
                if (!PermissionControl.CheckPermission(UserAppPermissions.BankTransaction_View))
                {
                    return(RedirectToAction("Restricted", "Home"));
                }

                DateTime frdate = DateTime.Now;
                if (!string.IsNullOrWhiteSpace(fromDate))
                {
                    frdate = DateTime.Parse(fromDate);
                }

                DateTime tdate = DateTime.Now;
                if (!string.IsNullOrWhiteSpace(toDate))
                {
                    tdate = DateTime.Parse(toDate);
                }



                logger.DebugFormat("Getting Bank Trasaction List with From Date [{0}] and To Date [{1}]", frdate.ToShortDateString(), tdate.ToShortDateString());

                CompanyBankTransactionVM transaction = new CompanyBankTransactionVM();
                transaction.DTObject = param;
                var list = bankTransactionManagement.GetAllBankTransactionByParam(transaction, frdate, tdate);

                logger.DebugFormat("Successfully Retrieve Bank Trasaction List Records [{2}] with From Date [{0}] and To Ddate [{1}]", frdate.ToShortDateString(), tdate.ToShortDateString(), list.Count());
                return(Json(new
                {
                    sEcho = param.draw,
                    iTotalRecords = list.Select(i => i.DTObject.TotalRecordsCount).FirstOrDefault(),
                    iTotalDisplayRecords = list.Select(i => i.DTObject.TotalRecordsCount).FirstOrDefault(), // Filtered Count
                    aaData = list
                }));
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Exception Raised : Message[{0}] Stack Trace [{1}] ", ex.Message, ex.StackTrace);
                return(null);
            }
        }
예제 #3
0
        public ActionResult UserTaskList(DataTablesViewModel param, string type)
        {
            try
            {
                if (!PermissionControl.CheckPermission(UserAppPermissions.UserTask_View))
                {
                    return(RedirectToAction("Restricted", "Home"));
                }

                if (string.IsNullOrEmpty(type))
                {
                    type = User.Identity.GetUserId();
                }

                logger.DebugFormat("Getting User Task List with Ticket Type [{0}]", type);


                UserTaskVM userTask = new UserTaskVM();
                userTask.DTObject = param;
                var userDepartments = userdepartmentManagement.GetAllUserDepartmentById(User.Identity.GetUserId());
                var list            = userTaskManagement.GetTaskByCriteria(userTask, type, userDepartments);
                logger.DebugFormat("Successfully Retrieve User Task List Records [{1}] with Ticket Type [{0}]", type, list.Count());


                return(Json(new
                {
                    sEcho = param.draw,
                    iTotalRecords = list.Select(i => i.DTObject.TotalRecordsCount).FirstOrDefault(),
                    iTotalDisplayRecords = list.Select(i => i.DTObject.TotalRecordsCount).FirstOrDefault(), // Filtered Count
                    aaData = list
                }));
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Exception Raised : Message[{0}] Stack Trace [{1}] ", ex.Message, ex.StackTrace);
                return(null);
            }
        }
예제 #4
0
 public PettyCash()
 {
     DTObject = new DataTablesViewModel();
 }