Exemple #1
0
        private void InitVCLog()
        {
            ListVCLog.Clear();
            WebRequest webRequest = new WebRequest();

            webRequest.Session = CurrentApp.Session;
            webRequest.Code    = (int)S1101Codes.GetAgentOrExt;
            webRequest.ListData.Add(UserItem.ObjID.ToString());
            webRequest.ListData.Add("221");
            Service11011Client client = new Service11011Client(
                WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                WebHelper.CreateEndpointAddress(
                    CurrentApp.Session.AppServerInfo,
                    "Service11011"));

            //Service1111Client client = new Service1111Client();
            WebHelper.SetServiceClient(client);
            WebReturn webReturn = client.DoOperation(webRequest);

            client.Close();
            if (!webReturn.Result)
            {
                ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                return;
            }
            if (webReturn.ListData == null)
            {
                ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                return;
            }
            ListVCLog = webReturn.ListData;
        }
        private void LoadAvaliableRealExts(ObjectItem parentItem, string parentID)
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1101Codes.GetControlRealExtensionInfoList;
                webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
                webRequest.ListData.Add(parentID);
                //Service11011Client client = new Service11011Client();
                Service11011Client client = new Service11011Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(
                        CurrentApp.Session.AppServerInfo,
                        "Service11011"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("InitControlExtension 1 Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                if (webReturn.ListData == null)
                {
                    ShowException(string.Format("Fail.\tListData is null"));
                    return;
                }
                //List<ObjectItem> listChild = new List<ObjectItem>();
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <BasicUserInfo>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("InitControlExtension Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    BasicUserInfo ExtensionInfo = optReturn.Data as BasicUserInfo;
                    if (ExtensionInfo.IsDeleted == "0")
                    {
                        ObjectItem item = new ObjectItem();

                        item.ObjType     = S1101Consts.OBJTYPE_REALEXTENSION;
                        item.ObjID       = ExtensionInfo.UserID;
                        item.Icon        = "Images/RealExtension.ico";
                        item.Name        = ExtensionInfo.Account;
                        item.FullName    = ExtensionInfo.FullName;
                        item.Description = ExtensionInfo.FullName;
                        item.Data        = ExtensionInfo;
                        //listChild.Add(item);
                        Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
                        mListObjectItems.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        private void LoadAvaliableRoles(RoleItem parentItem)
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1101Codes.GetUserRoleList;
                webRequest.ListData.Add(parentItem.RoleId.ToString());
                webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());

                Service11011Client client = new Service11011Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo,
                                                    "Service11011"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    string   roleInfo      = webReturn.ListData[i];
                    string[] listRoleInfos = roleInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                                            StringSplitOptions.RemoveEmptyEntries);
                    if (listRoleInfos.Length != 2)
                    {
                        ShowException(string.Format("RoleInfo invalid.\t{0}", roleInfo));
                        return;
                    }
                    string roleID   = listRoleInfos[0];
                    string roleName = listRoleInfos[1];
                    if (roleID == S1101Consts.ROLE_SYSTEMADMIN.ToString())
                    {
                        roleName = CurrentApp.GetLanguageInfo(string.Format("COMR{0}", roleID), "Administrator");
                    }
                    if (roleID == "1060000000000000004")
                    {
                        roleName = CurrentApp.GetLanguageInfo(string.Format("COMR{0}", roleID), "Agent");
                    }

                    RoleItem roleItem = new RoleItem();
                    roleItem.RoleId = Convert.ToInt64(roleID);
                    roleItem.Name   = roleName;
                    AddChildItem(parentItem, roleItem);
                    mListRoleItems.Add(roleItem);
                    LoadAvaliableRoles(roleItem);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Exemple #4
0
 //加载录音服务器树
 private void LoadVCLog(ObjectItem parentItem, string parentID)
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = (int)S1101Codes.GetResourceObjList;
         webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
         webRequest.ListData.Add("221");
         //webRequest.ListData.Add("1");
         Service11011Client client = new Service11011Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(
                 CurrentApp.Session.AppServerInfo,
                 "Service11011"));
         WebHelper.SetServiceClient(client);
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException(string.Format("Fail.\tListData is null"));
             return;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             string       strInfo = webReturn.ListData[i];
             ResourceInfo RI      = new ResourceInfo();
             for (int j = 0; j < mListResourcesInfo.Count; j++)
             {
                 if (strInfo == mListResourcesInfo[j].ResourceID.ToString())
                 {
                     ObjectItem item = new ObjectItem();
                     item.ObjType = ConstValue.RESOURCE_ORG;
                     item.ObjID   = mListResourcesInfo[j].ResourceID;
                     item.Name    = mListResourcesInfo[j].Tostring();
                     item.Data    = mListResourcesInfo[j];
                     item.Icon    = "Images/voiceserver.png";
                     Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
                     mListObjectItems.Add(item);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
        private void InitDomainInfo()
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S1101Codes.GetDomainInfo;
                webRequest.Session = CurrentApp.Session;

                Service11011Client client = new Service11011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11011"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                //Dispatcher.Invoke(new Action(() => mListDomainInfo.Clear()));
                List <BasicDomainInfo> ListDomainInfo = new List <BasicDomainInfo>();
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <BasicDomainInfo>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    BasicDomainInfo domainInfo = optReturn.Data as BasicDomainInfo;
                    if (domainInfo != null)
                    {
                        domainInfo.DomainUserPassWord = domainInfo.DomainUserPassWord.Substring(20);
                        ListDomainInfo.Add(domainInfo);
                    }
                }
                ListDomainInfo = ListDomainInfo.OrderBy(p => p.DomainCode).ToList();
                foreach (BasicDomainInfo di in ListDomainInfo)
                {
                    if (!di.IsDelete)
                    {
                        Dispatcher.Invoke(new Action(() => IListDomainInfo.Add(di)));
                    }
                }
                CurrentApp.WriteLog("PageLoad", string.Format("Load Operation"));
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        private void LoadUserControledRoles()
        {
            if (UserItem == null)
            {
                return;
            }
            BasicUserInfo userInfo = UserItem.Data as BasicUserInfo;

            if (userInfo == null)
            {
                return;
            }
            Dispatcher.Invoke(new Action(() => mUserRoles.Clear()));

            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1101Codes.GetUserRoleList;
                webRequest.ListData.Add("-1");
                webRequest.ListData.Add(userInfo.UserID.ToString());
                Service11011Client client = new Service11011Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo,
                                                    "Service11011"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    string roleID = webReturn.ListData[i];
                    if (string.IsNullOrEmpty(roleID))
                    {
                        ShowException(string.Format("RoleID invalid.\t{0}", roleID));
                        return;
                    }
                    mUserRoles.Add(roleID);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        private void LoadUserExtInfo()
        {
            if (BasicUserInfo == null)
            {
                return;
            }
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1101Codes.GetUserExtInfo;
                webRequest.Data    = BasicUserInfo.UserID.ToString();

                Service11011Client client = new Service11011Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo,
                                                    "Service11011"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    if (webReturn.Code != Defines.RET_NOT_EXIST)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                        return;
                    }
                    ExtUserInfo = new ExtendUserInfo();
                    return;
                }
                OperationReturn optReturn = XMLHelper.DeserializeObject <ExtendUserInfo>(webReturn.Data);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                ExtUserInfo = optReturn.Data as ExtendUserInfo;
                if (ExtUserInfo == null)
                {
                    ShowException(string.Format("Fail.\t{0}", "ExtUserInfo is null"));
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        private void ModifyExtUserInfo(ExtendUserInfo extUserInfo)
        {
            try
            {
                if (extUserInfo == null)
                {
                    return;
                }

                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1101Codes.ModifyUserExtInfo;
                //0     UserID
                //1     Email
                //2     Phone
                //3     Birthday
                //4     HeadIcon
                webRequest.ListData.Add(extUserInfo.UserID.ToString());
                webRequest.ListData.Add(extUserInfo.MailAddress);
                webRequest.ListData.Add(extUserInfo.PhoneNumber);
                webRequest.ListData.Add(extUserInfo.Birthday);
                webRequest.ListData.Add(extUserInfo.HeadIcon);

                Service11011Client client = new Service11011Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(
                        CurrentApp.Session.AppServerInfo,
                        "Service11011"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                }
                mAsyncResult = true;
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
 private void AddNewUser(BasicUserInfo basicUserInfo)
 {
     try
     {
         OperationReturn optReturn = XMLHelper.SeriallizeObject(basicUserInfo);
         if (!optReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
             return;
         }
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = (int)S1101Codes.AddNewUser;
         webRequest.Data    = optReturn.Data.ToString();
         Service11011Client client = new Service11011Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(
                 CurrentApp.Session.AppServerInfo,
                 "Service11011"));
         WebHelper.SetServiceClient(client);
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             if (webReturn.Code == Defines.RET_DBACCESS_EXIST)
             {
                 ShowException(CurrentApp.GetMessageLanguageInfo("007", "User account already exist"));
                 return;
             }
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         basicUserInfo.UserID = Convert.ToInt64(webReturn.Data);
         mAsyncResult         = true;
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
        private void ModifyUserInfo(List <string> listParams)
        {
            try
            {
                if (listParams == null)
                {
                    return;
                }
                WebRequest webRequest = new WebRequest();
                webRequest.Session  = CurrentApp.Session;
                webRequest.Code     = (int)S1101Codes.ModifyUserInfo;
                webRequest.ListData = listParams;

                Service11011Client client = new Service11011Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(
                        CurrentApp.Session.AppServerInfo,
                        "Service11011"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    if (webReturn.Code == Defines.RET_DBACCESS_EXIST)
                    {
                        ShowException(CurrentApp.GetMessageLanguageInfo("007", "User account already exist"));
                        return;
                    }
                    ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                mAsyncResult = true;
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Exemple #11
0
        private void SetUserControlObject()
        {
            if (UserItem == null)
            {
                return;
            }
            BasicUserInfo userInfo = UserItem.Data as BasicUserInfo;

            if (userInfo == null)
            {
                return;
            }
            List <string> listObjectState = new List <string>();

            SetUserControlObject(mRootItem, ref listObjectState);

            if (IsCheckSelfPrimission)
            {
                if (listObjectState.Count > 0)
                {
                    int count = listObjectState.Count;
                    if (PageParent != null)
                    {
                        PageParent.SetBusy(true, string.Empty);
                    }
                    mWorder         = new BackgroundWorker();
                    mWorder.DoWork += (s, de) =>
                    {
                        try
                        {
                            WebRequest webRequest = new WebRequest();
                            webRequest.Session = CurrentApp.Session;
                            webRequest.Code    = (int)S1101Codes.SetUserControlObject;
                            webRequest.ListData.Add(userInfo.UserID.ToString());
                            webRequest.ListData.Add(count.ToString());
                            for (int i = 0; i < count; i++)
                            {
                                webRequest.ListData.Add(listObjectState[i]);
                            }
                            Service11011Client client = new Service11011Client(
                                WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                WebHelper.CreateEndpointAddress(
                                    CurrentApp.Session.AppServerInfo,
                                    "Service11011"));
                            WebHelper.SetServiceClient(client);
                            WebReturn webReturn = client.DoOperation(webRequest);
                            client.Close();
                            if (!webReturn.Result)
                            {
                                ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                            }

                            #region 记录日志

                            string        strAdded      = string.Empty;
                            string        strRemoved    = string.Empty;
                            List <string> listLogParams = new List <string>();
                            if (webReturn.ListData != null && webReturn.ListData.Count > 0)
                            {
                                for (int i = 0; i < webReturn.ListData.Count; i++)
                                {
                                    string   strInfo  = webReturn.ListData[i];
                                    string[] arrInfos = strInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                                                      StringSplitOptions.RemoveEmptyEntries);
                                    if (arrInfos.Length >= 2)
                                    {
                                        if (arrInfos[0] == "A")
                                        {
                                            var objItem =
                                                mListObjectItems.FirstOrDefault(o => o.ObjID.ToString() == arrInfos[1]);
                                            if (objItem != null)
                                            {
                                                strAdded += objItem.Name + ",";
                                            }
                                            else
                                            {
                                                strAdded += arrInfos[1] + ",";
                                            }
                                        }
                                        if (arrInfos[0] == "D")
                                        {
                                            var objItem =
                                                mListObjectItems.FirstOrDefault(o => o.ObjID.ToString() == arrInfos[1]);
                                            if (objItem != null)
                                            {
                                                strRemoved += objItem.Name + ",";
                                            }
                                            else
                                            {
                                                strRemoved += arrInfos[1] + ",";
                                            }
                                        }
                                    }
                                }
                                strAdded   = strAdded.TrimEnd(new[] { ',' });
                                strRemoved = strRemoved.TrimEnd(new[] { ',' });
                            }
                            listLogParams.Add(userInfo.FullName);
                            listLogParams.Add(strAdded);
                            listLogParams.Add(strRemoved);
                            CurrentApp.WriteOperationLog(S1101Consts.OPT_SETUSERRESOURCEMANAGEMENT.ToString(), ConstValue.OPT_RESULT_SUCCESS, "LOG1101001", listLogParams);

                            #endregion
                        }
                        catch (Exception ex)
                        {
                            ShowException(ex.Message);
                        }
                    };
                    mWorder.RunWorkerCompleted += (s, re) =>
                    {
                        mWorder.Dispose();
                        if (PageParent != null)
                        {
                            PageParent.SetBusy(false, string.Empty);
                        }
                        var parent = Parent as PopupPanel;
                        if (parent != null)
                        {
                            parent.IsOpen = false;
                        }
                    };
                    mWorder.RunWorkerAsync();
                }
            }
        }
        private void BtnConfirm_Click(object sender, RoutedEventArgs e)
        {
            List <DomainObjectItem> mListSaveDomainInfo = new List <DomainObjectItem>();

            //获取所有打钩的对象
            GetSaveObject(mRoot, ref mListSaveDomainInfo);
            if (mListSaveDomainInfo.Count == 0)
            {
                CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("", "请选择用户")); return;
            }
            try
            {
                foreach (DomainObjectItem BItem in mListSaveDomainInfo)
                {
                    BasicUserInfo basicUserInfo = new BasicUserInfo();
                    basicUserInfo.SourceFlag = "L";

                    basicUserInfo.CreateTime    = DateTime.Now;
                    basicUserInfo.StartTime     = DateTime.Parse("2014/1/1 00:00:00");
                    basicUserInfo.EndTime       = DateTime.Parse(S1101Consts.Default_StrEndTime.ToString());
                    basicUserInfo.StrCreateTime = basicUserInfo.CreateTime.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss");
                    basicUserInfo.StrStartTime  = basicUserInfo.StartTime.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss");
                    basicUserInfo.StrEndTime    = basicUserInfo.EndTime.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss");
                    if (BItem.FullName.Contains("@"))
                    {
                        basicUserInfo.Account = BItem.FullName;
                    }
                    else
                    {
                        basicUserInfo.Account = string.Format("{0}@{1}", IStrADDomain, BItem.FullName);
                    }
                    basicUserInfo.Creator   = CurrentApp.Session.UserID;
                    basicUserInfo.FullName  = BItem.Name;
                    basicUserInfo.OrgID     = OrgObjItem.ObjID;
                    basicUserInfo.Password  = string.Empty;
                    basicUserInfo.IsActived = "1";


                    OperationReturn optReturn = XMLHelper.SeriallizeObject(basicUserInfo);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    WebRequest webRequest = new WebRequest();
                    webRequest.Session = CurrentApp.Session;
                    webRequest.Code    = (int)S1101Codes.LoadNewUser;
                    webRequest.Data    = optReturn.Data.ToString();
                    Service11011Client client = new Service11011Client(
                        WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                        WebHelper.CreateEndpointAddress(
                            CurrentApp.Session.AppServerInfo,
                            "Service11011"));
                    WebHelper.SetServiceClient(client);
                    WebReturn webReturn = client.DoOperation(webRequest);
                    client.Close();
                    if (!webReturn.Result)
                    {
                        if (webReturn.Code == Defines.RET_DBACCESS_EXIST)
                        {
                            ShowException(CurrentApp.GetMessageLanguageInfo("007", "User account already exist"));
                            //return;
                            continue;
                        }
                        ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                        return;
                    }
                    basicUserInfo.UserID = Convert.ToInt64(webReturn.Data);
                    //修改密码为M003加码
                    webRequest.Code = (int)S1101Codes.ModifyUserPasswordM003;
                    webRequest.ListData.Add(basicUserInfo.UserID.ToString());
                    webRequest.ListData.Add("0");
                    webRequest.ListData.Add(string.Empty);
                    Service11011Client clientCP = new Service11011Client(
                        WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                        WebHelper.CreateEndpointAddress(
                            CurrentApp.Session.AppServerInfo,
                            "Service11011"));
                    WebHelper.SetServiceClient(clientCP);
                    WebReturn webReturnCP = clientCP.DoOperation(webRequest);
                    clientCP.Close();
                    if (!webReturnCP.Result)
                    {
                        ShowException(string.Format("Change Passworld Fail:{0}\t{1}", webReturnCP.Code, webReturnCP.Message));
                    }
                }
                ParenntPage.ReloadData();
                CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1101N029", "Import User Data Successful"));

                string msg = string.Format("{0}:{1}", CurrentApp.Session.UserInfo.UserName, Utils.FormatOptLogString("FO1101012"), IStrADDomain);
                CurrentApp.WriteOperationLog(S1101Consts.OPT_LDAP.ToString(), ConstValue.OPT_RESULT_SUCCESS, msg);
            }
            catch (Exception ex)
            {
                ShowException(CurrentApp.GetLanguageInfo("1101N037", "导入失败") + ex.Message);
                #region 日志
                string msg = string.Format("{0}:{1}", Utils.FormatOptLogString("FO1101012"), IStrADDomain);
                CurrentApp.WriteOperationLog("1101012", ConstValue.OPT_RESULT_FAIL, msg);
                #endregion
            }
            PageClose();
        }
Exemple #13
0
 private void InitMemoUsers()
 {
     try
     {
         List <string> listUserID = new List <string>();
         for (int i = 0; i < mListRecordMemos.Count; i++)
         {
             string strUserID = mListRecordMemos[i].UserID.ToString();
             if (!listUserID.Contains(strUserID))
             {
                 listUserID.Add(strUserID);
             }
         }
         if (listUserID.Count <= 0)
         {
             return;
         }
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = (int)S1101Codes.GetResourceProperty;
         webRequest.ListData.Add("102");
         webRequest.ListData.Add("Account");
         webRequest.ListData.Add(listUserID.Count.ToString());
         for (int i = 0; i < listUserID.Count; i++)
         {
             webRequest.ListData.Add(listUserID[i]);
         }
         Service11011Client client = new Service11011Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(
                 CurrentApp.Session.AppServerInfo,
                 "Service11011"));
         //WebHelper.SetServiceClient(client);
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException(string.Format("Fail.\tListData is null"));
             return;
         }
         mListUsers.Clear();
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             string   strInfo = webReturn.ListData[i];
             string[] arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                              StringSplitOptions.RemoveEmptyEntries);
             if (arrInfo.Length < 2)
             {
                 continue;
             }
             long   id      = Convert.ToInt64(arrInfo[0]);
             string account = arrInfo[1];
             if (id == CurrentApp.Session.UserID)
             {
                 continue;
             }
             BasicUserItem item = new BasicUserItem();
             item.UserID = id;
             item.Name   = account;
             mListUsers.Add(item);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Exemple #14
0
        private void LoadAvaliableOrgs(ObjectItem parentItem, string parentID)
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S1101Codes.GetOrganizationList;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                webRequest.ListData.Add(parentID);
                Service11011Client client = new Service11011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11011"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("InitControledOrgs Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                List <ObjectItem> listChild = new List <ObjectItem>();
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <BasicOrgInfo>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("InitControledOrgs Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    BasicOrgInfo orgInfo = optReturn.Data as BasicOrgInfo;
                    if (orgInfo != null)
                    {
                        ObjectItem item = new ObjectItem();
                        item.ObjType         = S1101Consts.OBJTYPE_ORG;
                        item.ObjID           = orgInfo.OrgID;
                        orgInfo.OrgName      = orgInfo.OrgName;
                        orgInfo.StrStartTime = DateTime.Parse(orgInfo.StrStartTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
                        orgInfo.StrEndTime   = orgInfo.StrEndTime;
                        if (!orgInfo.StrEndTime.ToUpper().Equals("UNLIMITED"))
                        {
                            orgInfo.EndTime    = DateTime.Parse(orgInfo.StrEndTime).ToLocalTime();
                            orgInfo.StrEndTime = DateTime.Parse(orgInfo.StrEndTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
                        }
                        orgInfo.CreateTime = orgInfo.CreateTime.ToLocalTime();
                        item.Name          = orgInfo.OrgName;
                        item.FullName      = item.Name;
                        item.Description   = orgInfo.Description;
                        item.State         = Convert.ToInt32(orgInfo.IsActived);
                        item.ObjParentID   = orgInfo.ParentID;
                        if (item.State == 1)
                        {
                            item.TipState = CurrentApp.GetLanguageInfo("1101T10109", "IsActived");
                        }
                        else
                        {
                            item.TipState = CurrentApp.GetLanguageInfo("1101T10110", "Disable");
                        }
                        if (item.ObjID == ConstValue.ORG_ROOT)
                        {
                            item.Icon = "Images/root.ico";
                        }
                        else
                        {
                            item.Icon = "Images/org.ico";
                        }
                        item.Data = orgInfo;
                        LoadAvaliableOrgs(item, orgInfo.OrgID.ToString());

                        Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
                    }
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }