public System.IO.Stream GetStream(object args)
        {
            InventoryReportProviderParameters _args = new InventoryReportProviderParameters();

            _args = args as InventoryReportProviderParameters;
            if (string.IsNullOrEmpty(_args.connectionstring) || string.IsNullOrEmpty(_args.warehous))
            {
                throw new NullReferenceException();
            }
            if (getCount(_args) > 0)
            {
                MemoryStream      ms  = new MemoryStream();
                XmlWriterSettings xws = new XmlWriterSettings();
                xws.OmitXmlDeclaration = true;
                xws.Indent             = true;
                _args.tagnamespace     = "http://kaifa.b2b.schemas/InventoryReport";
                using (XmlWriter xw = XmlWriter.Create(ms, xws))
                {
                    InventoryReportGenerator report = new InventoryReportGenerator(false, _args.configPath, _args.fromRole, _args.tostxRole, _args.toe2openRole, _args.warehous, _args.connectionstring, _args.tagnamespace);
                    XDocument doc = report.Generator();
                    doc.WriteTo(xw);
                }
                ms.Seek(0, SeekOrigin.Begin);
                System.Diagnostics.Trace.WriteLine("Create Inventory Report ", "InventoryReportProvider");
                return(ms);
            }
            else
            {
                return(null);
            }
        }
        public System.IO.Stream GetStream(object args)
        {
            InventoryReportProviderParameters _args = new InventoryReportProviderParameters();
            _args = args as InventoryReportProviderParameters;
            if (string.IsNullOrEmpty(_args.connectionstring) || string.IsNullOrEmpty(_args.warehous))
            {
                throw new NullReferenceException();
            }
            if (getCount(_args) > 0)
            {

                MemoryStream ms = new MemoryStream();
                XmlWriterSettings xws = new XmlWriterSettings();
                xws.OmitXmlDeclaration = true;
                xws.Indent = true;
                _args.tagnamespace = "http://kaifa.b2b.schemas/InventoryReport";
                using (XmlWriter xw = XmlWriter.Create(ms, xws))
                {
                    InventoryReportGenerator report = new InventoryReportGenerator(false, _args.configPath, _args.fromRole, _args.tostxRole, _args.toe2openRole, _args.warehous, _args.connectionstring, _args.tagnamespace);
                    XDocument doc = report.Generator();
                    doc.WriteTo(xw);
                }
                ms.Seek(0, SeekOrigin.Begin);
                System.Diagnostics.Trace.WriteLine("Create Inventory Report ", "InventoryReportProvider");
                return ms;
            }
            else
            {
                return null;
            }

        }