Example #1
0
        private void AddItemForm_Load(object sender, EventArgs e)
        {
            this.Text = "Add New Item | " + Program.storeName;
            List <String> unitList = SqliteDataAccess.getAllUniqueUnitsName();

            cmbxUnit.Items.AddRange(unitList.ToArray <object>());
        }
        private void EditItemForm_Load(object sender, EventArgs e)
        {
            List <String> unitList = SqliteDataAccess.getAllUniqueUnitsName();

            cmbxUnit.Items.AddRange(unitList.ToArray <object>());

            try
            {
                Item toBeEdited = SqliteDataAccess.getItemByID(ID);
                lblItemID.Text        = toBeEdited.ID.ToString();
                txtName.Text          = toBeEdited.Name;
                nudBuyingPrice.Value  = Convert.ToDecimal(toBeEdited.BuyingPrice);
                nudSellingPrice.Value = Convert.ToDecimal(toBeEdited.SellingPrice);
                nudQuantity.Value     = Convert.ToDecimal(toBeEdited.Quantity);
                cmbxUnit.Text         = toBeEdited.Unit;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to get the item with the ID of “" + ID + "” from database for editing.\n\n\nError Message:\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }