public override void setTableLayoutSizes(TableLayoutPanel tableLayout) { ProductStyles product = Overcuts.product; int columnIndex = 0; tableLayout.Controls.Add(new Label() { Text = product.getStyleCode(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); tableLayout.Controls.Add(new Label() { Text = product.getColorCode(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); foreach (KeyValuePair <string, string> productSize in product.getStyleSizes()) { int sizeQty = 0; this.qtySoldPerSize.TryGetValue(productSize.Value.ToUpper(), out sizeQty); tableLayout.Controls.Add(new Label() { Text = sizeQty.ToString(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); } tableLayout.Controls.Add(new Label() { Text = this.totalUnits.ToString(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex, row); }
private void button1_Click(object sender, EventArgs e) { try { string errors = this.validateInput(); if (errors != "") { MessageBox.Show(errors); return; } int desiredQuantity = Int32.Parse(unitsInput.Text.ToString()); string styleCode = styleInput.Text.ToString(); string colorCode = colorInput.Text.ToString(); string orderFromS = orderFrom.Value.Date.ToString("yyyyMMdd"); string orderToS = orderTo.Value.Date.ToString("yyyyMMdd"); int currDate = Int32.Parse(DateTime.Now.ToString("yyyyMMdd")); string orderFromDate = orderFrom.Value.Date.ToString("yyyy-MM-dd"); string orderToDate = orderFrom.Value.Date.ToString("yyyy-MM-dd"); if (currDate <= Int32.Parse(orderFromS)) { orderFromS = ""; orderFromDate = ""; } if (currDate <= Int32.Parse(orderToS)) { orderToS = ""; orderToDate = ""; } this.product = new ProductStyles(styleCode, colorCode, desiredQuantity); Overcuts.setProduct(this.product); EcommOvercuts ecomm = new EcommOvercuts(); WholesalesOvercuts wholesale = new WholesalesOvercuts(); RetailOvercuts retail = new RetailOvercuts(); ecomm.getOvercuts(styleCode, colorCode, orderFromS, orderToS); wholesale.getOvercuts(styleCode, colorCode, orderFromS, orderToS); retail.getOvercuts(styleCode, colorCode, orderFromDate, orderToDate); EcommRetailOvercuts ecommRetail = new EcommRetailOvercuts(ecomm, retail); DrawOvercuts draw = new DrawOvercuts(this.form); draw.drawOvercuts(ecommRetail).drawOvercuts(ecomm).drawOvercuts(wholesale).drawOvercuts(retail); } catch (Exception exp) { MessageBox.Show(exp.ToString()); } }
public override void setTableLayoutEstimateSizes(TableLayoutPanel tableLayout) { int desiredQuantity = Overcuts.product.getDesiredQuantity(); ProductStyles product = Overcuts.product; int columnIndex = 0; tableLayout.Controls.Add(new Label() { Text = "Estimation", Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); tableLayout.Controls.Add(new Label() { Text = "" }, columnIndex++, row); foreach (KeyValuePair <string, string> productSize in product.getStyleSizes()) { int sizeQty = 0; this.qtySoldPerSize.TryGetValue(productSize.Value.ToUpper(), out sizeQty); double percentage = 0; if (this.totalUnits > 0) { percentage = (double)sizeQty / (double)this.totalUnits; } int estimatedSizeQuantity = (int)(percentage * (double)desiredQuantity); tableLayout.Controls.Add(new Label() { Text = estimatedSizeQuantity.ToString(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); } tableLayout.Controls.Add(new Label() { Text = desiredQuantity.ToString(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex, row); }
public void combineTotals() { ProductStyles product = Overcuts.product; overcutvalues["PRODUCTCODE"] = product.getStyleCode(); overcutvalues["COLORCODE"] = product.getColorCode(); foreach (KeyValuePair <string, string> productSize in product.getStyleSizes()) { int sizeQtyRetail = 0; retail.qtySoldPerSize.TryGetValue(productSize.Value.ToUpper(), out sizeQtyRetail); int sizeQtyEcomm = 0; ecomm.unitsBySize.TryGetValue(productSize.Key.ToUpper(), out sizeQtyEcomm); int sizeQtyTotal = sizeQtyEcomm + sizeQtyRetail; this.unitsBySize[productSize.Key.ToUpper()] = sizeQtyTotal; overcutvalues[productSize.Key.ToUpper()] = sizeQtyTotal.ToString(); } this.totalUnits = retail.getTotalUnits() + ecomm.getTotalUnits(); overcutvalues["UNITSTOTAL"] = this.totalUnits.ToString(); }
public static void resetDefaultVariables() { Overcuts.product = null; }
public static void setProduct(ProductStyles product) { Overcuts.product = product; }