private void button_Inventory_Click(object sender, EventArgs e) { if (check()) { Item item = new Item(); item.BatchNumber = BatchNumbertxt.Text; item.BrandName = BrandNametxt.Text; item.DateArrived = dateTimePicker2.Value; item.ExpiryDate = dateTimePicker1.Value; item.GenericName = GenericNametxt.Text; item.PurchasedPrice = Convert.ToDouble(PurchasedPricetxt.Text); item.SellingPrice = Convert.ToDouble(SellingPricetxt.Text); item.Storage = Storagetxt.Text; item.Quantity = Convert.ToInt32(Quantitytxt.Text); item.Formulation = formulationtxt.Text; item.Threshhold = Convert.ToInt32(threshholdTxt.Text); if (checkBox_IsVatable.Checked == true) item.Vatable = Convert.ToByte(1); } else item.Vatable = Convert.ToByte(0); ItemDatabaseAccess Ida = new ItemDatabaseAccess(); if(Ida.addItem(item)) { this.Close(); } }
private void button_Inventory_Click(object sender, EventArgs e) { if (check()) { Item item = new Item(); item.BatchNumber = BatchNumbertxt.Text; item.BrandName = BrandNametxt.Text; item.DateArrived = Convert.ToDateTime(DateArrivedtxt.Text); item.ExpiryDate = Convert.ToDateTime(ExpiryDatetxt.Text); item.GenericName = GenericNametxt.Text; item.PurchasedPrice = Convert.ToDouble(PurchasedPricetxt.Text); item.SellingPrice = Convert.ToDouble(SellingPricetxt.Text); item.Storage = Storagetxt.Text; item.Quantity = Convert.ToInt32(Quantitytxt.Text); item.Formulation = formulationtxt.Text; ItemDatabaseAccess Ida = new ItemDatabaseAccess(); Ida.addItem(item); } else { MessageBox.Show("Error: Please fill in all required fields"); } }
public Inventory() { InitializeComponent(); Ida = new ItemDatabaseAccess(); FillData(); }