예제 #1
0
        protected override bool ValidateInput()
        {
            if (this.txtUploadRptName.Text.Trim() == "")
            {
                WebInfoPublish.Publish(this, this.lblUploadRptName.Text + " $Error_Input_Empty", this.languageComponent1);
                return(false);
            }
            ReportViewFacade  rptFacde = new ReportViewFacade(this.DataProvider);
            RptViewDesignMain rptMain  = rptFacde.GetRptViewDesignMainByReportName(this.txtUploadRptName.Text.Trim().ToUpper());

            if (rptMain != null)
            {
                bool bError = false;
                if (string.IsNullOrEmpty(this.GetRequestParam("requestid")) == false && rptMain.ReportID != this.GetRequestParam("reportid"))
                {
                    bError = true;
                }
                if (this.designView == null || this.designView.DesignMain == null)
                {
                    bError = true;
                }
                if (this.designView != null && this.designView.DesignMain != null && rptMain.ReportID != this.designView.DesignMain.ReportID)
                {
                    bError = true;
                }
                if (bError == true)
                {
                    WebInfoPublish.Publish(this, "$ReportDesign_ReportName_Exist [" + this.txtUploadRptName.Text + "]", this.languageComponent1);
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                // 初始化页面语言
                this.InitPageLanguage(this.languageComponent1, false);
                string strRptId = this.GetRequestParam("reportid");
                if (strRptId == "")
                {
                    throw new Exception("$Error_RequestUrlParameter_Lost");
                }

                ReportViewFacade rptFacade = new ReportViewFacade(this.DataProvider);

                InitSecurityList(strRptId);

                object[] objTmps = rptFacade.GetRptViewEntryFolder();
                if (objTmps != null)
                {
                    RptViewEntry[] entityList = new RptViewEntry[objTmps.Length];
                    objTmps.CopyTo(entityList, 0);
                    InitReportFolderList(entityList);
                }
                if (strRptId != "")
                {
                    RptViewDesignMain rptMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(strRptId);
                    this.txtReportName.Text = rptMain.ReportName;
                    if (rptMain != null && rptMain.ParentReportFolder != "")
                    {
                        this.drpReportFolder.SelectedValue = rptMain.ParentReportFolder;
                    }
                }
            }
        }
예제 #3
0
        protected override void UpdateReportDesignView()
        {
            RptViewDesignMain main = new RptViewDesignMain();

            if (this.designView.DesignMain != null)
            {
                main = this.designView.DesignMain;
            }
            main.ReportName   = this.txtUploadRptName.Text.Trim().ToUpper();
            main.Description  = this.txtUploadRptDesc.Text;
            main.DataSourceID = Convert.ToDecimal(this.drpDataSource.SelectedValue);
            if (string.IsNullOrEmpty(main.DisplayType) == true)
            {
                if (this.GetRequestParam("displaytype") == "gridchart")
                {
                    main.DisplayType = ReportDisplayType.GridChart;
                }
                else if (this.GetRequestParam("displaytype") == "chart")
                {
                    main.DisplayType = ReportDisplayType.Chart;
                }
                else
                {
                    main.DisplayType = ReportDisplayType.Grid;
                }
            }
            this.designView.DesignMain = main;
        }
예제 #4
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (this.IsPostBack == false)
     {
         // 初始化页面语言
         this.InitPageLanguage(this.languageComponent1, false);
         this.cmdQuery.Visible      = false;
         spanMsg.Visible            = false;
         this.ReportViewer1.Visible = false;
         if (this.ReportID == "")
         {
             //throw new Exception("$Error_RequestUrlParameter_Lost");
             spanMsg.Visible   = true;
             spanMsg.InnerText = this.languageComponent1.GetString("$Error_RequestUrlParameter_Lost");
             return;
         }
         if (rptFacade == null)
         {
             rptFacade = new ReportViewFacade(this.DataProvider);
         }
         designMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(this.ReportID);
         if (designMain == null)
         {
             //throw new Exception("$Error_RequestUrlParameter_Lost");
             spanMsg.Visible   = true;
             spanMsg.InnerText = this.languageComponent1.GetString("$Error_RequestUrlParameter_Lost");
             return;
         }
         lblRptViewTitle.Text = designMain.ReportName;
         if (this.GetRequestParam("preview") != "1")
         {
             if (designMain.Status != ReportDesignStatus.Publish)
             {
                 //throw new Exception("$ReportView_Status_Error");
                 spanMsg.Visible   = true;
                 spanMsg.InnerText = this.languageComponent1.GetString("$ReportView_Status_Error");
                 return;
             }
         }
         if (this.GetRequestParam("preview") != "1" && CheckAccessReportRight() == false)
         {
             //throw new Exception("$ReportView_No_Right_ViewReport [" + designMain.ReportName + "]");
             spanMsg.Visible   = true;
             spanMsg.InnerText = this.languageComponent1.GetString("$ReportView_No_Right_ViewReport") + " [" + designMain.ReportName + "]";
             return;
         }
         this.txtDataCount.Text     = "0";
         this.cmdQuery.Visible      = true;
         this.ReportViewer1.Visible = true;
         this.lblRptViewTitle.Text  = designMain.ReportName;
         if (existNeedInputField == false)
         {
             //this.cmdQuery_ServerClick(null, null);
         }
     }
 }
