Пример #1
0
        private static List <Item> GetSourceItems(OracleConnection conn, string schemeName)
        {
            List <Item> output = new List <Item>();
            string      sql    = "SELECT * FROM WV_BOQ_DATA WHERE SCHEME_NAME='" + schemeName + "'";

            using (OracleDataReader dr = UtilityDb2.GetDataReader(sql, conn))
            {
                while (dr.Read())
                {
                    Item item = new Item();
                    item.ContractNo = dr["CONTRACT_NO"].ToString();
                    item.ItemNo     = dr["ITEM_NO"].ToString();
                    item.Quantity   = Convert.ToSingle(dr["PU_QTY"]);

                    string isposp = dr["ISP_OSP"].ToString();
                    if (isposp.ToUpper() == "ISP")
                    {
                        item.CotRt = "COT";
                    }
                    else if (isposp.ToUpper() == "OSP")
                    {
                        item.CotRt = "RT";
                    }

                    output.Add(item);
                }
            }
            return(output);
        }
Пример #2
0
        private static List <Package> GetPackages(OracleConnection conn,
                                                  Item originalItem, string [] userSpecifiedPackages)
        {
            List <Package> packages = new List <Package>();

            // create packages according to the quantity of the item.
            for (int i = 0; i < originalItem.Quantity; i++)
            {
                Package package = new Package();
                package.OriginalItem = originalItem;
                packages.Add(package);
            }

            // find items for the packages
            bool   hasItems = false;
            string sql      = "SELECT * FROM WV_PACKAGE_MAST WHERE MANDATORY='Y' AND CONTRACT_NO='" +
                              originalItem.ContractNo + "' AND PACKAGE_ITEM_NO='" + originalItem.ItemNo + "'";

            using (OracleDataReader dr = UtilityDb2.GetDataReader(sql, conn))
            {
                while (dr.Read())
                {
                    hasItems = true;

                    foreach (Package package in packages)
                    {
                        Package.PackageItem specItem = new Package.PackageItem();
                        specItem.ItemNo     = dr["ITEM_NO"].ToString();
                        specItem.Quantity   = Convert.ToSingle(dr["ITEM_QTY"]);
                        specItem.Mandatory  = dr["MANDATORY"].ToString().ToUpper() == "Y";
                        specItem.CotRt      = dr["COT-RT"].ToString();
                        specItem.ItemType   = dr["TYPE"].ToString();
                        specItem.ContractNo = dr["CONTRACT_NO"].ToString();
                        package.SpecifiedItems.Add(specItem);
                    }
                }
            }

            // return the list of created packages if items were found
            // otherwise return null

            foreach (string strPackageItemNo in userSpecifiedPackages)
            {
                if (strPackageItemNo.Trim() == originalItem.ItemNo)
                {
                    return(packages);
                }
            }

            return(null);
        }