private void FrmMainWindow_Load(object sender, EventArgs e) { ///LOAD CBO CATAGORY /////////option 1 dtCatagories = new Bll.AddressBook().GetAllCatagories(""); DataRow rowCatagories = dtCatagories.NewRow(); rowCatagories["CategoryID"] = "0"; rowCatagories["CategoryName"] = "All"; dtCatagories.Rows.InsertAt(rowCatagories, 0); //DataView dv1 = new DataView(dtCatagories); this.cbxCategory.DataSource = dtCatagories; /////////option 2 //this.cbxCategory.DataSource = new Bll.MainWindow().GetAllCatagories(); ///////// //this.cbxCategory.ValueMember = "CategoryID"; //this.cbxCategory.DisplayMember = "CategoryName"; this.cbxCategory.SelectedIndex = 0; ///LOAD CBO CATAGORY ///LOAD GRID loadGrid(); ///LOAD GRID //load cbo of search //DataView dv2 = new DataView(dtCatagories); //this.cboCaegorySearch.DataSource = dv2; //this.cboCaegorySearch.ValueMember = "CategoryID"; //this.cboCaegorySearch.DisplayMember = "CategoryName"; //this.cboCaegorySearch.SelectedIndex = 0; dtCatagories = new Bll.AddressBook().GetAllCatagories(""); rowCatagories = dtCatagories.NewRow(); rowCatagories["CategoryID"] = "0"; rowCatagories["CategoryName"] = "All"; dtCatagories.Rows.InsertAt(rowCatagories, 0); cbxCaegorySearch.DataSource = dtCatagories; this.cbxCaegorySearch.SelectedIndex = 0; //load cbo of search //load cbo of city DataTable dt = new Bll.AddressBook().GetCity(" and City is not null group by city"); rowCatagories = dt.NewRow(); rowCatagories["City"] = "All"; dt.Rows.InsertAt(rowCatagories, 0); this.cboCity.DataSource = dt; //this.cboCity.DataSource = new Bll.AddressBook().GetCity(""); //load cbo of city EnableSearch(true); }
private void CallRecords_Load(object sender, EventArgs e) { ///LOAD CBO CATAGORY //dtCatagories = new Bll.MainWindow().GetAllCatagories(""); //DataRow rowCatagories = dtCatagories.NewRow(); //rowCatagories["CategoryID"] = "0"; //rowCatagories["CategoryName"] = "All"; //dtCatagories.Rows.InsertAt(rowCatagories, 0); //DataView dv1 = new DataView(dtCatagories); this.cbxCategory.DataSource = new Bll.AddressBook().GetAllCatagories(""); this.cbxCategory.SelectedIndex = 0; ///LOAD CBO CATAGORY ///LOAD GRID loadGrid(); this.GridViewCallRecords.Columns["CallDateTime"].DefaultCellStyle.Format = "dd-MMM-yyyy HH:mm:ss"; ///LOAD GRID //load cbo of search //DataView dv2 = new DataView(dtCatagories); dtCatagories = new Bll.AddressBook().GetAllCatagories(""); DataRow rowCatagories = dtCatagories.NewRow(); rowCatagories["CategoryID"] = "0"; rowCatagories["CategoryName"] = "All"; dtCatagories.Rows.InsertAt(rowCatagories, 0); cbxCaegorySearch.DataSource = dtCatagories; this.cbxCaegorySearch.SelectedIndex = 0; //load cbo of search //load cbo for persones this.cbxContactPerson.DataSource = new Bll.CallRecords().GetPersons(""); //load cbo for persones //load cbo of city DataTable dt = new Bll.AddressBook().GetCity(" and City is not null group by city"); rowCatagories = dt.NewRow(); rowCatagories["City"] = "Any/NA/All"; dt.Rows.InsertAt(rowCatagories, 0); DataView dv1 = new DataView(dt); this.cboCity.DataSource = dv1; //load cbo of city //load cbo of city for search DataView dv2 = new DataView(dt); this.cboCitySearch.DataSource = dv2; //load cbo of city for search EnableSearch(false); this.cbxContactPerson.Text = string.Empty; }