public AddSale() { this.Text = "Add Sale"; this.Size = new Size(480, 320); this.StartPosition = FormStartPosition.CenterScreen; _product = new ProductSearch(this); _product.Location = new Point(10, 10); _add = new Button(); _add.Location = new Point(300, 260); _add.AutoSize = true; _add.Text = "Add"; _add.Click += addSaleClick; _add.Enabled = false; _cancel = new Button(); _cancel.Location = new Point(380, 260); _cancel.AutoSize = true; _cancel.Text = "Cancel"; _cancel.Click += (s, e) => this.Close(); this.Controls.Add(_product); this.Controls.Add(_add); this.Controls.Add(_cancel); }
public EditSale(int orderNo) { _orderNo = orderNo; _oldLbl = new Label(); _oldNameBox = new TextBox(); _oldDateBox = new TextBox(); _product = new ProductSearch(this, 410); _newLbl = new Label(); _datePicker = new DateTimePicker(); _delete = new Button(); _edit = new Button(); _cancel = new Button(); int productId = RetrieveOldSale(); this.SuspendLayout(); this.Text = "Edit Sale No. " + orderNo; this.Size = new Size(480, 350); this.StartPosition = FormStartPosition.CenterScreen; _oldLbl.Location = new Point(10, 12); _oldLbl.Text = "Old:"; _oldLbl.AutoSize = true; _oldNameBox.Location = new Point(50, 10); _oldNameBox.Size = new Size(200, 30); _oldNameBox.ReadOnly = true; _oldDateBox.Location = new Point(260, 10); _oldDateBox.Size = new Size(200, 30); _oldDateBox.ReadOnly = true; _product.Location = new Point(50, 40); _newLbl.Location = new Point(10, 257); _newLbl.AutoSize = true; _newLbl.Text = "New:"; _datePicker.Location = new Point(260, 255); _datePicker.Size = new Size(200, 30); _datePicker.Format = DateTimePickerFormat.Custom; _datePicker.CustomFormat = Database.DateFormat + " tt"; _delete.Location = new Point(10, 290); _delete.Text = "Delete"; _delete.Click += deleteButtonClick; _edit.Location = new Point(300, 290); _edit.Text = "Edit"; _edit.Click += editButtonClick; _cancel.Location = new Point(380, 290); _cancel.Text = "Cancel"; _cancel.Click += (s, e) => this.Close(); this.Controls.Add(_oldLbl); this.Controls.Add(_oldNameBox); this.Controls.Add(_oldDateBox); this.Controls.Add(_newLbl); this.Controls.Add(_datePicker); this.Controls.Add(_delete); this.Controls.Add(_edit); this.Controls.Add(_cancel); this.Controls.Add(_product); this.ResumeLayout(false); this.PerformLayout(); }