예제 #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();
        }
예제 #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();
        //}

        //private void bt_editCustomer_Click(object sender, EventArgs e)
        //{

        //}

        //private void TXT_customerSearch_TextChanged(object sender, EventArgs e)
        //{

        //}

        //private void CustomerForm1_Load(object sender, EventArgs e)
        //{
        //    bindGridView();
        //}

        //private void BtupdateCustomer_Click(object sender, EventArgs e)
        //{
        //    store = new store();
        //    p_id = int.Parse(DGV_Customer.SelectedRows[0].Cells[0].Value.ToString());
        //    var query = store.customers.FirstOrDefault(p => p.ID == p_id);
        //    query.Name = CustomerNameTxt.Text.ToString();
        //    query.addrees = CustomerAddressTxt.Text.ToString();
        //    query.Phone = CustomerPhoneTxt.Text.ToString();
        //    query.type = CustomerTypecomboBox.SelectedItem.ToString();
        //    store.SaveChanges();
        //    bindGridView();
        //}

        //private void bt_addCustomer_Click(object sender, EventArgs e)
        //{


        //}

        private void showAddCustomerBtn_Click(object sender, EventArgs e)
        {
            bt_addCustomer.Show();
            BtupdateCustomer.Hide();
            CustomerNameTxt.Text    = null;
            CustomerPhoneTxt.Text   = null;
            CustomerAddressTxt.Text = null;
        }
예제 #3
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     metroPanel1.Show();
     BtupdateCustomer.Hide();
     bt_addCustomer.Show();
     CustomerAddressTxt.Visible = false;
     CustomerPhoneTxt.Visible   = false;
     addressLabel.Visible       = false;
     phoneLabel.Visible         = false;
 }