Beispiel #1
0
        //private void LoadItemList()
        //{
        //    SqlDataReader dr;
        //    ListViewItem lvi;

        //    this.Cursor = Cursors.WaitCursor;

        //    //dr = CBDepartment.GetList();
        //    dr = CBBusiness_Unit.GetList();
        //    lvwItems.Items.Clear();
        //    while (dr.Read())
        //    {
        //        lvi = new ListViewItem();

        //        lvi.Text = dr["ID"].ToString();
        //        lvi.SubItems.Add(dr["Name"].ToString());
        //        lvi.SubItems.Add(dr["Description"].ToString());
        //        lvi.SubItems.Add(dr["AcctGroup"].ToString());

        //        lvwItems.Items.Add(lvi);
        //    }
        //    lvwItems.ColumnClick += new ColumnClickEventHandler(lvwItems_ColumnClick);
        //    dr.Close();
        //    dr = null;

        //    sbPanStatus.Text = lvwItems.Items.Count.ToString() + " department(s)";

        //    this.Cursor = Cursors.Default;
        //}


        private void LoadItemList()
        {
            SqlDataReader dr;
            ListViewItem  lvi;

            this.Cursor = Cursors.WaitCursor;

            //dr = CBDepartment.GetList();
            dr = CBBusiness_Unit.GetList();
            lvwItems.Items.Clear();
            while (dr.Read())
            {
                lvi = new ListViewItem();

                lvi.Text = dr["BUS_Unit_ID"].ToString();
                //lvi.SubItems.Add(dr["Name"].ToString());
                lvi.SubItems.Add(dr["Bus_Unit_Description"].ToString());
                //lvi.SubItems.Add(dr["AcctGroup"].ToString());

                lvwItems.Items.Add(lvi);
            }
            lvwItems.ColumnClick += new ColumnClickEventHandler(lvwItems_ColumnClick);
            dr.Close();
            dr = null;

            sbPanStatus.Text = lvwItems.Items.Count.ToString() + " department(s)";

            this.Cursor = Cursors.Default;
        }
Beispiel #2
0
        protected override void bttDelete_Click(object sender, EventArgs e)
        {
            base.bttDelete_Click(sender, e);

            int    tmpID = Convert.ToInt32(lvwItems.SelectedItems[0].Text);
            string val   = lvwItems.SelectedItems[0].SubItems[1].Text;

            DialogResult retVal = MessageBox.Show("Are you sure that you wish to remove \"" + val + "\"", "Remove Item", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (retVal == DialogResult.Yes)
            {
                //CBDepartment.Delete(tmpID);
                CBBusiness_Unit.Delete(tmpID);
                LoadItemList();
            }
        }