Esempio n. 1
0
      private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
      {
          listBox1.Items.Clear();
          string name = comboBox1.Text;
          Item   it   = (from ite in ent.Items
                         where ite.Item_name == name
                         select ite).First();
          var supplying_permits = (from Supp in it.supplying_permit_items
                                   select Supp);

          foreach (supplying_permit_items s in supplying_permits)
          {
              supplying_permit s_p = (from sp in ent.supplying_permit
                                      where sp.supp_permit_id == s.supp_permit_id
                                      select sp).First();
              listBox1.Items.Add(it.Item_name.Trim() + " has been supplied to warehouse : " + s_p.warehouse.warehouse_name.Trim() + " with amount of " + s.amout + " by : " + s_p.supplier_name);
          }
          var item_sell = it.selling_permit_items;

          foreach (selling_permit_items sell in item_sell)
          {
              selling_permit sell_permit = sell.selling_permit;
              listBox1.Items.Add(it.Item_name.Trim() + " has been sold to warehouse : " + sell_permit.warehouse.warehouse_name.Trim() + " with amount of " + sell.amount);
          }
          var item_exc = it.exchane_permit_items;

          foreach (exchane_permit_items ex in item_exc)
          {
              exchang_permit ex_permit = ex.exchang_permit;
              listBox1.Items.Add(it.Item_name.Trim() + " has been exchanged from : " + ex_permit.warehouse1.warehouse_name.Trim() + " to " + ex_permit.warehouse.warehouse_name.Trim() + " with amount of " + ex.amount);
          }
      }
Esempio n. 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         exchang_permit s   = new exchang_permit();
         int            id  = int.Parse(comboBox1.Text);
         entities       ent = new entities();
         s = (from wa in ent.exchang_permit
              where wa.exc_permit_id == id
              select wa).First();
         s.warehouse_in_id  = int.Parse(comboBox2.Text);
         s.warehouse_out_id = int.Parse(comboBox5.Text);
         exchane_permit_items si = new exchane_permit_items();
         string name             = comboBox4.Text;
         si = (from wa in ent.exchane_permit_items
               where wa.exc_permit_id == id && wa.item_name == name
               select wa).First();
         si.supplier_name = comboBox3.Text;
         si.prod_date     = dateTimePicker1.Value;
         si.amount        = int.Parse(textBox3.Text);
         si.exp_date      = dateTimePicker2.Value;
         ent.SaveChanges();
     }
     catch { MessageBox.Show("enter a valid data"); }
 }
Esempio n. 3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            exchang_permit s   = new exchang_permit();
            int            id  = int.Parse(comboBox1.Text);
            entities       ent = new entities();

            s = (from wa in ent.exchang_permit
                 where wa.exc_permit_id == id
                 select wa).First();
            comboBox2.Text = s.warehouse_in_id.ToString();
            comboBox5.Text = s.warehouse_out_id.ToString();
            exchane_permit_items si = new exchane_permit_items();

            si = (from wa in ent.exchane_permit_items
                  where wa.exc_permit_id == id
                  select wa).First();
            comboBox4.Text = si.item_name;

            comboBox3.Text        = si.supplier_name;
            dateTimePicker1.Value = (DateTime)si.prod_date;
            textBox3.Text         = si.amount.ToString();
            dateTimePicker2.Value = (DateTime)si.exp_date;
        }
Esempio n. 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         entities             ent = new entities();
         exchang_permit       s   = new exchang_permit();
         exchane_permit_items si  = new exchane_permit_items();
         s.exc_permit_id    = int.Parse(comboBox1.Text);
         si.exc_permit_id   = int.Parse(comboBox1.Text);
         s.warehouse_in_id  = int.Parse(comboBox2.Text);
         s.warehouse_out_id = int.Parse(comboBox5.Text);
         si.supplier_name   = comboBox3.Text;
         si.item_name       = comboBox4.Text;
         si.prod_date       = dateTimePicker1.Value;
         si.amount          = int.Parse(textBox3.Text);
         si.exp_date        = dateTimePicker2.Value;
         ent.exchang_permit.Add(s);
         ent.exchane_permit_items.Add(si);
         ent.SaveChanges();
         comboBox1.Text = comboBox2.Text = comboBox3.Text = comboBox4.Text = textBox3.Text = string.Empty;
         MessageBox.Show("permit added");
     }
     catch { MessageBox.Show("failed"); }
 }
Esempio n. 5
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         exchang_permit s   = new exchang_permit();
         int            id  = int.Parse(comboBox1.Text);
         entities       ent = new entities();
         s = (from wa in ent.exchang_permit
              where wa.exc_permit_id == id
              select wa).First();
         exchane_permit_items si = new exchane_permit_items();
         si.exc_permit_id = id;
         si.supplier_name = comboBox3.Text;
         si.item_name     = comboBox4.Text;
         si.prod_date     = dateTimePicker1.Value;
         si.amount        = int.Parse(textBox3.Text);
         si.exp_date      = dateTimePicker2.Value;
         ent.exchane_permit_items.Add(si);
         ent.SaveChanges();
         comboBox1.Text = comboBox2.Text = comboBox3.Text = comboBox4.Text = textBox3.Text = string.Empty;
         MessageBox.Show("item added");
     }
     catch { MessageBox.Show("enter a valid data"); }
 }