public void Load_company() { List <Company> _xCompany = CCompany_exten.Active(); if (_xCompany.Count != 0) { gridItems.RowCount = 0; gridItems.RowCount = _xCompany.Count; for (int r = 0; r < _xCompany.Count; r++) { DataGridViewRow row = gridItems.Rows[r]; row.Cells[COMPANY.COMPANY_ID].Value = _xCompany[r].Company_id + ""; row.Cells[COMPANY.COMPANY_NAME].Value = " " + _xCompany[r].Company_name + ""; DataTable TBL = new DAL().Listdata("SELECT " + DEFAULTCOMPANY.COMPANY_ID + " FROM " + DEFAULTCOMPANY.DEFAULTCOMPANY_TBL + " WHERE " + DEFAULTCOMPANY.COMPANY_ID + " = " + _xCompany[r].Company_id); if (TBL.Rows.Count != 0) { row.Cells["col_Default"].Value = "Default"; } else { row.Cells["col_Default"].Value = ""; } } } else { Open_Company(); } }
void gridItems_RowAction(object sender, EventArgs e) { if (gridItems.SelectedRow == null) { return; } string pkValue = GetSelectedPkValue(); Current.Company_id = pkValue; Current.Company_Name = cmp_name; Current.Comp_code = CCompany_exten.GetCode_id(Current.Company_Name); RaiseEvent_NeedToRefresh(); Open_ACY(); // this.Hide(); }
public void SetAction(BtnEvent action, string pk) { fAction = action; switch (fAction) { case BtnEvent.Open: btn_save.Text = "&CLOSE"; obj = CCompany_exten.PKId(pk); this.EnableControls(false); break; case BtnEvent.Edit: btn_save.Text = "&UPDATE"; obj = CCompany_exten.PKId(pk); this.EnableControls(true); break; } this.LoadData(); }