SyncAD.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:2k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- namespace OThinker.H3.Portal
- {
- public partial class SyncAD : PortalPage
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.IsPostBack)
- {
- // 验证是否具有管理员权限
- if (!this.UserValidator.ValidateAdministrator())
- {
- this.NotifyMessage(LackOfAuth);
- }
- this.lblADPath.Text = OThinker.H3.Server.Engine.SettingManager.ADPath;
- this.lblADUser.Text = OThinker.H3.Server.Engine.SettingManager.ADUser;
- string adPassword = OThinker.H3.Server.Engine.SettingManager.ADPassword;
- this.lblADPassword.Text = ((adPassword == null || adPassword == "") ? "未设置" : "已设置");
- this.lblLastSyncTime.Text = OThinker.H3.Server.Engine.SettingManager.LastSyncTime.ToString();
- this.chkAutoSync.Checked = OThinker.H3.Server.Engine.SettingManager.AutoSync;
- }
- }
- protected void lnkOk_Click(object sender, EventArgs e)
- {
- System.DateTime lastSyncTime = System.DateTime.Now;
- OThinker.Organization.HandleResult result = OThinker.H3.Server.Engine.Organization.Sync(
- this.UserValidator.UserID,
- OThinker.H3.Server.Engine.SettingManager.ADPath,
- OThinker.H3.Server.Engine.SettingManager.ADUser,
- OThinker.H3.Server.Engine.SettingManager.ADPassword,
- System.DateTime.Parse("1900-01-01"));
- if (result == OThinker.Organization.HandleResult.SUCCESS)
- {
- OThinker.H3.Server.Engine.SettingManager.LastSyncTime = lastSyncTime;
- this.Response.Redirect(PageName_EditOrganization);
- }
- else
- {
- this.NotifyMessage(result.ToString());
- }
- }
- }
- }