Exemplo n.º 1
0
 public ActionResult NewReportUserWise(DateTime?startDate, DateTime?endDate, string ddlUserList, string terminaldId, string status, string reportType, string download)
 {
     if (Session["User"] == null)
     {
         return(RedirectToAction("LogIn", "LogIn"));
     }
     //if (!((tbl_UserDetail)Session["User"]).UserGroup.Equals(Constants.UserGroups.ParameterManager))
     if (((tbl_UserDetail)Session["User"]).GroupPages.Contains("Report"))
     {
         try
         {
             tbl_UserDetail      user                = (tbl_UserDetail)Session["User"];
             List <UserDetails>  transactionlist     = new List <UserDetails>();
             UserTransactionData userTransactionData = new UserTransactionData();
             if (!string.IsNullOrEmpty(reportType) && reportType.Trim() == "Maximum Dispute Raising Machine")
             {
                 ViewBag.MaxDisputeMachine = userTransactionData.GetMaxDisputedMachine(startDate, endDate, reportType, user.AccountName, user.UserGroup);
             }
             else if (!string.IsNullOrEmpty(reportType) && reportType.Trim() == "Maximum Complaint Raising Customer")
             {
                 var maxdispute = userTransactionData.GetMaxDisputedCustomer(startDate, endDate, reportType, user.AccountName, user.UserGroup);
                 MvcHelper.DecryptMaxDisputeObj(ref maxdispute);
                 ViewBag.MaxDisputeCustomer = maxdispute;
             }
             else if (!string.IsNullOrEmpty(reportType) && reportType.Trim() == "User Wise Transactions")
             {
                 ddlUserList     = (ddlUserList.Contains(',') ? ddlUserList.Split(',')[0] : ddlUserList);
                 transactionlist = ViewBag.ReportData = userTransactionData.GetTransactionDataList(startDate, endDate, terminaldId, status, reportType, ddlUserList, user.UserGroup);
             }
             else
             {
                 transactionlist = ViewBag.ReportData = userTransactionData.GetTransactionDataList(startDate, endDate, terminaldId, status, reportType, user.AccountName, user.UserGroup);
             }
             if (!string.IsNullOrEmpty(download))
             {
                 string sheetname = "Report" + DateTime.Now;
                 FormattoExcel(transactionlist, sheetname);
             }
             if (!string.IsNullOrEmpty(ddlUserList) && ddlUserList != "0")
             {
                 tbl_UserDetail objuser = MvcHelper.UserDetail(ddlUserList.Trim());
                 ddlUserList = objuser.AccountName + "," + objuser.AccountName;
             }
             ViewBag.SearchDetail = new ViewModelClass.ViewReportSeachDataModel()
             {
                 endDate     = (endDate != null ? (Convert.ToDateTime(endDate).ToString("dd-MMM-yyyy")) : ""),
                 startDate   = (startDate != null ? (Convert.ToDateTime(startDate).ToString("dd-MMM-yyyy")) : ""),
                 terminaldId = terminaldId,
                 reportType  = reportType,
                 ddlUserList = ddlUserList,
                 status      = status
             };
             ViewBag.UserList = MvcHelper.UserList();
         }
         catch (Exception ex)
         {
         }
         return(View());
     }
     else
     {
         Session.Abandon();
         return(RedirectToAction("Error", "ErrorPage"));
     }
 }