📄 testadservicesform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data;
using System.Diagnostics;
using CommonComponent.AdServices;
using System.Collections.Specialized;
namespace TestAdServices
{
/// <summary>
/// Summary description for GetCompanyList.
/// </summary>
public class TestAdServicesForm : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid CompanyList;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public TestAdServicesForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.CompanyList = new System.Windows.Forms.DataGrid();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.CompanyList)).BeginInit();
this.SuspendLayout();
//
// CompanyList
//
this.CompanyList.DataMember = "";
this.CompanyList.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.CompanyList.Location = new System.Drawing.Point(0, 32);
this.CompanyList.Name = "CompanyList";
this.CompanyList.Size = new System.Drawing.Size(632, 288);
this.CompanyList.TabIndex = 0;
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(0, 8);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(328, 20);
this.comboBox1.TabIndex = 1;
this.comboBox1.Text = "comboBox1";
//
// label1
//
this.label1.Location = new System.Drawing.Point(344, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 24);
this.label1.TabIndex = 2;
this.label1.Text = "label1";
//
// TestAdServicesForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(640, 325);
this.Controls.Add(this.label1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.CompanyList);
this.Name = "TestAdServicesForm";
this.Text = "GetCompanyList";
this.Load += new System.EventHandler(this.GetCompanyList_Load);
((System.ComponentModel.ISupportInitialize)(this.CompanyList)).EndInit();
this.ResumeLayout(false);
}
#endregion
// [STAThread]
// static void Main()
// {
// //Application.Run(new Form1());
// Application.Run(new TestAdServices());
// }
private void GetCompanyList_Load(object sender, System.EventArgs e)
{
/*
//测试取公司清单
IQueryList myCompany = (IQueryList)new ADServices();
DataView myDataView = myCompany.GetCompanyList();
CompanyList.DataSource =myDataView;
StringCollection strCollection = myCompany.GetCompanyArr();
comboBox1.Items.Add(strCollection.Count);
foreach (string strCompany in strCollection)
{
comboBox1.Items.Add(strCompany);
}*/
/*
//NT验证
ILogonNTUser myLogon = (ILogonNTUser)new ADServices();
if(myLogon.LogonNTUser(@"gfg1\shenjp","adfasdf"))
label1.Text = "true";
else
label1.Text = "false";
*/
/*
//帐号清单
IQueryList myAccountsList= (IQueryList)new ADServices();
CompanyList.DataSource = myAccountsList.GetAccountsList();
StringCollection strCollection = myAccountsList.GetAccountsArr();
comboBox1.Items.Add(strCollection.Count);
foreach (string strCompany in strCollection)
{
comboBox1.Items.Add(strCompany);
}
*/
/*
//用户组的清单
IQueryList myGetUserGroupMembershipArr= (IQueryList)new ADServices();
StringCollection strCollection = myGetUserGroupMembershipArr.GetUserGroupMembershipArr("lidh");
comboBox1.Items.Add(strCollection.Count);
foreach (string strCompany in strCollection)
{
comboBox1.Items.Add(strCompany);
}
CompanyList.DataSource =myGetUserGroupMembershipArr.GetUserGroupMembershipList("lidh");
*/
/*
//电脑的清单
IQueryList myGetComputerList= (IQueryList)new ADServices();
CompanyList.DataSource =myGetComputerList.GetComputerList("LDAP://gfg1.esquel.com/OU=Organization,DC=gfg1,DC=esquel,DC=com");
*/
/*
//组的成员
IQueryList myGetGroupMembersArr= (IQueryList)new ADServices();
StringCollection strCollection = myGetGroupMembersArr.GetGroupMembersArr("sMIS115");
comboBox1.Items.Add(strCollection.Count);
foreach (string strCompany in strCollection)
{
comboBox1.Items.Add(strCompany);
}*/
/*
//组的清单
IQueryList myGetGroupList= (IQueryList)new ADServices();
CompanyList.DataSource = myGetGroupList.GetGroupList("LDAP://gfg1.esquel.com/OU=Organization,DC=gfg1,DC=esquel,DC=com");
StringCollection strCollection = myGetGroupList.GetGroupArr("LDAP://gfg1.esquel.com/OU=Organization,DC=gfg1,DC=esquel,DC=com");
comboBox1.Items.Add(strCollection.Count);
foreach (string strCompany in strCollection)
{
comboBox1.Items.Add(strCompany);
}
*/
//得到对象的属性
IQueryList myGetObjAttribute= (IQueryList)new ADServices();
StringCollection strCollection = myGetObjAttribute.GetObjAttribute("sMIS107",QueryType.GroupName,true);
comboBox1.Items.Add(strCollection.Count);
foreach (string strCompany in strCollection)
{
comboBox1.Items.Add(strCompany);
}
/*修改密码
IUser myChangePassword= (IUser)new ADServices();
if(myChangePassword.ChangePassword(@"gfg1\shenjp","ss","aa"))
{label1.Text="true";}
else
{label1.Text = "false";}
*/
//基本用户信息
// IGroup myAddGroup= (IGroup)new ADServices();
// myAddGroup.AddGroup("LDAP://gfg1.esquel.com/CN=sMIS107,OU=SMIS,OU=MIS,OU=Organization,DC=gfg1,DC=esquel,DC=com","test")
// IQueryList myView = (IQueryList)new ADServices();
// StringCollection groups = myView.GetObjAttribute(@"LDAP://gfg1.esquel.com/CN=Sandy Huang \/Nike,OU=\ GaoMing Internet Users Address,OU=GFG,OU=Organization,DC=gfg1,DC=esquel,DC=com",true);
// comboBox1.Items.Add(groups.Count);
// foreach (string gp in groups)
// {
// comboBox1.Items.Add(gp);
// }
// comboBox1.Items.Add(myView.ExceptionDesc);
// IQueryList myView = (IQueryList)new ADServices();
// comboBox1.Items.Add(myView.GetUserNameBasicInfo("shenjp").MemberOf[1]);
// IUser myGroup = (IUser)new ADServices();
// if (myGroup.AddUser("LDAP://gfg1.esquel.com/OU=Users,OU=Cutting,OU=GEG,OU=Organization,DC=gfg1,DC=esquel,DC=com","testasasasdasd","adadf","沈","江平"))
// {comboBox1.Items.Add("true");}
// else
// {comboBox1.Items.Add("false");
// comboBox1.Items.Add(myGroup.ExceptionDesc);};
//
// string[] myString= new string[]{"shenjp","zhouf"};
// IUser myGroup = (IUser)new ADServices();
// if (myGroup.DeleteUserFormGroup("LDAP://gfg1.esquel.com/OU=Organization,DC=gfg1,DC=esquel,DC=com",myString,"TWGAdmins"))
// {comboBox1.Items.Add("true");}
// else
// {
// comboBox1.Items.Add("false");
// comboBox1.Items.Add(myGroup.ExceptionDesc);
// }
//MessageBox.Show(myGroup.AddGroup("LDAP://gfg1.esquel.com/OU=EAP,OU=Organization,DC=gfg1,DC=esquel,DC=com","test","test",false).ToString());
// CompanyList.DataSource = myView.GetComputerList("LDAP://gfg1.esquel.com/OU=Organization,DC=gfg1,DC=esquel,DC=com");
// //comboBox1.Items.Add(myView.GetComputerList("LDAP://gfg1.esquel.com/OU=Organization,DC=gfg1,DC=esquel,DC=com").Table.Rows.Count);
// comboBox1.Items.Add(myView.ExceptionDesc);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -