コード例 #1
0
        private void FillUsers()
        {
            objHRdb = new HRInfo();
            DataTable dt = new DataTable();

            clbUsers.Items.Clear();

            if (cbCompany.SelectedIndex > 0 && cbLocation.SelectedIndex > 0)
            {
                try
                {
                    dt = objHRdb.BranchUsersList_Get(cbCompany.SelectedValue.ToString(), cbLocation.SelectedValue.ToString()).Tables[0];

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dataRow in dt.Rows)
                        {
                            if (dataRow["UM_USER_ID"] + "" != "")
                            {
                                NewCheckboxListItem oclBox = new NewCheckboxListItem();
                                oclBox.Tag  = dataRow["UM_USER_ID"].ToString();
                                oclBox.Text = dataRow["UM_USER_NAME"].ToString() + " ( " + dataRow["UM_USER_ID"].ToString() + " )";
                                clbUsers.Items.Add(oclBox);
                                oclBox = null;
                            }
                        }
                    }
                    else
                    {
                        clbUsers.Items.Clear();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    objHRdb = null;
                }
            }
            else
            {
                clbUsers.Items.Clear();
            }
        }