Exemplo n.º 1
0
        private void addHeader(TableLayoutPanel tableLayout)
        {
            int row         = 0;
            int columnIndex = 0;

            tableLayout.Controls.Add(new Label()
            {
                Text = "Style", Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter
            }, columnIndex++, row);
            tableLayout.Controls.Add(new Label()
            {
                Text = "Color", Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter
            }, columnIndex++, row);


            foreach (KeyValuePair <string, string> productSize in Overcuts.getProduct().getStyleSizes())
            {
                tableLayout.Controls.Add(new Label()
                {
                    Text = productSize.Value, Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter
                }, columnIndex++, row);
            }
            tableLayout.Controls.Add(new Label()
            {
                Text = "Totals", Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter
            }, columnIndex, row);
        }
Exemplo n.º 2
0
        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());
            }
        }
Exemplo n.º 3
0
        public DrawOvercuts drawOvercuts(Overcuts overcut)
        {
            try
            {
                overcut.removePanel(this.form);

                if (!overcut.hasRows())
                {
                    return(this);
                }

                overcut.drawTableLabel(this.form, this.xPos, this.yPos);
                this.yPos += 40;

                TableLayoutPanel tableLayoutPanel1 = new TableLayoutPanel();

                tableLayoutPanel1.SuspendLayout();


                this.createColumns(tableLayoutPanel1);

                this.addHeader(tableLayoutPanel1);

                overcut.incrementRowCount();
                overcut.setTableLayoutSizes(tableLayoutPanel1);

                overcut.incrementRowCount();
                overcut.setTableLayoutEstimateSizes(tableLayoutPanel1);

                tableLayoutPanel1.Location = new System.Drawing.Point(xPos, yPos);
                tableLayoutPanel1.Name     = overcut.getTableName();
                this.createRows(tableLayoutPanel1);

                tableLayoutPanel1.Size       = new System.Drawing.Size(this.tableWidth, this.tableHeight);
                tableLayoutPanel1.TabIndex   = 0;
                tableLayoutPanel1.CellPaint += this.tableLayoutPanel1_CellPaint;

                this.form.Controls.Add(tableLayoutPanel1);
                tableLayoutPanel1.ResumeLayout(false);
                tableLayoutPanel1.PerformLayout();

                this.yPos += this.getNextTableYPosition();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            return(this);
        }