private void FillDestinationComboBox(int nLevelId) { objServicedb = new ServiceDB(); DataTable dt = new DataTable(); clbDestination.Items.Clear(); GetUserBranches(); try { dt = objServicedb.EcodesForService_Get(strBranch, nLevelId, "").Tables[0]; if (dt.Rows.Count > 0) { foreach (DataRow dataRow in dt.Rows) { NewCheckboxListItem oclBox = new NewCheckboxListItem(); oclBox.Tag = dataRow["ECODE"].ToString(); oclBox.Text = dataRow["Ename"].ToString(); clbDestination.Items.Add(oclBox); oclBox = null; } } dt = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { objServicedb = null; } }
private void FillDestinationData(string BranchCode, Int32 DesigId) { objServicedb = new ServiceDB(); DataTable dt = new DataTable(); string strLoadedEcode = string.Empty; DesigId = Convert.ToInt32(cbLevels.SelectedValue.ToString()); clbDestination.Items.Clear(); try { dt = objServicedb.EcodesForService_Get(cbBranches.SelectedValue.ToString(), DesigId, CommonData.DocMonth).Tables[0]; if (dt.Rows.Count > 0) { foreach (DataRow dataRow in dt.Rows) { NewCheckboxListItem oclBox = new NewCheckboxListItem(); oclBox.Tag = dataRow["ECODE"].ToString(); oclBox.Text = dataRow["Ename"].ToString(); if (!strLoadedEcode.Contains(dataRow["ECODE"].ToString())) { clbDestination.Items.Add(oclBox); } strLoadedEcode += dataRow["ECODE"].ToString() + ","; oclBox = null; } } dt = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { objServicedb = null; } }