Subscription & Schedule handling on Reporting Services API (Part 4)

    技术2022-05-11  139

    Finally , let's see how it works!

    #region SetUIFromSubscription  private void SetUIFromSubscription(string _SubscriptionID)  {   #region GetSubscriptionProperties   ExtensionSettings extSettings;   string desc;   ActiveState active;   string status;   string eventType;   string matchData;   ParameterValue[] values = null;   rs.rs.GetSubscriptionProperties(_SubscriptionID, out extSettings, out desc, out active, out status, out eventType, out matchData, out values);   #endregion

       #region Schedule   if(desc!=null && desc.IndexOf('^')>-1 && desc.IndexOf('|')>-1)//Set Remark & Public   {    string _logName=desc.Substring(0,desc.IndexOf('^'));    if(_logName.Equals(Framework.Utility.DefaultAttribute.PUBLIC))     this.chk_IsPublic.Checked=true;    if(desc.LastIndexOf(';')>-1)     this.txt_Remark.Text=desc.Substring(desc.IndexOf('|')+1,desc.LastIndexOf(';')-desc.IndexOf('|')-1);   }   //Patch   if(matchData.IndexOf("WhichWeek")>-1)   {    if(matchData.IndexOf("FIRST_WEEK")>-1)     matchData=matchData.Replace("FIRST_WEEK","FirstWeek");    if(matchData.IndexOf("SECOND_WEEK")>-1)     matchData=matchData.Replace("SECOND_WEEK","SecondWeek");    if(matchData.IndexOf("THIRD_WEEK")>-1)     matchData=matchData.Replace("THIRD_WEEK","ThirdWeek");    if(matchData.IndexOf("FOURTH_WEEK")>-1)     matchData=matchData.Replace("FOURTH_WEEK","FourthWeek");    if(matchData.IndexOf("LAST_WEEK")>-1)     matchData=matchData.Replace("LAST_WEEK","LastWeek");   }

       SetPatten(GetScheduleFromXml(matchData));//Set Patten   #endregion

       if(extSettings.Extension.Equals("Report Server FileShare"))    SetUIExtensionSettings(extSettings);  }  #endregion

    private void Page_Load(object sender, System.EventArgs e)  {   rs=ReportServicesSingleton.GetInstance(this);//Post Back & Not Post Back   if(!Page.IsPostBack && Page.Request.Params["ReportName"]!=null && Page.Request.Params["ReportNo"]!=null)   {    try    {     this.txtReportName.Text=Page.Request.Params["ReportName"];     this.txtReportNo.Text=Page.Request.Params["ReportNo"];     this.txt_StartDate.Text=System.DateTime.Now.ToString("yyyy-MM-dd HH:mm");     this.txt_FileName.Text=this.txtReportName.Text.Substring(this.txtReportName.Text.LastIndexOf('/')+1);     this.txt_Path.Text=Framework.Utility.ConstantReader.GetReportConfig("SubscriptionSavingPath");     this.txt_UserNm.Text=Framework.Utility.ConstantReader.GetReportConfig("User");

         AddOverWriteModel();     AddRenderFormats();     AddParameterControl();

         if(Page.Request.Params["SubscriptionID"]!=null)      SetUIFromSubscription(Page.Request.Params["SubscriptionID"]);     else      this.rad_ScheduleHour.Checked=true;    }    catch(Exception ex)    {     Framework.Utility.JSUtil.Alert(this,ex.Message,ex);    }   }  }

    #region btnSave_ServerClick  private void btnSave_ServerClick(object sender, System.EventArgs e)  {   try   {    if(this.txt_UserNm.Text.Equals(Framework.Utility.ConstantReader.GetReportConfig("User")))//TO DO ? Same Name on different machines!     this.txt_Password.Text=Framework.Utility.ConstantReader.GetReportConfig("Password");

        string _oriDesc=string.Format("{2} "+GetMessage("Liter_SubscribeDesc"),this.txt_Path.Text,this.txt_FileName.Text,this.txt_Remark.Text.Length>0?this.txt_Remark.Text+';':string.Empty);    string _desc=string.Format("{0}^{1}|{2}",this.chk_IsPublic.Checked?Framework.Utility.DefaultAttribute.PUBLIC:this.CurrentUser.LogName,this.txtReportNo.Text,_oriDesc);//保存用户及报表subfix       if(Page.Request.Params["SubscriptionID"]==null)     rs.rs.CreateSubscription(this.txtReportName.Text,BuildExtensionSettings("Report Server FileShare",FileShareSettings),_desc,      "TimedSubscription",GetMatchData(),GetReportParamsFromUI());    else     rs.rs.SetSubscriptionProperties(Page.Request.Params["SubscriptionID"],BuildExtensionSettings("Report Server FileShare",FileShareSettings),_desc,      "TimedSubscription",GetMatchData(),GetReportParamsFromUI());    Framework.Utility.JSUtil.Alert(this,GetMessage("MSG_SUBSCRIBE_SUCESSED"));    Framework.Utility.JSUtil.CloseWindow(this);   }   catch(Exception ex)   {    this.btnSave.Disabled=true;    Framework.Utility.JSUtil.Alert(this,GetMessage("MSG_SUBSCRIBE_FAILED"),ex);   }  }  #endregion


    最新回复(0)