コード例 #1
0
        private void buttonSearchSoftware_Click(object sender, EventArgs e)
        {
            int choice = comboBoxsearchsoftware.SelectedIndex;

            switch (choice)
            {
            case -1:
                MessageBox.Show("Please select the search option");
                break;

            case 0:
                Software soft = SoftwareDA.Search(Convert.ToInt32(textBox3.Text));
                if (soft != null)
                {
                    textBoxISBNSoftware.Text      = soft.ISBN.ToString();
                    textBoxTitleSoftware.Text     = soft.Title;
                    textBoxAuthorSoftware.Text    = soft.SoftwareAuthor;
                    textBoxQOHSoftware.Text       = soft.SoftwareQOH.ToString();
                    textBoxSoftwareUnitPrice.Text = soft.SoftwareUnitePrice.ToString();


                    textBoxISBNSoftware.Enabled = false;
                }

                else
                {
                    MessageBox.Show("ISBN not Found!");
                    textBoxEnterInformation.Clear();
                    textBoxEnterInformation.Focus();
                }
                break;

            case 1:
                Software sof = SoftwareDA.SearchTitle(Convert.ToString(textBox3.Text));
                if (sof != null)
                {
                    textBoxISBNSoftware.Text      = sof.ISBN.ToString();
                    textBoxTitleSoftware.Text     = sof.Title;
                    textBoxAuthorSoftware.Text    = sof.SoftwareAuthor;
                    textBoxQOHSoftware.Text       = sof.SoftwareQOH.ToString();
                    textBoxSoftwareUnitPrice.Text = sof.SoftwareUnitePrice.ToString();


                    textBoxISBNSoftware.Enabled = false;

                    textBoxISBN.Enabled = false;
                }

                else
                {
                    MessageBox.Show("Title not Found!");
                    textBox3.Clear();
                    textBox3.Focus();
                }
                break;

            default:
                break;
            }
        }
コード例 #2
0
        private void buttonListSoftware_Click(object sender, EventArgs e)
        {
            listViewAuthor.Items.Clear();


            SoftwareDA.ListSoftware(listViewSoftware);
        }
コード例 #3
0
 private void buttonSaveSoftware_Click(object sender, EventArgs e)
 {
     if ((textBoxSoftwareUnitPrice.Text == "") || (textBoxISBNSoftware.Text == "") || (textBoxTitleSoftware.Text == "") || (textBoxAuthorSoftware.Text == "") || (textBoxQOHSoftware.Text == ""))
     {
         MessageBox.Show("You have to fill out all the boxes, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Software soft = new Software();
         soft.ISBN               = Convert.ToInt32(textBoxISBNSoftware.Text);
         soft.Title              = textBoxTitleSoftware.Text;
         soft.SoftwareAuthor     = textBoxAuthorSoftware.Text;
         soft.SoftwareQOH        = Convert.ToInt32(textBoxQOHSoftware.Text);
         soft.SoftwareUnitePrice = Convert.ToInt32(textBoxSoftwareUnitPrice.Text);
         SoftwareDA.Save(soft);
     }
     ClearAll4();
 }
コード例 #4
0
 private void buttonUpdateSoftware_Click(object sender, EventArgs e)
 {
     if ((textBoxSoftwareUnitPrice.Text == "") || (textBoxISBNSoftware.Text == "") || (textBoxTitleSoftware.Text == "") || (textBoxAuthorSoftware.Text == "") || (textBoxQOHSoftware.Text == ""))
     {
         MessageBox.Show("You have to fill out all the boxes, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Software soft = new Software();
         soft.ISBN               = Convert.ToInt32(textBoxISBNSoftware.Text);
         soft.Title              = textBoxTitleSoftware.Text;
         soft.SoftwareAuthor     = textBoxAuthorSoftware.Text;
         soft.SoftwareQOH        = Convert.ToInt32(textBoxQOHSoftware.Text);
         soft.SoftwareUnitePrice = Convert.ToInt32(textBoxSoftwareUnitPrice.Text);
         DialogResult ans = MessageBox.Show("Do you really want to update this author?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (ans == DialogResult.Yes)
         {
             SoftwareDA.Update(soft);
             MessageBox.Show("author record has been updated successfully", "Confirmation");
         }
         ClearAll4();
     }
 }
コード例 #5
0
 private void buttonDeleteSoftware_Click(object sender, EventArgs e)
 {
     SoftwareDA.Delete(Convert.ToInt32(textBoxISBNSoftware.Text));
     MessageBox.Show(" Software record has been deleted successfully", "Confirmation");
     ClearAll4();
 }