Exemple #1
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (listView1.FocusedItem != null)
            {
                Form_Editor fmEditor = new Form_Editor();
                fmEditor.ObjectIndex      = listView1.FocusedItem.Index;
                fmEditor.ObjectName       = listView1.FocusedItem.Text;
                fmEditor.IsOff            = listView1.FocusedItem.SubItems[1].Text;
                fmEditor.CompId           = listView1.FocusedItem.SubItems[2].Text;
                fmEditor.DeptId           = listView1.FocusedItem.SubItems[3].Text;
                fmEditor.LDAPObjectString = listView1.FocusedItem.SubItems[4].Text;
                if (fmEditor.ShowDialog() == DialogResult.Yes)
                {
                    dtOrganizationalUnits.Rows[fmEditor.ObjectIndex]["Name"]             = fmEditor.ObjectName;
                    dtOrganizationalUnits.Rows[fmEditor.ObjectIndex]["IsOff"]            = fmEditor.IsOff;
                    dtOrganizationalUnits.Rows[fmEditor.ObjectIndex]["LDAPObjectString"] = fmEditor.LDAPObjectString;
                    dtOrganizationalUnits.Rows[fmEditor.ObjectIndex]["CompId"]           = fmEditor.CompId;
                    dtOrganizationalUnits.Rows[fmEditor.ObjectIndex]["DeptId"]           = fmEditor.DeptId;
                    dtOrganizationalUnits.WriteXml("LDAPOU.xml");

                    listView1.FocusedItem.Text             = fmEditor.ObjectName;
                    listView1.FocusedItem.SubItems[1].Text = fmEditor.IsOff;
                    listView1.FocusedItem.SubItems[2].Text = fmEditor.CompId;
                    listView1.FocusedItem.SubItems[3].Text = fmEditor.DeptId;
                    listView1.FocusedItem.SubItems[4].Text = fmEditor.LDAPObjectString;
                }
                fmEditor.Dispose();
            }
        }
Exemple #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Form_Editor fmEditor = new Form_Editor();

            if (fmEditor.ShowDialog() == DialogResult.Yes)
            {
                dtOrganizationalUnits.Rows.Add(new object[] { fmEditor.ObjectName, fmEditor.IsOff, fmEditor.LDAPObjectString, fmEditor.CompId, fmEditor.DeptId });
                dtOrganizationalUnits.WriteXml("LDAPOU.xml");

                ListViewItem item = new ListViewItem();
                item.Text = fmEditor.ObjectName;
                item.SubItems.Add(fmEditor.IsOff);
                item.SubItems.Add(fmEditor.CompId);
                item.SubItems.Add(fmEditor.DeptId);
                item.SubItems.Add(fmEditor.LDAPObjectString);
                listView1.Items.Add(item);
            }
            fmEditor.Dispose();
        }