示例#1
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;
                    }
                }
            }
        }
示例#2
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);
            }
        }
示例#3
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");
                }
            }
        }
示例#4
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);
                }
            }
        }
示例#5
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);
            }
        }