コード例 #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"); }
 }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            entities ent = new entities();
            var      U   = (from it in ent.Items


                            select it);

            foreach (Item it in U)
            {
                var supply = (from exp in it.supplying_permit_items
                              where exp.exp_date >= (dateTimePicker1.Value.AddDays(-5))
                              select exp);


                var exc = (from exp in it.exchane_permit_items
                           where exp.exp_date >= (dateTimePicker1.Value.AddDays(-5))
                           select exp);
                foreach (supplying_permit_items i in supply)
                {
                    listBox1.Items.Add(i.item_name.Trim() + " in " + i.supplying_permit.warehouse.warehouse_name.Trim() + " supplied by " + i.supplying_permit.supplier_name.Trim() + " days  to expire " + (i.exp_date.Value - dateTimePicker1.Value).TotalDays);
                }
                foreach (exchane_permit_items i in exc)
                {
                    listBox1.Items.Add(i.item_name.Trim() + " in " + i.exchang_permit.warehouse.warehouse_name.Trim() + " supplied by " + i.supplier_name.Trim() + " days  to expire " + (i.exp_date.Value - dateTimePicker1.Value).TotalDays);
                }
            }
        }
コード例 #4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            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();
            textBox2.Text  = i.Item_code.ToString();
            comboBox1.Text = i.Item_name;
        }
コード例 #5
0
      public itemsreport()
      {
          InitializeComponent();
          ent = new entities();
          var U = (from it in ent.Items

                   select it);

          foreach (Item e in U)
          {
              comboBox1.Items.Add(e.Item_name);
          }
      }
コード例 #6
0
        public WHreport()
        {
            InitializeComponent();
            ent = new entities();
            var U = (from it in ent.warehouses

                     select it);

            foreach (warehouse e in U)
            {
                comboBox1.Items.Add(e.warehouse_id);
            }
        }
コード例 #7
0
        public Itemsssss()
        {
            InitializeComponent();
            entities ent = new entities();
            var      i   = (from it in ent.Items

                            select it);

            foreach (Item e in i)
            {
                comboBox1.Items.Add(e.Item_name);
            }
        }
コード例 #8
0
        public sform()
        {
            InitializeComponent();
            entities ent = new entities();
            var      i   = (from it in ent.suppliers

                            select it);

            foreach (supplier e in i)
            {
                comboBox1.Items.Add(e.supplier_name);
            }
        }
コード例 #9
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;
        }
コード例 #10
0
        public cus_form()
        {
            InitializeComponent();

            entities ent = new entities();
            var      i   = (from it in ent.customers

                            select it);

            foreach (customer e in i)
            {
                comboBox1.Items.Add(e.customer_name);
            }
        }
コード例 #11
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;
        }
コード例 #12
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            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();



            textBox1.Text = s.fax;
            textBox2.Text = s.telephone;
            textBox3.Text = s.mobile;
            textBox4.Text = s.email;
            textBox5.Text = s.website;
        }
コード例 #13
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"); }
 }
コード例 #14
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");
     }
 }
コード例 #15
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");
            }
        }
コード例 #16
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"); }
 }
コード例 #17
0
        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");
        }
コード例 #18
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");
     }
 }
コード例 #19
0
        public EXc_form()
        {
            InitializeComponent();
            entities ent = new entities();
            var      i   = (from it in ent.suppliers

                            select it);

            foreach (supplier e in i)
            {
                comboBox3.Items.Add(e.supplier_name);
            }
            var U = (from it in ent.warehouses

                     select it);

            foreach (warehouse e in U)
            {
                comboBox2.Items.Add(e.warehouse_id);
                comboBox5.Items.Add(e.warehouse_id);
            }
            var items = (from it in ent.Items

                         select it);

            foreach (Item e in items)
            {
                comboBox4.Items.Add(e.Item_name);
            }

            var permits = (from it in ent.exchang_permit

                           select it);

            foreach (exchang_permit e in permits)
            {
                comboBox1.Items.Add(e.exc_permit_id);
            }
        }
コード例 #20
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"); }
 }
コード例 #21
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;
        }
コード例 #22
0
        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            entities ent = new entities();
            var      U   = (from it in ent.Items


                            select it);

            foreach (Item it in U)
            {
                var supply = (from exp in it.supplying_permit_items
                              where exp.prod_date <= (dateTimePicker1.Value)
                              select exp);

                var sold = (from exp in it.selling_permit_items
                            where exp.selling_permit.permit_date <= dateTimePicker1.Value
                            select exp);


                var exc = (from exp in it.exchane_permit_items
                           where exp.prod_date <= dateTimePicker1.Value
                           select exp);
                foreach (supplying_permit_items i in supply)
                {
                    listBox1.Items.Add(i.item_name.Trim() + " in " + i.supplying_permit.warehouse.warehouse_name.Trim() + " supplied by " + i.supplying_permit.supplier_name.Trim() + " stayed for " + (dateTimePicker1.Value - i.prod_date.Value).TotalDays + " days");
                }
                foreach (selling_permit_items i in sold)
                {
                    listBox1.Items.Add(i.item_name.Trim() + " in " + i.selling_permit.warehouse.warehouse_name.Trim() + " supplied by " + i.supplier_name.Trim() + " sold from " + (dateTimePicker1.Value - i.selling_permit.permit_date.Value).TotalDays + " days");
                }
                foreach (exchane_permit_items i in exc)
                {
                    listBox1.Items.Add(i.item_name.Trim() + " in " + i.exchang_permit.warehouse1.warehouse_name.Trim() + " supplied by " + i.supplier_name.Trim() + " exchanged from " + (dateTimePicker1.Value - i.prod_date.Value).TotalDays + " days");
                }
            }
        }