/// <summary> /// 以管理员的身份更改用户的密码 /// </summary> /// <param name="UserName"></param> /// <param name="NewPassword"></param> public void SetUserPasswordAdmin(string UserName, string NewPassword, string oldPassword, string orgPassword, out string errStr) { errStr = ""; string[] strArrary = new string[4]; string xx = ""; ChangePwdService.ChangePWD svr1 = new InterActiveDirectory.ChangePwdService.ChangePWD(); if (svr1.Exchange_PassWord_RTX(UserName, orgPassword, oldPassword) != "") { errStr = xx + "修改RTX密码报错!\\n"; strArrary[0] = "0"; } else { strArrary[0] = "1"; } try { ADVB.AdUser advb = new ADVB.AdUser(); DirectoryEntry oUser = Iads.GetUserEntry(UserName); // advb.SetUserPasswd(oUser.Path,"123123",orgPassword); AdOperate.AD_ExchangePassWord adService = new InterActiveDirectory.AdOperate.AD_ExchangePassWord(); string er = ""; int t = adService.SetExchangePassword(UserName, orgPassword, out er)?1:0; //int t=adService.SetPassword_adsi(UserName,orgPassword); // // DirectoryEntry oUser= Iads.GetUserEntry(UserName); // SetPsw(oUser,orgPassword,out errStr); // oUser.Close(); oUser.Properties["l"].Value = "4"; //oUser.Properties["initials"].Value=orgPassword; oUser.Properties["extensionAttribute1"].Value = "1111"; //strArrary[0]+strArrary[2]+strArrary[1] oUser.CommitChanges(); oUser.Close(); } catch (Exception er) { errStr = errStr + "修改活动目录密码报错\\n" + er.Message; } }
/// <summary> /// 设定账号密码 /// </summary> /// <param name="userName"></param> /// <param name="newpassword"></param> public void SetUserPassword(string UserName, string NewPassword, string oldPassword, string orgPassword, out string errStr) { errStr = ""; string[] strArrary = new string[4]; string xx = ""; ChangePwdService.ChangePWD svr1 = new InterActiveDirectory.ChangePwdService.ChangePWD(); //if(!svr1.Exchange_PassWord_erp(UserName,NewPassword,oldPassword,out xx)) //{ // errStr=xx+"修改ERP密码报错!\\n"; // strArrary[0]="1"; //} //else // strArrary[0]="0"; if (!svr1.Exchange_PassWord_hls(UserName, NewPassword, oldPassword, out xx)) { errStr = xx + "修改LIS密码报错!\\n"; strArrary[1] = "1"; } else { strArrary[1] = "0"; } kmoapassword.CHTWebService cht = new InterActiveDirectory.kmoapassword.CHTWebService(); if (!cht.Edit_PassWord(UserName, NewPassword, oldPassword, out xx)) { errStr = xx + "修改KMOA密码报错!\\n"; strArrary[2] = "1"; } else { strArrary[2] = "0"; } if (svr1.Exchange_PassWord_RTX(UserName, orgPassword, oldPassword) != "") { errStr = xx + "修改RTX密码报错!\\n"; strArrary[3] = "0"; } else { strArrary[3] = "1"; } try { ADVB.AdUser advb = new ADVB.AdUser(); DirectoryEntry oUser = Iads.GetUserEntry(UserName); AdOperate.AD_ExchangePassWord adService = new InterActiveDirectory.AdOperate.AD_ExchangePassWord(); string er = ""; int t = adService.SetExchangePassword(UserName, orgPassword, out er)?1:0; //DirectoryEntry oUser = Iads.GetUserEntry(UserName); //SetPsw(oUser, orgPassword, out errStr); //oUser.Close(); oUser.Properties["l"].Value = "4"; //oUser.Properties["physicalDeliveryOfficeName"].Value=orgPassword; /********Editor:cengyp 2008年11月3日********/ oUser.Properties["physicalDeliveryOfficeName"].Value = Encryption.DesEncrypt(orgPassword); oUser.Properties["extensionAttribute1"].Value = "1111"; oUser.CommitChanges(); oUser.Close(); } catch (Exception err) { errStr = errStr + "-------" + err + " 修改活动目录密码报错\\n"; } }
/// <summary> /// 设定账号密码 /// </summary> /// <param name="userName"></param> /// <param name="newpassword"></param> public void SetUserPassword(string UserName,string NewPassword,string oldPassword,string orgPassword,out string errStr) { errStr=""; string[] strArrary=new string[4]; string xx=""; ChangePwdService.ChangePWD svr1 = new InterActiveDirectory.ChangePwdService.ChangePWD(); //if(!svr1.Exchange_PassWord_erp(UserName,NewPassword,oldPassword,out xx)) //{ // errStr=xx+"修改ERP密码报错!\\n"; // strArrary[0]="1"; //} //else // strArrary[0]="0"; if(!svr1.Exchange_PassWord_hls(UserName,NewPassword,oldPassword,out xx)) { errStr=xx+"修改LIS密码报错!\\n"; strArrary[1]="1"; } else strArrary[1]="0"; kmoapassword.CHTWebService cht = new InterActiveDirectory.kmoapassword.CHTWebService(); if (!cht.Edit_PassWord(UserName, NewPassword, oldPassword, out xx)) { errStr=xx+"修改KMOA密码报错!\\n"; strArrary[2]="1"; } else strArrary[2]="0"; if(svr1.Exchange_PassWord_RTX(UserName,orgPassword,oldPassword)!="") { errStr=xx+"修改RTX密码报错!\\n"; strArrary[3]="0"; } else strArrary[3]="1"; try { ADVB.AdUser advb=new ADVB.AdUser(); DirectoryEntry oUser= Iads.GetUserEntry(UserName); AdOperate.AD_ExchangePassWord adService = new InterActiveDirectory.AdOperate.AD_ExchangePassWord(); string er=""; int t = adService.SetExchangePassword(UserName, orgPassword, out er)?1:0; //DirectoryEntry oUser = Iads.GetUserEntry(UserName); //SetPsw(oUser, orgPassword, out errStr); //oUser.Close(); oUser.Properties["l"].Value="4"; //oUser.Properties["physicalDeliveryOfficeName"].Value=orgPassword; /********Editor:cengyp 2008年11月3日********/ oUser.Properties["physicalDeliveryOfficeName"].Value = Encryption.DesEncrypt(orgPassword); oUser.Properties["extensionAttribute1"].Value="1111"; oUser.CommitChanges(); oUser.Close(); } catch(Exception err) { errStr=errStr+"-------"+err+" 修改活动目录密码报错\\n"; } }
/// <summary> /// 以管理员的身份更改用户的密码 /// </summary> /// <param name="UserName"></param> /// <param name="NewPassword"></param> public void SetUserPasswordAdmin (string UserName, string NewPassword ,string oldPassword,string orgPassword,out string errStr) { errStr=""; string[] strArrary=new string[4]; string xx=""; ChangePwdService.ChangePWD svr1 = new InterActiveDirectory.ChangePwdService.ChangePWD(); if (svr1.Exchange_PassWord_RTX(UserName, orgPassword, oldPassword) != "") { errStr = xx + "修改RTX密码报错!\\n"; strArrary[0] = "0"; } else { strArrary[0] = "1"; } try { ADVB.AdUser advb=new ADVB.AdUser(); DirectoryEntry oUser= Iads.GetUserEntry(UserName); // advb.SetUserPasswd(oUser.Path,"123123",orgPassword); AdOperate.AD_ExchangePassWord adService = new InterActiveDirectory.AdOperate.AD_ExchangePassWord(); string er=""; int t = adService.SetExchangePassword(UserName, orgPassword, out er)?1:0; //int t=adService.SetPassword_adsi(UserName,orgPassword); // // DirectoryEntry oUser= Iads.GetUserEntry(UserName); // SetPsw(oUser,orgPassword,out errStr); // oUser.Close(); oUser.Properties["l"].Value="4"; //oUser.Properties["initials"].Value=orgPassword; oUser.Properties["extensionAttribute1"].Value="1111"; //strArrary[0]+strArrary[2]+strArrary[1] oUser.CommitChanges(); oUser.Close(); } catch(Exception er) { errStr=errStr+"修改活动目录密码报错\\n"+er.Message; } }