コード例 #1
0
        public static Dictionary <string, object> BindMonthlyUsage(string CorpID, string FacilityID, string VendorID, string CategoryID, Nullable <DateTime> Month, Nullable <DateTime> DateFrom, Nullable <DateTime> DateTo, string ItemID, string ortype)
        {
            try
            {
                InventoryServiceClient lclsservice = new InventoryServiceClient();
                Page_Controls          defaultPage = new Page_Controls();

                BALReport llstReport = new BALReport();
                string    Status     = string.Empty;
                llstReport.CorporateID    = CorpID;
                llstReport.FacilityID     = FacilityID;
                llstReport.VendorID       = VendorID;
                llstReport.ItemCategoryID = CategoryID;
                if (Convert.ToString(Month) != "")
                {
                    llstReport.DateFrom = Month;
                }
                else
                {
                    llstReport.DateFrom = DateFrom;
                }

                llstReport.DateTo = DateTo;
                if (ItemID != "")
                {
                    llstReport.ItemID = ItemID;
                }
                if (ortype != "0")
                {
                    llstReport.OrderType = ortype;
                }
                llstReport.LoggedInBy = Roleid;
                llstReport.Filter     = "";

                //List<object> llstdata = new List<object>();
                //llstdata = lclsservice.GetMonthlyUsageReport(llstReport).ToList();
                DataSet ds = new DataSet();
                //ds = (DataSet)llstdata[1];

                ds = lclsservice.GetMonthlyUsageReport(llstReport);

                DataTable dtColumns = new DataTable();
                dtColumns.Columns.Add("title");
                dtColumns.Columns.Add("data");
                DataRow drr = null;
                Dictionary <string, object> list = new Dictionary <string, object>();

                if (ds != null)
                {
                    foreach (DataColumn dr in ds.Tables[0].Columns)
                    {
                        dtColumns.NewRow();
                        dtColumns.Rows.Add(dr.ToString(), dr.ToString());
                    }

                    list["List01"] = GetDataTableDictionaryList(ds.Tables[0]);
                    list["List02"] = GetDataTableDictionaryList(dtColumns);
                    //list["List03"] = llstdata[0].ToString();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw;
            }
        }