public void clearAll() { this.cbProductID.Text = ""; this.txtUnitPrice.Text = ""; this.txtQty.Text = ""; this.txtDiscount.Text = ""; this.result = null; }
public void clearForm() { this.cbProductID.SelectedIndex = 0; this.txtUnitPrice.Text = ""; this.txtQty.Text = ""; this.txtUnitPrice.Text = ""; result = null; }
protected void doAdd() { this.errorProvider.Clear(); this.errorProvider.Clear(); result = new Order.OrderItem(); if (cbProductID.SelectedIndex == 0) this.errorProvider.SetError(cbProductID, "CANNOT BE EMPTY"); else { OrderModel.OrderDetailModel.IdItem idItem = (OrderModel.OrderDetailModel.IdItem)this.cbProductID.SelectedItem; result.Productid = idItem.Id; } try { result.Qty = int.Parse(this.txtQty.Text); } catch { this.errorProvider.SetError(txtQty, "INVALID NUMBER"); } try { result.Discount = float.Parse(this.txtDiscount.Text); } catch { this.errorProvider.SetError(txtDiscount, "INVALID VALUE"); } try { result.Uinitprice = float.Parse(this.txtUnitPrice.Text); } catch { this.errorProvider.SetError(txtUnitPrice, "INVALID VALUE"); } if (result.isValid() < 0) { result = null; return; } this.Close(); }
private void cbProductID_SelectedIndexChanged(object sender, EventArgs e) { if (this.cbProductID.SelectedIndex > 0) { OrderModel.OrderDetailModel.IdItem idItem = (OrderModel.OrderDetailModel.IdItem)this.cbProductID.SelectedItem; int Productid = idItem.Id; if (model.DataSource.Rows.Count > 0) { Order.OrderItem tmp = new Order.OrderItem(); model.setPrimaryKey(); tmp.Productid = Productid; DataRow r = model.DataSource.Rows.Find(Productid); if (r != null) { MessageBox.Show("This product has aldready selected.\nPlease choose another or change the existing item."); this.cbProductID.Text = ""; return; } } float price = this.model.getUnitPrice(Productid); this.txtUnitPrice.Text = price.ToString(); } }