Example #1
0
        /// <summary>
        /// load up the found details for an inventory item
        /// </summary>
        /// <param name="ItemID"></param>
        private void LoadDetails(int ItemID)
        {
            try
            {
                InventoryClasses.InventoryUtilities iu = new InventoryClasses.InventoryUtilities();
                InventoryClasses.InventoryObject io = new InventoryClasses.InventoryObject();
                io = iu.GetInventoryDetails(ItemID.ToString());

                if (io == null)
                {
                    MessageBox.Show("There was a problem retrieving that inventory item", Properties.Settings.Default.MessageBoxTitle, MessageBoxButtons.OK);
                }
                else
                {
                    txtItemID.Text = io.ItemID;
                    txtDescription.Text = io.Description;
                    txtAskPrice.Text = decimal.Round(io.Price, 2).ToString();
                    txtDateIn.Text = io.DateIn.ToString();
                    txtSellPrice.Text = decimal.Round(io.SellPrice, 2).ToString();
                    if (DateTime.Compare(io.DateSold, DateTime.MinValue) == 0)
                    {
                        txtDateSold.Text = string.Empty;
                    }
                    else
                    {
                        txtDateSold.Text = io.DateSold.ToString();
                    }
                    if (DateTime.Compare(io.DatePaid, DateTime.MinValue) == 0)
                    {
                        txtDatePaid.Text = string.Empty;
                    }
                    else
                    {
                        txtDatePaid.Text = io.DatePaid.ToString();
                    }

                    txtPaidAmount.Text = decimal.Round(io.PaidAmount, 2).ToString();
                    txtComment.Text = io.Comment;
                    cboSoldStatus.SelectedIndex = io.SoldStatus;
                    this.ckReturn.Checked = io.Returnable;
                    txtConsignID.Text = io.Consignor.ToString();
                    txtConsignor.Text = io.ConsignorName;

                    if (io.Donate)
                    {
                        lblDonateCheck.Text = "x";
                    }
                    else
                    {
                        lblDonateCheck.Text = "o";
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(string.Format("There was an error: {0}", e.Message), Properties.Settings.Default.MessageBoxTitle, MessageBoxButtons.OK);
            }
        }