コード例 #1
0
ファイル: ReportsController.cs プロジェクト: yemmieh/STBI
        public ActionResult Reports(string ReportMode)
        {
            this._UserName = Session["UserName"] as string ?? "";

            string PostBackMessage = TempData["PostBackMessage"] as string;
            string Approvers       = TempData["Approvers"] as string;

            if (!String.IsNullOrEmpty(PostBackMessage))
            {
                ViewBag.PostBackMessage = "<script type='text/javascript'>alert(\"" + PostBackMessage + "\\n\\n" + Approvers + "\");</script>";
            }

            //now get the pending items
            if (_UserName == null || _UserName.Equals(String.Empty))
            {
                ViewBag.ErrorMessage = "You must be logged in to continue.";
                return(View());
            }

            //now resolve the user profile from AD and Xceed
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = _UserName;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            if (staffADProfile == null)
            {
                ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech.";
                return(View());
            }

            //ReportMode = (String.IsNullOrEmpty(TempData["ReportMode"] as string) ) ? ReportMode : TempData["ReportMode"] as string ;

            //Now let's get all entries in the workflow, depending on what was passed in to ReportMode//
            List <EntriesModel> entryDetails = new List <EntriesModel>();
            //entryDetails = new LINQCalls().getWorkflowReport( ReportMode );

            ReportModel reportModel = new ReportModel();

            if (TempData["reportModel"] != null)
            {
                reportModel  = TempData["reportModel"] as ReportModel;
                entryDetails = LINQCalls.getWorkflowQueryReport(reportModel);
            }
            else
            {
                entryDetails           = LINQCalls.getWorkflowReport(ReportMode);
                reportModel.ReportMode = ReportMode;
            }

            reportModel.QueryField   = SelectListItemHelper.GetQueryFields();
            reportModel.EntriesModel = entryDetails;

            return(View(reportModel));
        }