コード例 #1
0
      private void button5_Click(object sender, EventArgs e)
      {
          //show bill by bill id (customer enters id)

          bill      g = new bill();
          customer1 l = new customer1();

          string o    = textBox3.Text;
          bool   done = false;

          for (int i = 0; i < bills.Count; i++)
          {
              if (bills[i].id == int.Parse(o) && bills[i].customer_email == curraccount.email)
              {
                  done             = true;
                  g.customer_email = bills[i].customer_email;
                  g.delivry_name   = bills[i].delivry_name;
                  g.id             = bills[i].id;
                  g.products       = bills[i].products;
                  g.total_price    = bills[i].total_price;
                  l.address        = curraccount.address;
                  l.phone          = curraccount.phone;

                  g.delivry_data = bills[i].delivry_data;
                  Order_Bill j = new Order_Bill(g, l);
                  j.Show();
                  break;
              }
          }
          if (done == false)
          {
              MessageBox.Show("No Bill with that ID");
          }
          textBox3.Text = "";
      }
コード例 #2
0
        private void button7_Click(object sender, EventArgs e)
        {
            //Show Customer bills (the manager enters customer email)  <<<<<<<<<<<<<<<<<<<<<<<<<<<
            bill      g     = new bill();
            customer1 l     = new customer1();
            bool      exist = false;

            string s = textBox8.Text;

            for (int i = 0; i < C.Count; i++)
            {
                if (C[i].email == s)
                {
                    exist = true;
                    for (int y = 0; y < bills.Count; y++)
                    {
                        if (bills[y].customer_email == s && bills[y].customer_email == C[i].email)
                        {
                            g.customer_email = C[i].email;
                            g.delivry_name   = bills[y].delivry_name;
                            g.id             = bills[y].id;
                            g.products       = bills[y].products;
                            g.total_price    = bills[y].total_price;
                            g.delivry_data   = bills[y].delivry_data;
                            l.address        = C[i].address;
                            l.phone          = C[i].phone;
                            Order_Bill j = new Order_Bill(g, l);
                            j.Show();
                        }
                    }

                    break;
                }
            }
            if (exist == false)
            {
                MessageBox.Show("There is no bills for this E-mail");
            }

            textBox8.Text = "";
        }
コード例 #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            bill      g     = new bill();
            customer1 l     = new customer1();
            bool      exist = false;

            //int x;
            //int y;
            //int z;
            //x=int.Parse(comboBox2.Text);
            //y=int.Parse(comboBox1.Text);
            //z=int.Parse(comboBox3.Text);
            for (int i = 0; i < bills.Count; i++)
            {
                if (int.Parse(comboBox2.Text) == bills[i].delivry_data.Day && int.Parse(comboBox1.Text) == bills[i].delivry_data.Month && int.Parse(comboBox3.Text) == bills[i].delivry_data.Year)
                {
                    exist = true;
                    for (int p = 0; p < C.Count; p++)
                    {
                        if (g.customer_email == C[p].email)
                        {
                            g.customer_email = C[p].email;
                            g.delivry_name   = bills[i].delivry_name;
                            g.id             = bills[i].id;
                            g.products       = bills[i].products;
                            g.total_price    = bills[i].total_price;
                            g.delivry_data   = bills[i].delivry_data;
                            l.address        = C[p].address;
                            l.phone          = C[p].phone;
                            Order_Bill j = new Order_Bill(g, l);
                            j.Show();
                        }
                    }
                }
            }
            if (exist == false)
            {
                MessageBox.Show("No Bills with that Date");
            }
        }
コード例 #4
0
      private void MakeOrder(object sender, EventArgs e)
      {
          //Show Bill<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

          bill b = new bill();

          b.customer_email = curraccount.email;
          DateTime x = DateTime.Now;

          x = x.AddHours(2);
          List <string> pro = new List <string>();

          for (int i = 0; i < dataGridView2.Rows.Count; i++)
          {
              Product p = new Product();
              p.product = dataGridView2.Rows[i].Cells[0].Value.ToString();

              p.quantity     = int.Parse(dataGridView2.Rows[i].Cells[1].Value.ToString());
              p.price        = float.Parse(dataGridView2.Rows[i].Cells[3].Value.ToString());
              b.total_price += p.price;
              b.delivry_data = x;
              b.products.Add(p);
          }
          ///////////////////////////////////////////////////////////////////
          for (int i = 0; i < employee.Count; i++)
          {
              if (employee[i].numorder < 2)
              {
                  employee[i].numorder++;
                  b.delivry_name = employee[i].name;
                  break;
              }
          }

          bills.Add(b);
          Order_Bill ob = new Order_Bill(b, curraccount);

          ob.Show();
      }
コード例 #5
0
 public Order_Bill(bill x, customer1 g)
 {
     v = g;
     z = x;
     InitializeComponent();
 }