예제 #5
0
        private void CreateInputField()
        {
            if (this.ReportID == "")
            {
                return;
            }
            if (rptFacade == null)
            {
                rptFacade = new ReportViewFacade(this.DataProvider);
            }
            designMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(this.ReportID);
            if (designMain == null)
            {
                return;
            }
            if (this.GetRequestParam("preview") != "1")
            {
                if (designMain.Status != ReportDesignStatus.Publish)
                {
                    return;
                }
            }
            if (this.IsPostBack == false && this.GetRequestParam("preview") != "1")
            {
                if (CheckAccessReportRight() == false)
                {
                    return;
                }
            }

            RptViewUserSubscription[] userSubscr = rptFacade.GetNeedInputByReportId(this.ReportID, this.GetUserCode());

            RptViewFilterUI[] filterUI = rptFacade.GetRptViewFilterUIByReportId(this.ReportID);

            // 添加控件
            this.tbInput.Rows.Clear();
            for (int i = 0; i < userSubscr.Length;)
            {
                HtmlTableRow row = new HtmlTableRow();
                for (int n = 0; n < 3; n++)
                {
                    if (i <= userSubscr.Length - 1)
                    {
                        if (userSubscr[i].InputValue == "")
                        {
                            existNeedInputField = true;
                        }
                        HtmlTableCell[] cells = GenerateCell(userSubscr[i], filterUI);
                        row.Cells.Add(cells[0]);
                        row.Cells.Add(cells[1]);
                        i++;
                    }
                }
                this.tbInput.Rows.Add(row);
            }
        }
