Пример #1
0
        public ActionResult Index(DateTime? startDate, DateTime? endDate, string btnName)
        {
            try
            {
                if (startDate != null || endDate != null)
                {
                    OCCUSER user = (OCCUSER)Session["User"];
                    AuthorizerDashboardVM aVm = new AuthorizerDashboardVM();

                    WebRef.OBLAPP oblApp = new WebRef.OBLAPP();
                    System.Data.DataTable dt = oblApp.GetByUserID(user.EMPLOYEEID);
                    foreach (DataRow dataRow in dt.Rows)
                    {
                        aVm.EmployeeInfoVm.BranchName = (string)dataRow[21];
                        aVm.EmployeeInfoVm.Email = (string)dataRow[9];
                        aVm.EmployeeInfoVm.EmployeeId = (string)dataRow[2];
                        aVm.EmployeeInfoVm.JobTitle = (string)dataRow[7];
                        aVm.EmployeeInfoVm.Name = (string)dataRow[3];
                        aVm.EmployeeInfoVm.PreDeptName = (string)dataRow[17];
                    }

                    var pendingReqList = db.CARDCHEREUISITION.Where(x => x.ISDELETE == false).Where(x => x.STATUS == 4).OrderByDescending(x => x.ID).ToList();
                    var pendingReqListCount = pendingReqList.Count;
                    aVm.PendingRequisitionCount = pendingReqListCount;
                    aVm.PendingRequisitionList = pendingReqList.Take(5).ToList();

                    var pendingChequeList = db.CARDCHTRAN.Where(x => x.STATUS == 13).Where(x=>x.ISDELETE!=true).OrderByDescending(x => x.ID).ToList();
                    var pendingChequeListCount = pendingChequeList.Count;
                    aVm.PendingCardChequeAmount = pendingChequeList.Sum(x => x.AMOUNT);
                    aVm.PendingCardChequeCount = pendingChequeListCount;
                    aVm.PendingCardChequeList = pendingChequeList.Take(5).ToList();

                    var authReqList = db.CARDCHEREUISITION.Where(x => x.ISDELETE != true).Where(x => x.STATUS == 5).OrderByDescending(x => x.ID).ToList();
                    var authReqListCount = authReqList.Count;
                    aVm.AuthRequisitionCount = authReqListCount;
                    aVm.AuthorizedRequisitionList = authReqList.Take(5).ToList();

                    var authChequeList = db.CARDCHTRAN.Where(x => x.STATUS == 14).Where(x=>x.ISDELETE!=true).OrderByDescending(x => x.ID).ToList();
                    var authChequeListCount = authChequeList.Count;
                    aVm.AuthorizedCardChequeAmount = authChequeList.Sum(x => x.AMOUNT);
                    aVm.AuthCardCHequeCount = authChequeListCount;
                    aVm.AuthorizedCardChequeList = authChequeList.Take(5).ToList();

                    if (btnName == "pendingreq")
                    {
                        pendingReqList = db.CARDCHEREUISITION.Where(x => x.ISDELETE != true).Where(x => x.STATUS == 4).Where(x => x.CREATEDON >= startDate).Where(x => x.CREATEDON <= endDate).ToList();
                        pendingReqListCount = pendingReqList.Count;
                        aVm.PendingRequisitionCount = pendingReqListCount;
                        aVm.PendingRequisitionList = pendingReqList.ToList();
                        //aVm.Deposits = List;
                    }
                    else if (btnName == "pendingcc")
                    {
                        pendingChequeList = db.CARDCHTRAN.Where(x => x.STATUS == 13).Where(x => x.CREATEDON >= startDate).Where(x => x.CREATEDON <= endDate).Where(x=>x.ISDELETE!=true).ToList();
                        pendingChequeListCount = pendingChequeList.Count;
                        aVm.PendingCardChequeAmount = pendingChequeList.Sum(x => x.AMOUNT);
                        aVm.PendingCardChequeCount = pendingChequeListCount;
                        aVm.PendingCardChequeList = pendingChequeList.ToList();

                    }
                    else if (btnName == "authreq")
                    {
                        authReqList = db.CARDCHEREUISITION.Where(x => x.ISDELETE != true).Where(x => x.STATUS == 5).Where(x => x.CREATEDON >= startDate).Where(x => x.CREATEDON <= endDate).ToList();
                        authReqListCount = authReqList.Count;
                        aVm.AuthRequisitionCount = authReqListCount;
                        aVm.AuthorizedRequisitionList = authReqList.Take(5).ToList();

                    }

                    else if (btnName == "authcc")
                    {
                        authChequeList = db.CARDCHTRAN.Where(x => x.STATUS == 14).Where(x => x.CREATEDON >= startDate).Where(x => x.CREATEDON <= endDate).Where(x=>x.ISDELETE!=true).ToList();
                        authChequeListCount = authChequeList.Count;
                        aVm.AuthorizedCardChequeAmount = authChequeList.Sum(x => x.AMOUNT);
                        aVm.AuthCardCHequeCount = authChequeListCount;
                        aVm.AuthorizedCardChequeList = authChequeList.Take(5).ToList();

                    }
                    return View(aVm);
                }
                return RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                return RedirectToAction("Error", "Home", new { Area = "" });
            }
        }
