Esempio n. 1
0
        public ActionResult AddLinkagesResult()
        {
            int    SSRSReportId   = Convert.ToInt32(Request.Form["selectedReportId"]);
            string selectedEuName = Request.Form["CreatedEndUser"];

            DB.ReportLinkage temp = new DB.ReportLinkage();

            temp.SSRSReportId    = SSRSReportId;
            temp.LinkageType     = Request.Form["LinkageType"];
            temp.LinkLocation    = Request.Form["LinkLocation"];
            temp.CreateEnduserId = DB_MSBDW.endusers.FirstOrDefault(eu => eu.full_name == selectedEuName).id;
            temp.RowCreateDate   = DateTime.Now;


            DB_MSBDW.ReportLinkages.Add(temp);
            DB_MSBDW.SaveChanges();


            List <DB.ReportLinkage> reportLink           = DB_MSBDW.ReportLinkages.Where(sp => sp.SSRSReportId == SSRSReportId).OrderByDescending(sp => sp.RowCreateDate).ToList();
            LinkagesViewModel       storedProcsViewModel = new LinkagesViewModel(reportLink);

            ViewData["selectedReportId"]   = SSRSReportId;
            ViewData["buttonName"]         = "LK";
            ViewData["selectedReportName"] = Request.Form["selectedReportName"];

            return(RedirectToAction("Index", "Linkages", new { id = SSRSReportId, name = Request.Form["selectedReportName"] }));
        }
Esempio n. 2
0
        public ActionResult AddParametersResult()
        {
            int SSRSReportId = Convert.ToInt32(Request.Form["selectedReportId"]);

            string selectedEuName = Request.Form["CreatedEndUser"];
            string selectedSPName = Request.Form["ReportSPNameValidated"];

            DB.ReportSPParameter temp = new DB.ReportSPParameter();

            temp.ReportSPId       = DB_MSBDW.ReportSPs.FirstOrDefault(sp => sp.SPName == selectedSPName).ID;
            temp.SSRSReportId     = SSRSReportId;
            temp.RDLParameterName = Request.Form["RDLParameterName"];
            temp.ParamDescription = Request.Form["ParamDescription"];
            temp.IsUserControlled = Request.Form["IsUserControlled"] == "Yes" ? true : false;
            temp.UserControlType  = Request.Form["UserControlType"];
            temp.IsSetValue       = Request.Form["IsSetValue"] == "Yes" ? true : false;
            temp.DefaultValue     = Request.Form["DefaultValue"];
            temp.AdditionalInfo   = Request.Form["AdditionalInfo"];
            temp.RowCreateDate    = DateTime.Now;
            temp.CreateEnduserId  = DB_MSBDW.endusers.FirstOrDefault(eu => eu.full_name == selectedEuName).id;


            DB_MSBDW.ReportSPParameters.Add(temp);
            DB_MSBDW.SaveChanges();


            ViewData["selectedReportId"]   = SSRSReportId;
            ViewData["buttonName"]         = "PA";
            ViewData["selectedReportName"] = Request.Form["selectedReportName"];

            return(RedirectToAction("Index", "Parameters", new { id = SSRSReportId, name = Request.Form["selectedReportName"] }));
        }
        public ActionResult AddStoredProcsResult()
        {
            int    SSRSReportId   = Convert.ToInt32(Request.Form["selectedReportId"]);
            string selectedEuName = Request.Form["CreatedEndUser"];

            if (Request.Form["UseExisting"] == "Yes")
            {
                string reportSPName = Request.Form["ReportSPName"];
                int    reportSPId   = DB_MSBDW.ReportSPs.FirstOrDefault(sp => sp.SPName == reportSPName).ID;
                if (!DB_MSBDW.Report_ReportSP.Any(sp => sp.ReportSPId == reportSPId && sp.SSRSReportId == SSRSReportId))
                {
                    DB.Report_ReportSP r_sp_temp = new DB.Report_ReportSP();
                    r_sp_temp.ReportSPId    = reportSPId;
                    r_sp_temp.SSRSReportId  = SSRSReportId;
                    r_sp_temp.RowCreateDate = DateTime.Now;

                    DB_MSBDW.Report_ReportSP.Add(r_sp_temp);
                    DB_MSBDW.SaveChanges();
                }
            }
            else
            {
                DB.ReportSP temp = new DB.ReportSP();
                temp.SPName           = Request.Form["SPName"];
                temp.PermissionsNotes = Request.Form["PermissionNotes"];
                temp.CreateEnduserId  = DB_MSBDW.endusers.FirstOrDefault(eu => eu.full_name == selectedEuName).id;
                temp.RowCreateDate    = DateTime.Now;
                temp.RowModifyDate    = DateTime.Now;
                temp.ModifyEnduserId  = DB_MSBDW.endusers.FirstOrDefault(eu => eu.full_name == selectedEuName).id;
                temp.IsRDLDropdown    = false;

                DB_MSBDW.ReportSPs.Add(temp);
                DB_MSBDW.SaveChanges();

                DB.Report_ReportSP r_sp_temp = new DB.Report_ReportSP();
                r_sp_temp.ReportSP      = temp;
                r_sp_temp.SSRSReport    = DB_MSBDW.SSRSReport1.FirstOrDefault(r => r.id == SSRSReportId);
                r_sp_temp.RowCreateDate = DateTime.Now;

                DB_MSBDW.Report_ReportSP.Add(r_sp_temp);
                DB_MSBDW.SaveChanges();
            }


            ViewData["selectedReportId"]   = SSRSReportId;
            ViewData["buttonName"]         = "SP";
            ViewData["selectedReportName"] = Request.Form["selectedReportName"];


            return(RedirectToAction("Index", "StoredProcs", new { id = SSRSReportId, name = Request.Form["selectedReportName"] }));
        }
Esempio n. 4
0
        public ActionResult Index()
        {
            int    selectedReport;
            string SelectedReportName;

            if (Request.Form["selectedReportName"] != null && Request.Form["selectedReportName"] != "select report" && Request.Form["selectedReportName"] != "")
            {
                SelectedReportName = Request.Form["selectedReportName"];
                selectedReport     = DB_MSBDW.SSRSReport1.FirstOrDefault(r => r.rpt_name == SelectedReportName).id;
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (Request.Form["ReportDescription"] != null)
            {
                DB.SSRSReport1 report = DB_MSBDW.SSRSReport1.FirstOrDefault(re => re.id == selectedReport);
                report.rpt_desc = Request.Form["ReportDescription"];
                DB_MSBDW.SaveChanges();
            }

            if (Request.Form["buttonName"] == "SP")
            {
                return(RedirectToAction("Index", "StoredProcs", new { id = selectedReport, name = SelectedReportName }));
            }
            else if (Request.Form["buttonName"] == "LK")
            {
                return(RedirectToAction("Index", "Linkages", new { id = selectedReport, name = SelectedReportName }));
            }
            else if (Request.Form["buttonName"] == "PA")
            {
                return(RedirectToAction("Index", "Parameters", new { id = selectedReport, name = SelectedReportName }));
            }
            else
            {
                return(RedirectToAction("Index", "ChangeHistory", new { id = selectedReport, name = SelectedReportName }));
            }
        }
Esempio n. 5
0
        public ActionResult AddChangeHistoryResult()
        {
            int        SSRSReportId     = Convert.ToInt32(Request.Form["selectedReportId"]);
            string     selectedSPName   = Request.Form["IsRDLChange"] == "No" ? Request.Form["ReportSPNameValidated"]: Request.Form["ReportSPName"];
            List <int> UnSelectedRepIds = new List <int>();

            List <DB.Report_ReportSP> relatedRpts = new List <DB.Report_ReportSP>();
            int selectedSPId = -1;

            if (selectedSPName != "" && selectedSPName != null)
            {
                selectedSPId = DB_MSBDW.ReportSPs.FirstOrDefault(s => s.SPName == selectedSPName).ID;
                relatedRpts  = DB_MSBDW.Report_ReportSP.Where(sp => sp.ReportSPId == selectedSPId).Distinct().ToList();
                string cbl1 = "checkboxlist[", cbl2 = "].id", cbl3 = "].isselected";

                if (Request.Form[cbl1 + "0" + cbl3] != null)
                {
                    for (int i = 0; i < relatedRpts.Count - 1; i++)
                    {
                        if (!Request.Form[cbl1 + i.ToString() + cbl3].Contains("true".ToLower()))
                        {
                            UnSelectedRepIds.Add(Convert.ToInt32(Request.Form[cbl1 + i.ToString() + cbl2]));
                        }
                    }
                }
            }
            string selectedEuName = Request.Form["CreatedEndUser"];

            for (int i = 0; i < relatedRpts.Count || (Request.Form["IsRDLChange"] == "Yes" && relatedRpts.Count == 0); i++)  // both with SP selected(at least one in relatedreports list, including "Yes" + SP and "No" + SP) and "Yes" + no SP  can go through, and prevent "Yes" + SP index out of range exception
            {
                DB.ReportChangeLog temp = new DB.ReportChangeLog();
                temp.ITComment       = Request.Unvalidated.Form["ITComment"];
                temp.PublicComment   = Request.Form["PublicComment"];
                temp.RowCreateDate   = DateTime.Now;
                temp.ChangeEnduserId = DB_MSBDW.endusers.FirstOrDefault(eu => eu.full_name == selectedEuName).id;
                temp.ChangeReason    = Request["ChangeReason"];
                if (selectedSPId == -1 && Request.Form["IsRDLChange"] == "Yes") // For IsRdlChange is yes and no SP selected, break from the loop
                {
                    temp.SSRSReportId = SSRSReportId;
                    temp.IsRDLChange  = true;
                    DB_MSBDW.ReportChangeLogs.Add(temp);
                    DB_MSBDW.SaveChanges();
                    break;
                }
                temp.ReportSPId = selectedSPId;

                temp.SSRSReportId = relatedRpts[i].SSRSReportId;
                if (Request.Form["IsRDLChange"] == "Yes" && !UnSelectedRepIds.Contains((int)relatedRpts[i].SSRSReportId)) // Only the selected reports(from checkboxlist) and current report will get flagged  isrdgchange true when user selects IsRDlChange Yes
                {
                    temp.IsRDLChange = true;
                }
                else
                {
                    temp.IsRDLChange = false;
                }



                DB_MSBDW.ReportChangeLogs.Add(temp);
                DB_MSBDW.SaveChanges();
            }



            List <DB.ReportChangeLog> reportChange           = DB_MSBDW.ReportChangeLogs.Where(sp => sp.SSRSReportId == SSRSReportId).OrderByDescending(sp => sp.RowCreateDate).ToList();
            ChangeHistoryViewModel    changeHistoryViewModel = new ChangeHistoryViewModel(reportChange);


            ViewData["selectedReportId"]   = SSRSReportId;
            ViewData["buttonName"]         = "CH";
            ViewData["selectedReportName"] = Request.Form["selectedReportName"];

            return(RedirectToAction("Index", "ChangeHistory", new { id = SSRSReportId, name = Request.Form["selectedReportName"] }));
        }