예제 #6
0
        private void cmdSave_ServerClick(object sender, EventArgs e)
        {
            string[] selectedUserGroup = this.rptSecuritySelect.SelectedUserGroup;
            if (selectedUserGroup.Length == 0)
            {
                ////Modified by allen on 20081104 for change security: functiongroup
                //throw new Exception("$ReportDesign_Select_UserGroup");
                throw new Exception("$ReportDesign_Select_FunctionGroup");
            }
            ////End Modified by allen on 20081104 for change security: functiongroup

            string            strRptId  = this.GetRequestParam("reportid");
            ReportViewFacade  rptFacade = new ReportViewFacade(this.DataProvider);
            RptViewDesignMain rptMain   = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(strRptId);

            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.OpenConnection();
            this.DataProvider.BeginTransaction();
            try
            {
                if (rptMain.ParentReportFolder != this.drpReportFolder.SelectedValue)
                {
                    rptMain.ParentReportFolder = this.drpReportFolder.SelectedValue;
                    rptFacade.UpdateRptViewDesignMain(rptMain);

                    rptFacade.UpdateReportEntryPublish(rptMain, this.GetUserCode());
                }

                rptFacade.UpdateRptViewReportSecurity(strRptId, selectedUserGroup);

                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
            finally
            {
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.CloseConnection();
            }

            InitSecurityList(strRptId);

            string alertInfo =
                string.Format("<script language=javascript>alert('{0}');</script>", this.languageComponent1.GetString("$CS_Save_Success"));

            if (!this.ClientScript.IsClientScriptBlockRegistered("SaveSuccess"))
            {
                this.ClientScript.RegisterClientScriptBlock(typeof(string), "SaveSuccess", alertInfo);
            }
        }
예제 #7
0
        protected override void UpdateReportDesignView()
        {
            if (fileRpt.PostedFile != null && fileRpt.PostedFile.FileName != "")
            {
                string strUploadFileName = fileRpt.PostedFile.FileName;
                string strExt            = strUploadFileName.Substring(strUploadFileName.LastIndexOf("\\") + 1);
                if (fileRpt.PostedFile.FileName.ToLower().EndsWith(".rdl") == false &&
                    fileRpt.PostedFile.FileName.ToLower().EndsWith(".rdlc") == false)
                {
                    throw new Exception("$ReportUpload_Invalid_FileName");
                }
                string strFolder = Server.MapPath("../") + "\\ReportFiles\\temp\\" + FormatHelper.TODateInt(DateTime.Today);
                if (System.IO.Directory.Exists(strFolder) == false)
                {
                    System.IO.Directory.CreateDirectory(strFolder);
                }
                string strFileName = strFolder + "\\" + strExt;
                fileRpt.PostedFile.SaveAs(strFileName);

                try
                {
                    System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                    xmlDoc.Load(strFileName);
                }
                catch (Exception ex)
                {
                    throw new Exception("$ReportUpload_Invalid_XMLFormat [" + ex.Message + "]");
                }

                this.designView.UploadFileName = strFileName;
            }
            else if (this.designView.DesignMain != null &&
                     (string.IsNullOrEmpty(this.designView.DesignMain.ReportFileName) == false || string.IsNullOrEmpty(this.designView.UploadFileName) == false))
            {
                if (string.IsNullOrEmpty(this.designView.UploadFileName) == true)
                {
                    string strUploadFileName = Server.MapPath("..") + "\\" + this.designView.DesignMain.ReportFileName;
                    this.designView.UploadFileName = strUploadFileName;
                }
            }
            RptViewDesignMain main = new RptViewDesignMain();

            if (this.designView.DesignMain != null)
            {
                main = this.designView.DesignMain;
            }
            main.ReportName            = this.txtUploadRptName.Text.Trim().ToUpper();
            main.Description           = this.txtUploadRptDesc.Text;
            main.DataSourceID          = Convert.ToDecimal(this.drpDataSource.SelectedValue);
            this.designView.DesignMain = main;
        }
예제 #8
0
        protected override bool ValidateInput()
        {
            if (fileRpt.PostedFile == null || fileRpt.PostedFile.FileName == "")
            {
                if (this.designView.DesignMain != null &&
                    (string.IsNullOrEmpty(this.designView.DesignMain.ReportFileName) == false || string.IsNullOrEmpty(this.designView.UploadFileName) == false))
                {
                    return(true);
                }
                throw new Exception("$Error_UploadFileIsEmpty");
            }
            string strUploadFileName = fileRpt.PostedFile.FileName;
            string strExt            = strUploadFileName.Substring(strUploadFileName.LastIndexOf("."));

            if (fileRpt.PostedFile.FileName.ToLower().EndsWith(".rdl") == false &&
                fileRpt.PostedFile.FileName.ToLower().EndsWith(".rdlc") == false)
            {
                throw new Exception("$ReportUpload_Invalid_FileName");
            }

            if (this.txtUploadRptName.Text.Trim() == "")
            {
                WebInfoPublish.Publish(this, this.lblUploadRptName.Text + " $Error_Input_Empty", this.languageComponent1);
                return(false);
            }
            ReportViewFacade  rptFacde = new ReportViewFacade(this.DataProvider);
            RptViewDesignMain rptMain  = rptFacde.GetRptViewDesignMainByReportName(this.txtUploadRptName.Text.Trim());

            if (rptMain != null)
            {
                bool bError = false;
                if (string.IsNullOrEmpty(this.GetRequestParam("requestid")) == false && rptMain.ReportID != this.GetRequestParam("reportid"))
                {
                    bError = true;
                }
                if (this.designView == null || this.designView.DesignMain == null)
                {
                    bError = true;
                }
                if (this.designView != null && this.designView.DesignMain != null && rptMain.ReportID != this.designView.DesignMain.ReportID)
                {
                    bError = true;
                }
                if (bError == true)
                {
                    WebInfoPublish.Publish(this, "$ReportDesign_ReportName_Exist [" + this.txtUploadRptName.Text + "]", this.languageComponent1);
                    return(false);
                }
            }
            return(true);
        }
예제 #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                // 初始化页面语言
                this.InitPageLanguage(this.languageComponent1, false);
                string strFileName = this.designView.UploadFileName;
                strFileName             = strFileName.Substring(strFileName.LastIndexOf("\\") + 1);
                this.txtReportFile.Text = strFileName;
                this.txtReportName.Text = this.designView.DesignMain.ReportName;

                ////Modified by allen on 20081104 for change to FunctionGroup
                //BenQGuru.eMES.BaseSetting.UserFacade userFacade = new BenQGuru.eMES.BaseSetting.UserFacade(this.DataProvider);
                //object[] objGroup = userFacade.GetAllUserGroup();
                BenQGuru.eMES.BaseSetting.SystemSettingFacade systemSetFacade = new BenQGuru.eMES.BaseSetting.SystemSettingFacade(this.DataProvider);
                object[] objGroup = systemSetFacade.GetAllFunctionGroup();
                ////End Modified by allen on 20081104 for change to FunctionGroup

                ReportViewFacade        rptFacade   = new ReportViewFacade(this.DataProvider);
                RptViewReportSecurity[] rptSecurity = null;
                if (this.designView.DesignMain.ReportID != "")
                {
                    rptSecurity = rptFacade.GetRptViewReportSecurityByReportId(this.designView.DesignMain.ReportID);
                }

                ////Modified by allen on 20081104 for change to FunctionGroup
                //this.rptSecuritySelect.InitData(objGroup, rptSecurity);
                this.rptSecuritySelect.InitFunctionGroupData(objGroup, rptSecurity);
                ////End Modified by allen on 20081104 for change to FunctionGroup

                object[] objTmps = rptFacade.GetRptViewEntryFolder();
                if (objTmps != null)
                {
                    RptViewEntry[] entityList = new RptViewEntry[objTmps.Length];
                    objTmps.CopyTo(entityList, 0);
                    InitReportFolderList(entityList);
                }
                RptViewDesignMain rptMain = this.designView.DesignMain;
                if (rptMain != null && rptMain.ParentReportFolder != "")
                {
                    this.drpReportFolder.SelectedValue = rptMain.ParentReportFolder;
                }

                if (this.drpReportFolder.Items.Count == 0)
                {
                    this.cmdPublish.Disabled = true;
                    this.cmdPublish.Attributes.Add("disabled", "disabled");
                }
            }
        }
예제 #10
0
        protected override DataRow GetGridRow(object obj)
        {
            RptViewEntry      entry            = (RptViewEntry)obj;
            string            strEntryTypeDesc = "";
            RptViewDesignMain rptMain          = null;

            if (entry.EntryType == ReportEntryType.Folder)
            {
                strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Folder);
            }
            else
            {
                if (this._facade == null)
                {
                    this._facade = new ReportViewFacade(this.DataProvider);
                }
                rptMain = (RptViewDesignMain)this._facade.GetRptViewDesignMain(entry.ReportID);
                if (rptMain != null)
                {
                    entry.EntryName   = rptMain.ReportName;
                    entry.Description = rptMain.Description;
                    if (rptMain.ReportBuilder == ReportBuilder.OnLine)
                    {
                        strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Report + "_online");
                    }
                    else
                    {
                        strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Report + "_offline");
                    }
                }
            }

            DataRow row = DtSource.NewRow();

            row["RptEntrySequence"] = entry.Sequence;
            row["RptEntryCode"]     = entry.EntryCode;
            row["RptEntryName"]     = entry.EntryName;
            row["RptIsVisible"]     = entry.Visible;
            row["RptEntryType"]     = entry.EntryType;
            row["RptEntryTypeDesc"] = strEntryTypeDesc;
            row["ReportID"]         = entry.ReportID;
            row["RptAccessRight"]   = "";
            row["RptView"]          = "";
            row["RptDownloadFile"]  = "";
            row["RptDesign"]        = "";
            row["RptPublish"]       = "";
            return(row);
        }