Пример #2
0
        public ActionResult Index()
        {
            try
            {
                OCCUSER user = (OCCUSER)Session["User"];
                AuthorizerDashboardVM aVm = new AuthorizerDashboardVM();

                WebRef.OBLAPP oblApp = new WebRef.OBLAPP();
                System.Data.DataTable dt = oblApp.GetByUserID(user.EMPLOYEEID);
                foreach (DataRow dataRow in dt.Rows)
                {
                    aVm.EmployeeInfoVm.BranchName = (string)dataRow[21];
                    aVm.EmployeeInfoVm.Email = (string)dataRow[9];
                    aVm.EmployeeInfoVm.EmployeeId = (string)dataRow[2];
                    aVm.EmployeeInfoVm.JobTitle = (string)dataRow[7];
                    aVm.EmployeeInfoVm.Name = (string)dataRow[3];
                    aVm.EmployeeInfoVm.PreDeptName = (string)dataRow[17];
                }

                var pendingReqList = db.CARDCHEREUISITION.Where(x => x.ISDELETE != true).Where(x => x.STATUS == 4).OrderByDescending(x => x.ID).ToList();
                var pendingReqListCount = pendingReqList.Count;
                aVm.PendingRequisitionCount = pendingReqListCount;
                aVm.PendingRequisitionList = pendingReqList.Take(5).ToList();

                var pendingChequeList = db.CARDCHTRAN.Where(x=>x.STATUS==13).Where(x=>x.ISDELETE!=true).OrderByDescending(x => x.ID).ToList();
                var pendingChequeListCount = pendingChequeList.Count;
                aVm.PendingCardChequeAmount = pendingChequeList.Sum(x => x.AMOUNT);
                aVm.PendingCardChequeCount = pendingChequeListCount;
                aVm.PendingCardChequeList = pendingChequeList.Take(5).ToList();

                var authReqList = db.CARDCHEREUISITION.Where(x=>x.ISDELETE!=true).Where(x => x.STATUS ==5).OrderByDescending(x => x.ID).ToList();
                var authReqListCount = authReqList.Count;
                aVm.AuthRequisitionCount = authReqListCount;
                aVm.AuthorizedRequisitionList = authReqList.Take(5).ToList();

                var authChequeList = db.CARDCHTRAN.Where(x => x.STATUS == 14).Where(x=>x.ISDELETE!=true).OrderByDescending(x => x.ID).ToList();
                var authChequeListCount = authChequeList.Count;
                aVm.AuthorizedCardChequeAmount = authChequeList.Sum(x => x.AMOUNT);
                aVm.AuthCardCHequeCount = authChequeListCount;
                aVm.AuthorizedCardChequeList = authChequeList.Take(5).ToList();

                return View(aVm);
            }
            catch (Exception)
            {

                return RedirectToAction("Error", "Home", new { Area = "" });
            }

               // return View();
        }