private void bt_editCustomer_Click_1(object sender, EventArgs e) { if (DGV_Customer.SelectedRows.Count == 0) { MessageBoxIcon.Warning.ToString(); MessageBox.Show("يجب ان تختار المندوب من المندوبين"); bt_addCustomer.Show(); } else { metroPanel1.Show(); BtupdateCustomer.Show(); bt_addCustomer.Hide(); CustomerAddressTxt.Visible = true; CustomerPhoneTxt.Visible = true; addressLabel.Visible = true; phoneLabel.Visible = true; p_id = int.Parse(DGV_Customer.SelectedRows[0].Cells[0].Value.ToString()); var query = store.SalesRepresentatives.FirstOrDefault(p => p.ID == p_id); MandobNametextBox1.Text = query.Employee.EmployeeName; CustomerPhoneTxt.Text = query.Employee.Phone; CustomerAddressTxt.Text = query.Employee.Address; } }
private void bt_editCustomer_Click(object sender, EventArgs e) { //edit BtupdateCustomer.Show(); bt_addCustomer.Hide(); if (DGV_Customer.SelectedRows.Count == 0) { MessageBoxIcon.Warning.ToString(); MessageBox.Show("يجب ان تختار منتج من المنتجات"); bt_addCustomer.Show(); } else { p_id = int.Parse(DGV_Customer.SelectedRows[0].Cells[0].Value.ToString()); var query = store.customers.FirstOrDefault(p => p.ID == p_id); CustomerNameTxt.Text = query.Name; CustomerPhoneTxt.Text = query.Phone; CustomerAddressTxt.Text = query.addrees; CustomerTypecomboBox.SelectedValue = query.type.ToString(); } }