protected void btnImportUsers_Click(object sender, EventArgs e) { ServiceManager sm = new ServiceManager(); using (LP2ServiceClient service = sm.StartServiceClient()) { ImportADUsersRequest req = new ImportADUsersRequest(); req.AD_OU_Filter = this.txtADOUFilterName.Text.Trim(); req.hdr = new ReqHdr(); req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data req.hdr.UserId = 5;//todo:check dummy data ImportADUsersResponse respone = null; try { respone = service.ImportADUsers(req); if (respone.hdr.Successful) { PageCommon.WriteJsEnd(this, "Imported AD Users successfully.", PageCommon.Js_RefreshSelf); } else { PageCommon.WriteJsEnd(this, "Failed to import AD users, reason:" + respone.hdr.StatusInfo, PageCommon.Js_RefreshSelf); } } catch (System.ServiceModel.EndpointNotFoundException ee) { LPLog.LogMessage(ee.Message); PageCommon.AlertMsg(this, "Failed to import AD Users, reason: User Manager is not running."); } catch (Exception exception) { LPLog.LogMessage(exception.Message); PageCommon.WriteJsEnd(this, "Failed to import AD users, reason:" + exception.Message, PageCommon.Js_RefreshSelf); } } }