예제 #11
0
        public void BindReportViewer(ReportViewFacade rptFacade, RptViewDesignMain designMain, ReportViewer reportViewer, DataSet dataSource, RptViewUserSubscription[] viewerInput)
        {
            // 设置报表文件
            string strFile = HttpContext.Current.Server.MapPath("../") + designMain.ReportFileName;

            reportViewer.LocalReport.ReportPath = strFile;
            // 设置DataSource
            reportViewer.LocalReport.DataSources.Clear();
            if (dataSource.Tables.Count == 1)
            {
                reportViewer.LocalReport.DataSources.Add(new ReportDataSource("MESRPT", dataSource.Tables[0]));
            }
            else
            {
                for (int i = 0; i < dataSource.Tables.Count; i++)
                {
                    reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dataSource.Tables[i].TableName, dataSource.Tables[i]));
                }
            }
            // 设置报表参数
            if (designMain.ReportBuilder == ReportBuilder.OffLine)
            {
                RptViewFileParameter[] fileParams = rptFacade.GetRptViewFileParametersByReportId(designMain.ReportID);
                if (fileParams != null)
                {
                    ReportParameter[] rptParams = new ReportParameter[fileParams.Length];
                    for (int i = 0; i < fileParams.Length; i++)
                    {
                        for (int n = 0; viewerInput != null && n < viewerInput.Length; n++)
                        {
                            if (viewerInput[n].InputType == ReportViewerInputType.FileParameter &&
                                viewerInput[n].InputName == fileParams[i].FileParameterName)
                            {
                                fileParams[i].DefaultValue = viewerInput[n].InputValue;
                            }
                        }
                        ReportParameter rptParam = new ReportParameter();
                        rptParam.Name = fileParams[i].FileParameterName;
                        rptParam.Values.Add(fileParams[i].DefaultValue);
                        rptParam.Visible = false;
                        rptParams[i]     = rptParam;
                    }
                    reportViewer.LocalReport.SetParameters(rptParams);
                }
            }
        }
예제 #12
0
        private void InitReportList()
        {
            this.drpReportName.Items.Clear();
            ReportViewFacade rptFacade = new ReportViewFacade(this.DataProvider);

            object[] objs = rptFacade.GetRptviewDesignMainByStatus(ReportDesignStatus.Initial, ReportDesignStatus.ReDesign, ReportDesignStatus.Publish);
            if (objs != null)
            {
                for (int i = 0; i < objs.Length; i++)
                {
                    RptViewDesignMain rptMain = (RptViewDesignMain)objs[i];
                    if (rptMain.Status == ReportDesignStatus.Initial ||
                        rptMain.Status == ReportDesignStatus.ReDesign ||
                        rptMain.Status == ReportDesignStatus.Publish)
                    {
                        this.drpReportName.Items.Add(new ListItem(rptMain.ReportName, rptMain.ReportID));
                    }
                }
            }
        }
예제 #13
0
        protected override string[] FormatExportRecord(object obj)
        {
            RptViewEntry      entry            = (RptViewEntry)obj;
            string            strEntryTypeDesc = "";
            RptViewDesignMain rptMain          = null;

            if (entry.EntryType == ReportEntryType.Folder)
            {
                strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Folder);
            }
            else
            {
                if (this._facade == null)
                {
                    this._facade = new ReportViewFacade(this.DataProvider);
                }
                rptMain = (RptViewDesignMain)this._facade.GetRptViewDesignMain(entry.ReportID);
                if (rptMain != null)
                {
                    entry.EntryName   = rptMain.ReportName;
                    entry.Description = rptMain.Description;
                    if (rptMain.ReportBuilder == ReportBuilder.OnLine)
                    {
                        strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Report + "_online");
                    }
                    else
                    {
                        strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Report + "_offline");
                    }
                }
            }

            string[] objRow = new string[] {
                entry.Sequence.ToString(),
                     entry.EntryCode,
                     entry.EntryName,
                     entry.Visible,
                     strEntryTypeDesc
            };
            return(objRow);
        }
예제 #14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                // 初始化页面语言
                this.InitPageLanguage(this.languageComponent1, false);
                InitReportList();

                string strRptId = this.GetRequestParam("reportid");

                ReportViewFacade rptFacade = new ReportViewFacade(this.DataProvider);
                InitSecurityList(strRptId);

                object[] objTmps = rptFacade.GetRptViewEntryFolder();
                if (objTmps != null)
                {
                    RptViewEntry[] entityList = new RptViewEntry[objTmps.Length];
                    objTmps.CopyTo(entityList, 0);
                    InitReportFolderList(entityList);
                }
                if (strRptId != "")
                {
                    RptViewDesignMain rptMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(strRptId);
                    this.drpReportName.SelectedValue = strRptId;
                    this.drpReportName.Enabled       = false;
                    if (rptMain != null && rptMain.ParentReportFolder != "")
                    {
                        this.drpReportFolder.SelectedValue = rptMain.ParentReportFolder;
                    }
                }
                if (this.drpReportFolder.Items.Count == 0 || this.drpReportName.Items.Count == 0)
                {
                    this.cmdPublish.Disabled = true;
                    this.cmdPublish.Attributes.Add("disabled", "disabled");
                }
            }
        }
