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); } }
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); } }