コード例 #1
0
 private void guna2CircleButton1_Click_1(object sender, EventArgs e)
 {
     /*   name = guna2TextBox5.Text;
      * manufacture = guna2TextBox2.Text;
      * serial_number = guna2TextBox1.Text;
      * type = Convert.ToString(guna2ComboBox1.SelectedItem);
      * specs = richTextBox1.Text;
      * price = guna2TextBox3.Text;*/
     if (Convert.ToString(guna2ComboBox1.SelectedItem) == "Rams")
     {
         type     = "Rams";
         Comps[i] = new Rams(name, serial_number, manufacture);
     }
     else if (Convert.ToString(guna2ComboBox1.SelectedItem) == "MotherBoard")
     {
         type     = "MotherBoard";
         Comps[i] = new MotherBoard(name, serial_number, manufacture);
     }
     else if (Convert.ToString(guna2ComboBox1.SelectedItem) == "GPU")
     {
         type     = "GPU";
         Comps[i] = new GPU(name, serial_number, manufacture);
     }
     cnn.Open();
     data.InsertCommand            = new SqlCommand("INSERT INTO Components VALUES(@Serial_Number,@Name,@Manufacture,@Specs,@Type,@Price)");
     data.InsertCommand.Connection = cnn;
     data.InsertCommand.Parameters.Add("@Serial_Number", serial_number);
     data.InsertCommand.Parameters.Add("@Name", name);
     data.InsertCommand.Parameters.Add("@Manufacture", manufacture);
     data.InsertCommand.Parameters.Add("@Specs", specs);
     data.InsertCommand.Parameters.Add("@Type", type);
     data.InsertCommand.Parameters.Add("@Price", price);
     data.InsertCommand.ExecuteNonQuery();
     cnn.Close();
     MessageBox.Show("Added !");
     clearTexts();
     i++;
 }
コード例 #2
0
 public double Invoicee(User user, Component comp)
 {
     if (user is Normal_User)
     {
         Normal_User x = user as Normal_User;
         if (comp is Rams)
         {
             Rams z = comp as Rams;
             price = x.DiscounT * z.PRice;
         }
         else if (comp is GPU)
         {
             GPU z = comp as GPU;
             price = x.DiscounT * z.PRice;
         }
         else
         {
             MotherBoard z = comp as MotherBoard;
             price = x.DiscounT * z.PRice;
         }
     }
     return(price);
 }