예제 #15
0
        protected void ReportViewer1_Drillthrough(object sender, Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
        {
            Microsoft.Reporting.WebForms.LocalReport lr = e.Report as Microsoft.Reporting.WebForms.LocalReport;

            if (rptFacade == null)
            {
                rptFacade = new ReportViewFacade(this.DataProvider);
            }
            RptViewDesignMain rptDesign = rptFacade.GetRptViewDesignMainByReportName(e.ReportPath.ToUpper());

            RptViewUserSubscription[] viewerInput = new RptViewUserSubscription[lr.OriginalParametersToDrillthrough.Count];

            RptViewDataSource dataSource = (RptViewDataSource)rptFacade.GetRptViewDataSource(designMain.DataSourceID);

            for (int i = 0; i < lr.OriginalParametersToDrillthrough.Count; i++)
            {
                viewerInput[i]           = new RptViewUserSubscription();
                viewerInput[i].InputName = lr.OriginalParametersToDrillthrough[i].Name;

                if (dataSource.SourceType == DataSourceType.SQL)
                {
                    viewerInput[i].InputType         = ReportViewerInputType.SqlFilter;
                    viewerInput[i].SqlFilterSequence = i + 1;
                }
                else
                {
                    viewerInput[i].InputType = ReportViewerInputType.DllParameter;
                }

                viewerInput[i].InputValue = lr.OriginalParametersToDrillthrough[i].Values[0];
            }

            DataSet dsSource = rptFacade.ExecuteDataSetFromSource(rptDesign.ReportID, viewerInput, Server.MapPath("").ToString().Substring(0, Server.MapPath("").ToString().LastIndexOf("\\")));

            lr.DataSources.Clear();
            lr.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("MESRPT", dsSource.Tables[0]));
        }
예제 #16
0
        protected override void Grid_ClickCell(GridRecord row, string commandName)
        {
            string strType = row.Items.FindItemByKey("RptEntryType").Value.ToString();

            if (strType == ReportEntryType.Folder)
            {
                return;
            }
            string strRptId = row.Items.FindItemByKey("ReportID").Value.ToString();

            if (commandName == "RptAccessRight")
            {
                string strBackUrl = "FRptEntryMP.aspx";
                string strUrl     = "FRptAccessRightMP.aspx?reportid=" + strRptId + "&backurl=" + strBackUrl;
                this.Response.Redirect(strUrl);
            }
            else if (commandName == "RptView")
            {
                ReportViewFacade  rptFacade  = new ReportViewFacade(this.DataProvider);
                RptViewDesignMain designMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(strRptId);
                if (designMain == null)
                {
                    WebInfoPublish.Publish(this, "$Error_RequestUrlParameter_Lost", this.languageComponent1);
                    return;
                }
                if (designMain.Status != ReportDesignStatus.Publish)
                {
                    WebInfoPublish.Publish(this, "$ReportView_Status_Error", this.languageComponent1);
                    return;
                }

                string strScript = "ViewReport('" + this.VirtualHostRoot + "ReportView/FRptViewMP.aspx?reportid=" + strRptId + "');";
                //ClientScriptManager scriptManager = this.Page.ClientScript;
                //scriptManager.RegisterClientScriptBlock(typeof(string), "RptView", strScript);
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "RptView", strScript, true);
            }
            else if (commandName == "RptDownloadFile")
            {
                ReportViewFacade  rptFacade  = new ReportViewFacade(this.DataProvider);
                RptViewDesignMain designMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(strRptId);
                string            strFile    = designMain.ReportFileName.Replace("\\", "/");;
                if (strFile != "")
                {
//                    Response.Write(string.Format(@"<script language=javascript>
//										window.top.document.getElementById('iframeDownload').src='" + string.Format(@"{0}FDownload.aspx", this.VirtualHostRoot)
//                        + "?fileName="
//                        + string.Format(@"{0}", strFile)
//                        + @"';</script>"));
                    string script = string.Format(@"
										window.top.document.getElementById('iframeDownload').src='"                                         + string.Format(@"{0}FDownload.aspx", this.VirtualHostRoot)
                                                  + "?fileName="
                                                  + string.Format(@"{0}", strFile)
                                                  + @"';");
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "DownLoadFile", script, true);
                }
            }
            else if (commandName == "RptDesign")
            {
                ReportViewFacade  rptFacade  = new ReportViewFacade(this.DataProvider);
                RptViewDesignMain designMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(strRptId);
                string            strUrl     = "";
                if (designMain.ReportBuilder == ReportBuilder.OnLine)
                {
                    strUrl = "FRptDesignStep1MP.aspx?reportid=" + strRptId;
                }
                else
                {
                    strUrl = "FRptUploadStep1MP.aspx?reportid=" + strRptId;
                }
                Response.Redirect(strUrl);
            }
            else if (commandName == "RptPublish")
            {
                ReportViewFacade  rptFacade  = new ReportViewFacade(this.DataProvider);
                RptViewDesignMain designMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(strRptId);
                if (designMain.Status == ReportDesignStatus.Initial ||
                    designMain.Status == ReportDesignStatus.ReDesign ||
                    designMain.Status == ReportDesignStatus.Publish)
                {
                    string strUrl = "FRptPublishDesignMP.aspx?reportid=" + strRptId;
                    this.Response.Redirect(strUrl);
                }
            }
        }
