示例#1
0
 private void button2_Click_1(object sender, EventArgs e)
 {
     if (ExitingCoustumer.Customer != "" && CostumerSearch.Text != "" && ExitingCoustumer.Customer == CostumerSearch.Text)
     {
         MessageBox.Show(Customer, "You have place this customer:", MessageBoxButtons.OK);
         this.Close();
         Checkout ss = new Checkout();
         ss.label4.Text  = ExitingCoustumer.Customer;
         ss.label6.Text  = FindProduct.Product;
         ss.label3.Text  = FindProduct.Quantity;
         ss.label11.Text = FindProduct.Product_name;
         if (FindProduct.int_Product_price != 0)
         {
             ss.label9.Text = FindProduct.int_Product_price.ToString();
         }
         ss.Show();
     }
     else
     {
         MessageBox.Show("You didnt place a customer, please try again", "Error", MessageBoxButtons.OK);
     }
 }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Checkout mm = new Checkout();

            mm.Show();
        }
示例#3
0
 private void Button2_Click(object sender, EventArgs e)
 {
     if (label4.Text == "" && label6.Text == "")
     {
         MessageBox.Show("You didn't place a costumer and Product!");
     }
     else if (label4.Text == "")
     {
         MessageBox.Show("You didn't place a costumer!");
     }
     else if (label6.Text == "")
     {
         MessageBox.Show("You didn't place a Product!");
     }
     else
     {
         SqlConnection  conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\PROJECT\TEAM5\TEAM5\TEAM5 PROJECT\DATABASE\STOREMANGE.MDF;Integrated Security=True;Connect Timeout=30");
         SqlDataAdapter sda  = new SqlDataAdapter("select Price from Inventory where Serialnumber ='" + FindProduct.Product + "'", conn);
         DataTable      dt   = new DataTable();
         sda.Fill(dt);
         string         New_price = dt.Rows[0]["Price"].ToString();
         SqlCommand     sda2      = new SqlCommand("INSERT INTO Orders (Product_Serial,Price,Quantity,Date,Seller_name,Buyer_Id) VALUES ('" + FindProduct.Product + "','" + FindProduct.int_Product_price + "','" + FindProduct.Quantity + "','" + Login.date + "','" + Login.UserID + "','" + ExitingCoustumer.Customer + "')", conn);
         SqlDataAdapter da        = new SqlDataAdapter(sda2);
         DataTable      dt1       = new DataTable();
         da.Fill(dt1);
         try
         {
             SqlCommand     sda4 = new SqlCommand(" update Inventory set Quantity = '" + FindProduct.int_Update_quaintity + " ' where Serialnumber  ='" + FindProduct.Product + "'", conn);
             SqlDataAdapter da4  = new SqlDataAdapter(sda4);
             DataTable      dt4  = new DataTable();
             da4.Fill(dt4);
             MessageBox.Show("Inventory Updeated", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         if (MessageBox.Show("Greetings, the product was successfully sold.Would you like to choose another product?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             FindProduct.Product      = "";
             FindProduct.Product_name = "";
             FindProduct.Quantity     = "";
             this.Close();
             FindProduct mm = new FindProduct();
             mm.Show();
         }
         else
         {
             FindProduct.Product       = "";
             FindProduct.Product_name  = "";
             FindProduct.Quantity      = "";
             ExitingCoustumer.Customer = "";
             label4.Text = "";
             this.Close();
             Checkout mm = new Checkout();
             mm.label4.Text  = "";
             mm.label9.Text  = "";
             mm.label6.Text  = "";
             mm.label3.Text  = "";
             mm.label11.Text = "";
             mm.Show();
         }
     }
 }