Example #1
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"); }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                customer s    = new customer();
                String   name = comboBox1.Text;
                entities ent  = new entities();
                s = (from wa in ent.customers
                     where wa.customer_name == name
                     select wa).First();



                s.fax       = textBox1.Text;
                s.telephone = textBox2.Text;
                s.mobile    = textBox3.Text;
                s.email     = textBox4.Text;
                s.website   = textBox5.Text;

                ent.SaveChanges();
                MessageBox.Show("customer updated");
                comboBox1.Text = textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = string.Empty;
            }
            catch
            {
                MessageBox.Show("failed");
            }
        }
Example #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            item_units i_u = new item_units();
            entities   ent = new entities();

            i_u.item_name = comboBox1.Text;
            i_u.Item_unit = textBox3.Text;


            ent.item_units.Add(i_u);
            ent.SaveChanges();
            MessageBox.Show("item unit added");
            comboBox1.Text = textBox2.Text = textBox3.Text = string.Empty;
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            entities   ent = new entities();
            Item       i   = new Item();
            item_units i_u = new item_units();

            i.Item_name   = comboBox1.Text;
            i_u.item_name = comboBox1.Text;
            i.Item_code   = int.Parse(textBox2.Text);
            i_u.Item_unit = textBox3.Text;
            ent.Items.Add(i);
            ent.item_units.Add(i_u);
            ent.SaveChanges();
            MessageBox.Show("item added");
            comboBox1.Text = textBox2.Text = textBox3.Text = string.Empty;
        }
Example #5
0
 private void button2_Click(object sender, EventArgs e)
 {
     try {
         warehouse w   = new warehouse();
         int       id  = int.Parse(textBox1.Text);
         entities  ent = new entities();
         w = (from wa in ent.warehouses
              where wa.warehouse_id == id
              select wa).First();
         w.warehouse_name = textBox2.Text;
         w.address        = textBox3.Text;
         w.mgr_id         = int.Parse(textBox4.Text);
         ent.SaveChanges();
         MessageBox.Show("warehouse updated");
         textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = string.Empty;
     }
     catch { MessageBox.Show("no warehouse with this id"); }
 }
Example #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     try {
         entities  ent = new entities();
         warehouse w   = new warehouse();
         w.warehouse_id   = int.Parse(textBox1.Text);
         w.warehouse_name = textBox2.Text;
         w.mgr_id         = int.Parse(textBox4.Text);
         w.address        = textBox3.Text;
         ent.warehouses.Add(w);
         ent.SaveChanges();
         MessageBox.Show("warehouse added");
         textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = string.Empty;
     }
     catch
     {
         MessageBox.Show("ID can't take this value");
     }
 }
Example #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            try {
                Item i = new Item();

                String   name = comboBox1.Text;
                entities ent  = new entities();
                i = (from wa in ent.Items
                     where wa.Item_name == name
                     select wa).First();
                i.Item_code = int.Parse(textBox2.Text);
                ent.SaveChanges();
                MessageBox.Show("warehouse updated");
                comboBox1.Text = textBox2.Text = textBox3.Text = string.Empty;
            }
            catch
            {
                MessageBox.Show("there's no item with this name");
            }
        }
Example #8
0
 private void button1_Click(object sender, EventArgs e)
 {
     try {
         entities               ent = new entities();
         supplying_permit       s   = new supplying_permit();
         supplying_permit_items si  = new supplying_permit_items();
         s.supp_permit_id  = int.Parse(comboBox1.Text);
         si.supp_permit_id = int.Parse(comboBox1.Text);
         s.warehouse_id    = int.Parse(comboBox2.Text);
         s.supplier_name   = comboBox3.Text;
         si.item_name      = comboBox4.Text;
         si.prod_date      = dateTimePicker1.Value;
         si.amout          = int.Parse(textBox3.Text);
         si.exp_date       = dateTimePicker2.Value;
         ent.supplying_permit.Add(s);
         ent.supplying_permit_items.Add(si);
         ent.SaveChanges();
         comboBox1.Text = comboBox2.Text = comboBox3.Text = comboBox4.Text = textBox3.Text = string.Empty;
     }
     catch { MessageBox.Show("failed"); }
 }
        private void button4_Click(object sender, EventArgs e)
        {
            selling_permit s   = new selling_permit();
            int            id  = int.Parse(comboBox1.Text);
            entities       ent = new entities();

            s = (from wa in ent.selling_permit
                 where wa.sell_permit_id == id
                 select wa).First();
            selling_permit_items si = new selling_permit_items();

            si.sell_permit_id = id;
            si.item_name      = comboBox4.Text;

            si.amount = int.Parse(textBox3.Text);

            ent.selling_permit_items.Add(si);
            ent.SaveChanges();
            comboBox1.Text = comboBox2.Text = comboBox3.Text = comboBox4.Text = textBox3.Text = string.Empty;
            MessageBox.Show("item added");
        }
Example #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     try {
         entities ent = new entities();
         supplier s   = new supplier();
         s.supplier_name = comboBox1.Text;
         s.fax           = textBox1.Text;
         s.telephone     = textBox2.Text;
         s.mobile        = textBox3.Text;
         s.email         = textBox4.Text;
         s.website       = textBox5.Text;
         ent.suppliers.Add(s);
         ent.SaveChanges();
         MessageBox.Show("suppllier added");
         comboBox1.Text = textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = string.Empty;
     }
     catch
     {
         MessageBox.Show("failed");
     }
 }
Example #11
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         supplying_permit s = new supplying_permit();
         int      id        = int.Parse(comboBox1.Text);
         entities ent       = new entities();
         s = (from wa in ent.supplying_permit
              where wa.supp_permit_id == id
              select wa).First();
         supplying_permit_items si = new supplying_permit_items();
         si.supp_permit_id = id;
         si.item_name      = comboBox4.Text;
         si.prod_date      = dateTimePicker1.Value;
         si.amout          = int.Parse(textBox3.Text);
         si.exp_date       = dateTimePicker2.Value;
         ent.supplying_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"); }
 }