⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inventorylevel.asmx.cs

📁 基于sqlserver2k,reporting service的扩展(auth,render,deliver==)应用(mssql,RS,AS,BI)
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using AWC.Reporter.Web.Entities;
using System.IO;
using System.Xml;
using AWC.Reporter.Web.RS;
using System.Configuration;
using System.Web.Services.Protocols;

namespace AWC.Reporter.Web
{
	/// <summary>
	/// Summary description for InventoryLevels.
	/// </summary>
	public class InventoryLevel : System.Web.Services.WebService
	{
		public InventoryLevel()
		{
			//CODEGEN: This call is required by the ASP.NET Web Services Designer
			InitializeComponent();
		}

		#region Component Designer generated code
		
		//Required by the Web Services Designer 
		private IContainer components = null;
				
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{

		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if(disposing && components != null)
			{
				components.Dispose();
			}
			base.Dispose(disposing);		
		}
		
		#endregion

		/// <summary>
		/// Demonstrates using reports in the B2B scenario.
		/// GetProductIventory is a web method which will be called from the AWC vendors
		/// </summary>
		/// <param name="vendorID">The VendorId</param>
		/// <returns>EntityInventory entity containing the inventory levels for this vendor's products</returns>
		[WebMethod]
		public EntityInventory GetProductInventory(int vendorID)
		{
			ReportingService rs = RsHelpers.Proxy;
			EntityInventory inventory = null;
			// Render arguments
			byte[] result = null;
			string reportPath = ConfigurationSettings.AppSettings[Constants.CONFIG_REPORT_FOLDER] + "/Inventory Levels";
			string format = "XML";
			ParameterValue[] reportParameters = null;
			string optionalString = null;
			DataSourceCredentials[] credentials = null;
			Warning[] warnings = null;
			ParameterValue[] reportHistoryParameters = null;
			string[] streamIDs = null;


			reportParameters = new ParameterValue[1];
			reportParameters[0] = new ParameterValue();
			reportParameters[0].Name = "VendorID";
			reportParameters[0].Value = vendorID.ToString();

			try
			{
				// Get the the Inventory Levels report in XML
				result = rs.Render(reportPath, format, optionalString, optionalString, reportParameters, credentials, 
					optionalString, out optionalString, out optionalString, out reportHistoryParameters, out warnings,
					out streamIDs);

			}
			catch (SoapException ex)
			{
				Trace.WriteLine(ex.Detail.OuterXml);
				throw ex;
			}

			MemoryStream stream = new MemoryStream(result);
			try 
			{
				// load the stream in the entity of type EntityInventory
				stream.Position = 0;
				stream.Seek(0,SeekOrigin.Begin);
				inventory = new EntityInventory();
				inventory.ReadXml (stream);
			}
			catch (System.Exception ex)
			{
				throw ex;
			}
			finally 
			{
				stream.Close();
			}
			
			return inventory;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -