Ejemplo n.º 1
0
        public void bindGridView()
        {
            bt_addCustomer.Show();
            BtupdateCustomer.Hide();
            DGV_Customer.Rows.Clear();

            store = new store();

            var query = (from s in store.SalesRepresentatives
                         from m in store.employee
                         where (s.Employee_Id == m.ID && s.status == false)
                         select new { m, s }
                         ).ToList();

            if (query.Count != 0)
            {
                DGV_Customer.RowCount = query.Count;


                int i = 0;
                foreach (var item in query)
                {
                    DGV_Customer.Rows[i].Cells[0].Value = item.s.ID.ToString();
                    DGV_Customer.Rows[i].Cells[1].Value = item.m.EmployeeName.ToString();

                    DGV_Customer.Rows[i].Cells[2].Value = item.m.Phone.ToString();
                    DGV_Customer.Rows[i].Cells[3].Value = item.m.Address;

                    i++;
                }
            }
            DGV_Customer.Refresh();
            DGV_Customer.Update();
        }
Ejemplo n.º 2
0
        private void delCustomer_Click(object sender, EventArgs e)
        {
            store = new store();
            DGV_Customer.DataSource = null;
            DGV_Customer.Update();
            DGV_Customer.Refresh();
            var id    = int.Parse(DGV_Customer.SelectedRows[0].Cells[0].Value.ToString());
            var query = store.customers.FirstOrDefault(p => p.ID == id);

            query.Status = true;
            store.SaveChanges();
            bindGridView();
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (DGV_Customer.SelectedRows.Count == 0)
            {
                MessageBoxIcon.Warning.ToString();
                MessageBox.Show("يجب ان تختار المندوب من المندوبين");
                bt_addCustomer.Show();
            }
            store = new store();
            DGV_Customer.DataSource = null;
            DGV_Customer.Update();
            DGV_Customer.Refresh();
            var id    = int.Parse(DGV_Customer.SelectedRows[0].Cells[0].Value.ToString());
            var query = store.SalesRepresentatives.FirstOrDefault(p => p.ID == id);

            query.status = true;
            store.SaveChanges();
            bindGridView();
        }