예제 #1
0
 public Kit(string productnumber, BKit kitBarcode, LinkedList <Component> components, int componentstd, int componentqty) : base(productnumber)
 {
     this.productid    = kitBarcode.ProductId;
     this.description  = kitBarcode.Description;
     this.serialnumber = kitBarcode.SerialNumber;
     this.components   = components;
     this.componentstd = componentstd;
     this.componentqty = componentqty;
 }
예제 #2
0
        /// <summary>
        /// Builds a Kit object based of the given barcode object information
        /// </summary>
        /// <param name="barcode"></param>
        /// <returns>Kit</returns>
        private Kit KitProduct(BKit barcode)
        {
            SQLBuilder builder           = new SQLBuilder();
            int        component_qty_std = 0;
            int        qty_in_kit        = 0;

            // Query for information about the kit
            builder.add("SELECT");
            builder.add(@"component_product_number,
                          component_description,
                          kit_product_number,
                          component_quantity_in_kit_std,
                          qty_in_kit");
            builder.add("FROM doarni.southaven_kit_data");
            builder.add(string.Format("WHERE kit_product_number = '{0}' AND serial_number = {1}", barcode.ProductNumber, barcode.SerialNumber));

            // Create collection of components for the kit
            LinkedList <Component> components = new LinkedList <Component>();

            DataTable dt = postgres.execute(builder.build(), true);

            // Build LinkedList of components in the kit
            foreach (DataRow row in dt.Rows)
            {
                string component_prod_num = row[0].ToString();
                string component_desc     = row[1].ToString();
                string kit_prod_num       = barcode.ProductNumber;
                component_qty_std += int.Parse(row[3].ToString());
                qty_in_kit        += int.Parse(row[4].ToString());

                components.AddLast(new Component(component_prod_num, component_desc, kit_prod_num, int.Parse(row[3].ToString()), int.Parse(row[4].ToString())));
            }

            // Return the completed kit object
            return(new Kit(barcode.ProductNumber, barcode, components, component_qty_std, qty_in_kit));
        }