Base on scott, http://www.odetocode.com/Articles/114.aspx
#region FileShareSettings public Microsoft.ReportingServices.Interfaces.Setting[] FileShareSettings { get { Microsoft.ReportingServices.Interfaces.Setting[] intSettings = new Microsoft.ReportingServices.Interfaces.Setting[7]; intSettings[0]=new Microsoft.ReportingServices.Interfaces.Setting(); intSettings[0].Name="PATH"; intSettings[0].Value=this.txt_Path.Text;
intSettings[1]=new Microsoft.ReportingServices.Interfaces.Setting(); intSettings[1].Name="FILENAME"; intSettings[1].Value=string.Format("{0}-{1}-{2}",this.chk_IsPublic.Checked?Framework.Utility.DefaultAttribute.PUBLIC:this.CurrentUser.LogName,txtReportNo.Text,this.txt_FileName.Text);
intSettings[2]=new Microsoft.ReportingServices.Interfaces.Setting(); //bool , auto add ext? intSettings[2].Name="FILEEXTN"; intSettings[2].Value=this.chk_AddFileExtension.Checked.ToString(System.Globalization.CultureInfo.InvariantCulture);
intSettings[3]=new Microsoft.ReportingServices.Interfaces.Setting(); intSettings[3].Name="USERNAME"; intSettings[3].Value=this.txt_UserNm.Text;
intSettings[4]=new Microsoft.ReportingServices.Interfaces.Setting(); intSettings[4].Name="PASSWORD"; intSettings[4].Value=this.txt_Password.Text;
intSettings[5]=new Microsoft.ReportingServices.Interfaces.Setting();//XML;CSV;IMAGE;PDF;HTML4.0;HTML3.2;MHTML;EXCEL intSettings[5].Name="RENDER_FORMAT"; intSettings[5].Value=this.drp_RenderFormat.SelectedValue;
intSettings[6]=new Microsoft.ReportingServices.Interfaces.Setting();//Overwrite;None;AutoIncrement intSettings[6].Name="WRITEMODE"; intSettings[6].Value=this.rad_OverwriteOptions.SelectedValue;
return intSettings; } } private ExtensionSettings BuildExtensionSettings(string deliveryExt, Microsoft.ReportingServices.Interfaces.Setting[] intSettings) { ExtensionSettings rsSettings = new ExtensionSettings(); rsSettings.Extension = deliveryExt;//Name if (intSettings != null) { rsSettings.ParameterValues = new ParameterValue[intSettings.Length]; //declare ParameterValues for (int i = 0; i<intSettings.Length; i++) { ParameterValue paramValue = new ParameterValue();//Set each ParamValue paramValue.Name = intSettings[i].Name; paramValue.Value = intSettings[i].Value; rsSettings.ParameterValues[i] = paramValue; } } return rsSettings; }
private void SetUIExtensionSettings(ExtensionSettings extSetting) { this.txt_Password.Text=string.Empty; foreach(ParameterValue paramValue in extSetting.ParameterValues) { switch(paramValue.Name) { case "PATH": this.txt_Path.Text=paramValue.Value; break; case "FILENAME"://band after reportNo if(paramValue.Value.IndexOf('-')>-1) this.txt_FileName.Text=paramValue.Value.Substring(paramValue.Value.IndexOf('-',paramValue.Value.IndexOf(this.txtReportNo.Text))+1); break; case "FILEEXTN": this.chk_AddFileExtension.Checked=Convert.ToBoolean(paramValue.Value); break; case "USERNAME": this.txt_UserNm.Text=paramValue.Value; break; case "RENDER_FORMAT": this.drp_RenderFormat.SelectedValue=paramValue.Value; break; case "WRITEMODE": this.rad_OverwriteOptions.SelectedValue=paramValue.Value; break; } } } #endregion