コード例 #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (listBox1.Items.Count != 0)
     {
         if (!checkBox1.Checked)
         {
             if (inputCheck.SelectedItemCheck(listBox1.SelectedIndex))
             {
                 int ind = listBox1.SelectedIndex;
                 if (inputCheck.AccessMessage(String.Format("Do you want delete this records? ({0})", OneProd(products[ind]))))
                 {
                     bd.WorkWithBD(String.Format("UPDATE Products SET Quantity = {0} WHERE Id = {1}", Int32.Parse(products[ind][4]) + 1, products[ind][5]));
                     bd.WorkWithBD(String.Format("DELETE TOP (1) FROM Buckets WHERE idProducts = {0}", products[ind][5]));
                     Bucket();
                 }
             }
         }
         else
         {
             if (inputCheck.AccessMessage("Do you want delete all records?"))
             {
                 for (int i = 0; i < products.Length; i++)
                 {
                     bd.WorkWithBD(String.Format("UPDATE Products SET Quantity = {0} WHERE Id = {1}", Int32.Parse(products[i][4]) + 1, products[i][5]));
                     bd.WorkWithBD(String.Format("DELETE TOP (1) FROM Buckets WHERE idProducts = {0}", products[i][5]));
                 }
                 Bucket();
             }
         }
     }
     else
     {
         error.ErrorMessage(12);
     }
 }
コード例 #2
0
        public void SelectedItemCheck_NegativeId_FalseReturned()
        {
            int id = -1;

            CorrectInputCheck inputCheck = GetInputCheck();
            bool actual = inputCheck.SelectedItemCheck(id);

            Assert.IsFalse(actual);
        }
コード例 #3
0
        public void SelectedItemCheck_PositiveId_TrueReturned()
        {
            int id = 2;

            CorrectInputCheck inputCheck = GetInputCheck();
            bool actual = inputCheck.SelectedItemCheck(id);

            Assert.IsTrue(actual);
        }