Exemple #1
0
        private void listViewInventory_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = listViewInventory.FocusedItem.Index;

            if (comboBoxProduct.Text == "Book")
            {
                List <Book> myBookList = ProductDA.GetBook();

                textBoxISBN.Text            = Convert.ToString(myBookList[index].Isbn);
                textBoxName.Text            = myBookList[index].Name;
                textBoxPrice.Text           = Convert.ToString(myBookList[index].Price);
                textBoxYear.Text            = Convert.ToString(myBookList[index].Year);
                textBoxQOH.Text             = Convert.ToString(myBookList[index].Qoh);
                textBoxCategoryVersion.Text = myBookList[index].Category;
            }
            else
            {
                if (comboBoxProduct.Text == "Software")
                {
                    List <Software> mySoftwareList = ProductDA.GetSoftware();

                    textBoxName.Text            = mySoftwareList[index].Name;
                    textBoxPrice.Text           = Convert.ToString(mySoftwareList[index].Price);
                    textBoxYear.Text            = Convert.ToString(mySoftwareList[index].Year);
                    textBoxQOH.Text             = Convert.ToString(mySoftwareList[index].Qoh);
                    textBoxCategoryVersion.Text = mySoftwareList[index].Version;
                }
                RefreshList();
            }
        }
Exemple #2
0
        public static void DeleteSoftware(Software software)
        {
            List <Software> mySoftwareList = ProductDA.GetSoftware();

            using (StreamWriter sw = new StreamWriter(filePathTemp))
            {
                foreach (Software element in mySoftwareList)
                {
                    if (element.Name != software.Name)
                    {
                        sw.WriteLine(element.GetSoftwareInfo());
                    }
                }
            }
            File.Replace(filePathTemp, filePathSoftware, filePathBackup);
        }
Exemple #3
0
 public void RefreshList()
 {
     if (comboBoxProduct.Text == "Book")
     {
         listViewInventory.Items.Clear();
         List <Book> myBookList = ProductDA.GetBook();
         foreach (Book element in myBookList)
         {
             listViewInventory.Items.Add(ProductDA.ConvertToListViewItemBook(element));
         }
     }
     else
     {
         if (comboBoxProduct.Text == "Software")
         {
             listViewInventory.Items.Clear();
             List <Software> mySoftwareList = ProductDA.GetSoftware();
             foreach (Software element in mySoftwareList)
             {
                 listViewInventory.Items.Add(ProductDA.ConvertToListViewItemSoftware(element));
             }
         }
     }
 }