예제 #17
0
        private void cmdPublish_ServerClick(object sender, EventArgs e)
        {
            string[] selectedUserGroup = this.rptSecuritySelect.SelectedUserGroup;
            if (selectedUserGroup.Length == 0)
            {
                ////Modified by allen on 20081104 for change security: functiongroup
                //throw new Exception("$ReportDesign_Select_UserGroup");
                throw new Exception("$ReportDesign_Select_FunctionGroup");
            }
            ////End Modified by allen on 20081104 for change security: functiongroup

            string          strRptId     = this.drpReportName.SelectedValue;
            string          strFormatXml = Server.MapPath("ReportFormat.xml");
            ReportGenerater rptGenerater = new ReportGenerater(this.DataProvider);

            string strFileName = System.Web.HttpContext.Current.Server.MapPath("../ReportFiles");

            if (System.IO.Directory.Exists(strFileName) == false)
            {
                System.IO.Directory.CreateDirectory(strFileName);
            }
            if (strRptId != "")
            {
                strFileName += "\\" + strRptId + ".rdlc";
            }
            else
            {
                strFileName += "\\" + System.Guid.NewGuid().ToString() + ".rdlc";
            }

            rptGenerater.Generate(strRptId, strFormatXml, strFileName);
            string strRptFile = strFileName.Substring(strFileName.LastIndexOf("\\", strFileName.LastIndexOf("\\") - 1) + 1);

            ReportViewFacade  rptFacade = new ReportViewFacade(this.DataProvider);
            DBDateTime        dDate     = FormatHelper.GetNowDBDateTime(this.DataProvider);
            RptViewDesignMain rptMain   = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(strRptId);

            rptMain.ReportFileName     = strRptFile;
            rptMain.Status             = ReportDesignStatus.Publish;
            rptMain.ParentReportFolder = this.drpReportFolder.SelectedValue;
            rptMain.PublishUser        = this.GetUserCode();
            rptMain.PublishDate        = dDate.DBDate;
            rptMain.PublishTime        = dDate.DBTime;
            rptMain.MaintainUser       = this.GetUserCode();
            rptMain.MaintainDate       = dDate.DBDate;
            rptMain.MaintainTime       = dDate.DBTime;

            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.OpenConnection();
            this.DataProvider.BeginTransaction();
            try
            {
                rptFacade.UpdateRptViewDesignMain(rptMain);

                rptFacade.UpdateReportEntryPublish(rptMain, this.GetUserCode());

                rptFacade.UpdateRptViewReportSecurity(strRptId, selectedUserGroup);

                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
            finally
            {
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.CloseConnection();
            }

            InitSecurityList(strRptId);

            this.Session["PublishedReportId"] = strRptId;
            string alertInfo =
                string.Format("alert('{0}');", this.languageComponent1.GetString("$ReportDesign_Publish_Success"));

            // string.Format("<script language=javascript>alert('{0}');window.top.location.reload();</script>", this.languageComponent1.GetString("$ReportDesign_Publish_Success"));

            if (!this.ClientScript.IsClientScriptBlockRegistered("SaveSuccess"))
            {
                //this.ClientScript.RegisterClientScriptBlock(typeof(string), "SaveSuccess", alertInfo);
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "SaveSuccess", alertInfo, true);
            }
        }