public void ReloadData() { try { CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); List<CustomerGroups> aListCustomerGroup = new List<CustomerGroups>(); dgvAvailableCustomerGroups.DataSource = null; if (afrmIns_CustomerGroups_Customers_Old != null) { aListCustomerGroup = aCustomerGroupsBO.Select_ByIDCompany(IDCompany); btnAdd.Visible = false; } else if (afrmTsk_BookingHall_Goverment_Old != null) { aListCustomerGroup = aCustomerGroupsBO.Select_ByIDCompany(IDCompany); btnAdd.Visible = false; } else if (this.afrmTsk_BookingHall_Group != null) { aListCustomerGroup = aCustomerGroupsBO.Select_ByIDCompany(IDCompany); btnAdd.Visible = false; } else if (this.afrmTsk_UpdBooking != null) { aListCustomerGroup = aCustomerGroupsBO.Select_ByIDCompany(IDCompany); btnAdd.Visible = false; } else { aListCustomerGroup = aCustomerGroupsBO.Select_All(); btnAdd.Visible = true; colFill.Visible = false; } dgvAvailableCustomerGroups.DataSource = aListCustomerGroup; } catch (Exception ex) { MessageBox.Show("frmLst_CustomerGroups.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadIDCustomerGroups() { try { CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); int IDCompany = Convert.ToInt32(lueCompany.EditValue.ToString()); List<CustomerGroups> aListCustomerGroups = aCustomerGroupsBO.Select_ByIDCompany(IDCompany); lueCustomerGroup.Properties.DataSource = aListCustomerGroups; lueCustomerGroup.Properties.DisplayMember = "Name"; lueCustomerGroup.Properties.ValueMember = "ID"; if (aListCustomerGroups.Count > 0) { lueCustomerGroup.EditValue = aListCustomerGroups.ToList()[0].ID; } else { lueCustomerGroup.EditValue = 0; } } catch (Exception ex) { MessageBox.Show("frmTsk_UpdBooking.LoadIDCustomerGroups\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadCustomerGroup() { try { CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); int IDCompany = Convert.ToInt32(lueIDCompany.EditValue.ToString()); List<CustomerGroups> aListCustomerGroups = aCustomerGroupsBO.Select_ByIDCompany(IDCompany); lueIDCustomerGroup.Properties.DataSource = aListCustomerGroups; lueIDCustomerGroup.Properties.DisplayMember = "Name"; lueIDCustomerGroup.Properties.ValueMember = "ID"; if (aListCustomerGroups.Count > 0) { lueIDCustomerGroup.EditValue = aListCustomerGroups.ToList()[0].ID; //if (aListCustomerGroups.Where(a => a.Name == lueIDCompany.Text + " " + DateTime.Now.ToShortDateString() + "" + txtSubject.Text).ToList().Count > 0) //{ // lueIDCustomerGroup.EditValue = aListCustomerGroups.Where(a => a.Name == lueIDCompany.Text + "" + DateTime.Now.ToShortDateString() + "" + txtSubject.Text).ToList()[0].ID; //} //else //{ // CustomerGroups aTemp = new CustomerGroups(); // aTemp.IDCompany = IDCompany; // aTemp.Name = lueIDCompany.Text + "" + DateTime.Now.ToShortDateString() + "" + txtSubject.Text; // aTemp.Status = 1; // aTemp.Type = 1; // aTemp.Disable = false; // int IDaTemp= aCustomerGroupsBO.Insert(aTemp); // lueIDCustomerGroup.EditValue = IDaTemp; //} } else { lueIDCustomerGroup.EditValue = 0; } } catch (Exception ex) { MessageBox.Show("frmAddNewBookingRs_Goverment.LoadCustomerGroup\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }