Ejemplo n.º 1
0
        //添加角色时同时将人一起写入
        void AddRoleUser(long RoleID)
        {
            List <string> lstRoleUsers = new List <string>();

            lstRoleUsers.Add(XmlRoleUser(RoleID, S1102App.LongParse(string.Format(S1102Consts.USER_ADMIN, CurrentApp.Session.RentInfo.Token), 0)));
            if (CurrentApp.Session.UserInfo.UserID != S1102App.LongParse(string.Format(S1102Consts.USER_ADMIN, CurrentApp.Session.RentInfo.Token), 0))
            {
                lstRoleUsers.Add(XmlRoleUser(RoleID, CurrentApp.Session.UserInfo.UserID));
            }


            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session  = CurrentApp.Session;
                webRequest.Code     = (int)S1102Codes.SubmitRoleUser;
                webRequest.ListData = lstRoleUsers;
                webRequest.Data     = RoleID.ToString();
                Service11021Client client = new Service11021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11021"));
                //Service11021Client client  = new Service11021Client();
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.URPOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                }
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 2
0
        protected override void Init()
        {
            try
            {
                PageName  = "TempMainPage";
                StylePath = "UMPS9800/TempMainPage.xaml";

                base.Init();

                SetBusy(true, string.Empty);
                mWorker         = new BackgroundWorker();
                mWorker.DoWork += (s, de) =>
                {
                    LoadModuleList();
                };
                mWorker.RunWorkerCompleted += (s, re) =>
                {
                    mWorker.Dispose();
                    SetBusy(false, string.Empty);

                    InitTempFrame();
                    ChangeLanguage();
                };
                mWorker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void InitTempFrame()
        {
            try
            {
                string strArgs = CurrentApp.StartArgs;
                if (string.IsNullOrEmpty(strArgs))
                {
                    //CurrentApp.ShowExceptionMessage(string.Format("StartArgs invalid"));
                    //return;
                    strArgs = "9801";
                }
                var moduleInfo = mListModuleInfos.FirstOrDefault(m => m.Module.ToString() == strArgs);
                if (moduleInfo == null)
                {
                    CurrentApp.WriteLog("PageLoad", string.Format("ModuleInfo not exist.\t{0}", strArgs));
                    return;
                }
                string url = moduleInfo.Url;
                FrameTemp.Navigate(new Uri(url, UriKind.RelativeOrAbsolute));

                CurrentApp.WriteLog("PageLoad", string.Format("Frame url setted.\t{0}", url));
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 4
0
        private void SaveDomainInfo()
        {
            string OptCode = string.Empty;

            if (IsAdd == 1)
            {
                OptCode = "FO1112001";
            }
            else
            {
                OptCode = "FO1112002";
            }
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S1112Codes.SaveDomainInfo;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(IsAdd.ToString());
                OperationReturn optR = XMLHelper.SeriallizeObject(domainInfo);
                if (!optR.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optR.Code, optR.Message));
                    return;
                }
                webRequest.ListData.Add(optR.Data as string);
                Service11121Client client = new Service11121Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11121"));
                //Service11121Client client = new Service11121Client();
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    if (webReturn.Code == 99)
                    {
                        CurrentApp.ShowExceptionMessage(CurrentApp.GetLanguageInfo("", "域名已存在"));
                    }
                    else
                    {
                        CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    }
                    return;
                }
                CurrentApp.GetLanguageInfo("1112T001", "域信息保存成功");
                //写操作日志

                string msg = string.Format("{0}:{1}", CurrentApp.GetLanguageInfo(OptCode, ""), domainInfo.DomainName);
                CurrentApp.WriteOperationLog(OptCode.Substring(2), ConstValue.OPT_RESULT_SUCCESS, msg);
                ParentPage.mListDomainInfo.Clear();
                ParentPage.InitDomainInfo();
            }
            catch (Exception ex)
            {
                if (OptCode != string.Empty)
                {
                    string msg = string.Format("{0}:{1}", CurrentApp.GetLanguageInfo(OptCode, ""), domainInfo.DomainName);
                    CurrentApp.WriteOperationLog(OptCode.Substring(2), ConstValue.OPT_RESULT_FAIL, msg);
                }
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 5
0
        public bool DeleteRelation(ResourceInfo RI)
        {
            bool IsDelete = true;

            //long rentID=ListTenant.FirstOrDefault(p=>p.RentName==RI.TenantName).RentID;
            try
            {
                WebRequest webRequest = new VoiceCyber.UMP.Communications.WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)WebCodes.Relation;
                webRequest.ListData.Add(RI.TenantID.ToString());
                webRequest.ListData.Add(RI.ResourceID.ToString());
                Service11111Client client = new Service11111Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(
                        CurrentApp.Session.AppServerInfo,
                        "Service11111"));
                //Service1111Client client = new Service1111Client();
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    IsDelete = false;
                }
                if (IsDelete)
                {
                    //更新listRelation
                    for (int i = 0; i < ListRelation.Count; i++)
                    {
                        if (ListRelation[i].ResourceID == RI.ResourceID && ListRelation[i].UserID == RI.TenantID)
                        {
                            //删掉该条记录
                            ListRelation.RemoveAt(i);
                        }
                    }

                    //更新listResources,更新界面显示
                    for (int i = 0; i < Listresources.Count; i++)
                    {
                        if (Listresources[i].ResourceID == RI.ResourceID && Listresources[i].TenantName != null && Listresources[i].IsUsed == true)
                        {
                            Listresources[i].IsUsed      = false;
                            Listresources[i].Description = Listresources[i].ToString();
                        }
                    }
                    LoadListBox();
                    DeleteTreeNode(RI);
                }
                DeleteResource = new ResourceInfo();
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
                IsDelete = false;
            }
            return(IsDelete);
        }
Ejemplo n.º 6
0
        public bool SaveRelation(ResourceInfo RI, string ST, string ET)
        {
            bool IsSaved = true;

            //long rentID=ListTenant.FirstOrDefault(p=>p.RentName==RI.TenantName).RentID;
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)WebCodes.Relation;
                webRequest.ListData.Add(RI.TenantID.ToString());
                webRequest.ListData.Add(RI.ResourceID.ToString());
                webRequest.ListData.Add(ST);
                webRequest.ListData.Add(ET);
                Service11111Client client = new Service11111Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(
                        CurrentApp.Session.AppServerInfo,
                        "Service11111"));
                //Service1111Client client = new Service1111Client();
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    IsSaved = false;
                }
                if (IsSaved)
                {
                    //更新listRelation
                    Relation relation = new Relation();
                    relation.ResourceID = RI.ResourceID;
                    relation.UserID     = RI.TenantID;
                    relation.StartTime  = Convert.ToDateTime(ST);
                    relation.EndTime    = Convert.ToDateTime(ET);
                    ListRelation.Add(relation);
                    //更新listResources,更新界面显示
                    for (int i = 0; i < Listresources.Count; i++)
                    {
                        if (Listresources[i].ResourceID == RI.ResourceID && Listresources[i].TenantName != null && Listresources[i].IsUsed == false)
                        {
                            Listresources[i].IsUsed      = true;
                            Listresources[i].Description = Listresources[i].ToString();
                        }
                    }
                    LoadListBox();
                    AddTreeNode(RI);
                }
                resource = new ResourceInfo();
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
                IsSaved = false;
            }
            return(IsSaved);
        }
Ejemplo n.º 7
0
 private void DeleteDomianInfo()
 {
     try
     {
         if (Domaininfo == null)
         {
             return;
         }
         string strInfoMsg = CurrentApp.GetLanguageInfo("1112T008", "确定删除改域信息吗?");
         var    result     = MessageBox.Show(string.Format("{0}\r\n\r\n{1}",
                                                           CurrentApp.GetMessageLanguageInfo("003", "Confirm delete user ?"),
                                                           strInfoMsg), "UMP",
                                             MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (result == MessageBoxResult.Yes)
         {
             WebRequest webRequest = new WebRequest();
             webRequest.Code    = (int)S1112Codes.SaveDomainInfo;
             webRequest.Session = CurrentApp.Session;
             webRequest.ListData.Add("0");
             OperationReturn optR = XMLHelper.SeriallizeObject(Domaininfo);
             if (!optR.Result)
             {
                 CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optR.Code, optR.Message));
                 return;
             }
             webRequest.ListData.Add(optR.Data as string);
             Service11121Client client = new Service11121Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11121"));
             WebReturn webReturn = client.DoOperation(webRequest);
             client.Close();
             if (!webReturn.Result)
             {
                 //if (webReturn.Code == 99)
                 //{
                 //    App.ShowExceptionMessage(App.GetLanguageInfo("", "域名已存在"));
                 //}
                 //else
                 //{
                 CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                 //}
                 return;
             }
             CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1112T002", "域信息删除成功"));
             //写操作日志
             string msg = string.Format("{0}:{1}", CurrentApp.GetLanguageInfo("FO1112003", "delete"), Domaininfo.DomainName);
             CurrentApp.WriteOperationLog(string.Format("1112003"), ConstValue.OPT_RESULT_SUCCESS, msg);
             mListDomainInfo.Clear();
             InitDomainInfo();
         }
     }
     catch (Exception ex)
     {
         string msg = string.Format("{0}:{1}", CurrentApp.GetLanguageInfo("FO1112003", "delete"), Domaininfo.DomainName);
         CurrentApp.WriteOperationLog(string.Format("1112003"), ConstValue.OPT_RESULT_FAIL, msg);
         CurrentApp.ShowExceptionMessage(ex.Message);
     }
 }
Ejemplo n.º 8
0
 void LvDomianData_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         Domaininfo = this.LvDomianData.SelectedItem as BasicDomainInfo;
     }
     catch (Exception ex)
     {
         CurrentApp.ShowExceptionMessage(ex.Message);
     }
 }
Ejemplo n.º 9
0
        private void ModifyRoleInfo(List <string> RoleList)
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1102Codes.ModifyRole;
                //px屏蔽
                //OperationReturn optReturn = XMLHelper.SeriallizeObject(RoleInfo);
                //if (!optReturn.Result)
                //{
                //    S1102App.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                //    return;
                //}
                //webRequest.Data = optReturn.Data.ToString();
                //px-end

                //px+
                webRequest.ListData = RoleList;
                //end

                //Service11021Client client = new Service11021Client();
                Wcf11021.Service11021Client client = new Service11021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11021"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.URPOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    if (webReturn.Code == Defines.RET_DBACCESS_EXIST)
                    {
                        CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1102T00033", "Role Name Already Exists"));
                        //引用对象的加密数据还原
                        //RoleInfo.RoleName = S1102App.DecryptString(RoleInfo.RoleName);
                        //RoleInfo.StrEnableTime = S1102App.DecryptString(RoleInfo.StrEnableTime);
                        //RoleInfo.StrEndTime = S1102App.DecryptString(RoleInfo.StrEndTime);
                        return;
                    }
                    else
                    {
                        CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                        return;
                    }
                }
                RoleModel RoleInfo = this.ObjRoleItem as RoleModel;
                RoleInfo.RoleName      = S1102App.DecryptString(RoleList[1]);
                RoleInfo.StrEnableTime = Convert.ToDateTime(S1102App.DecryptString(RoleList[8])).ToLocalTime().ToString();
                RoleInfo.StrEndTime    = S1102App.DecryptString(RoleList[9]);
                mAsyncResult           = true;
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 10
0
        private void LoadModuleList()
        {
            try
            {
                mListModuleInfos.Clear();
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S9800Codes.GetModuleList;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                CurrentApp.MonitorHelper.AddWebRequest(webRequest);
                Service98001Client client = new Service98001Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service98001"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.DoOperation(webRequest);
                CurrentApp.MonitorHelper.AddWebReturn(webReturn);
                client.Close();
                if (!webReturn.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                if (webReturn.ListData == null)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("Fail.\tListData is null"));
                    return;
                }
                OperationReturn optReturn;
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    var strInfo = webReturn.ListData[i];
                    optReturn = XMLHelper.DeserializeObject <ModuleInfo>(strInfo);
                    if (!optReturn.Result)
                    {
                        CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    ModuleInfo info = optReturn.Data as ModuleInfo;
                    if (info == null)
                    {
                        CurrentApp.ShowExceptionMessage(string.Format("Fail.\tModuleInfo is null"));
                        return;
                    }
                    mListModuleInfos.Add(info);
                }

                CurrentApp.WriteLog("PageLoad", string.Format("LoadModuleList end."));
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 11
0
        void FrameTemp_LoadCompleted(object sender, NavigationEventArgs e)
        {
            try
            {
                CurrentApp.SendLoadedMessage();

                CurrentApp.WriteLog("SendLoaded", string.Format("SendLoaded end"));
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 12
0
        public void InitDomainInfo()
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S1112Codes.GetDomainInfo;
                webRequest.Session = CurrentApp.Session;

                Service11121Client client = new Service11121Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11121"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    CurrentApp.ShowExceptionMessage(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)
                    {
                        CurrentApp.ShowExceptionMessage(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)
                    {
                        //DomainInfos dis = new DomainInfos(di);
                        Dispatcher.Invoke(new Action(() => mListDomainInfo.Add(di)));
                    }
                }
                CurrentApp.WriteLog("PageLoad", string.Format("Load Operation"));
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 13
0
        protected override void Init()
        {
            try
            {
                PageName  = "MainPage";
                StylePath = "UMPS1112/MainPage.xaml";

                base.Init();
                if (CurrentApp != null)
                {
                    S1112App = CurrentApp as S1112App;
                }
                else
                {
                    S1112App = new S1112App(false);
                }
                ChangeTheme();
                ChangeLanguage();

                mListDomainInfo.Clear();
                SetBusy(true, CurrentApp.GetMessageLanguageInfo("001", string.Format("Loading data, please wait...")));
                mWorker         = new BackgroundWorker();
                mWorker.DoWork += (s, de) =>
                {
                    InitOperations();
                    InitRecordDataColumns();
                    InitDomainInfo();
                    CurrentApp.WriteLog("PageLoad", string.Format("All data loaded"));
                };
                mWorker.RunWorkerCompleted += (s, re) =>
                {
                    mWorker.Dispose();
                    SetBusy(false, string.Empty);
                    CreateOptButtons();
                    CreateDomainDataColumns();
                    //触发Loaded消息
                    CurrentApp.SendLoadedMessage();

                    ChangeTheme();
                    ChangeLanguage();

                    CurrentApp.WriteLog(string.Format("Load\t\tPage load end"));
                };
                mWorker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 14
0
        protected override void Init()
        {
            try
            {
                this.ListBoxReources.ItemsSource = ListResources;
                this.ComboResource.ItemsSource   = ListresourceName;
                this.TreeViewObjects.ItemsSource = mRoot.Children;

                PageName  = "MainView";
                StylePath = "UMPS1111/MainPage.xaml";

                base.Init();
                if (CurrentApp != null)
                {
                    S1111App = CurrentApp as S1111App;
                }
                else
                {
                    S1111App = new S1111App(false);
                }
                ChangeTheme();
                ChangeLanguage();

                SetBusy(true, string.Empty);
                mWorker         = new BackgroundWorker();
                mWorker.DoWork += (s, de) =>
                {
                    //触发Loaded消息
                    CurrentApp.SendLoadedMessage();

                    InitListresourceName();
                    LoadRentInfo();
                    LoadRelationInfo();
                };
                mWorker.RunWorkerCompleted += (s, re) =>
                {
                    mWorker.Dispose();
                    SetBusy(false, string.Empty);

                    LoadVCLogServerInfo();
                    LoadListBox();
                    InitTree();
                };
                mWorker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 15
0
        void AddNewRoleInfo(RoleModel newRoleInfo)
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1102Codes.AddNewRole;
                OperationReturn optReturn = XMLHelper.SeriallizeObject(newRoleInfo);
                if (!optReturn.Result)
                {
                    #region
                    string msg = string.Format("{0}{1}{2}", CurrentApp.Session.UserInfo.UserName, Utils.FormatOptLogString("FO1102001"), RoleInfo.RoleName);
                    CurrentApp.WriteOperationLog(S1102Consts.OPT_AddRole.ToString(), ConstValue.OPT_RESULT_FAIL, msg);
                    #endregion
                    CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                webRequest.Data = optReturn.Data.ToString();

                //Service11021Client client = new Service11021Client();
                Wcf11021.Service11021Client client = new Service11021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11021"));
                WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.URPOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    if (webReturn.Code == Defines.RET_DBACCESS_EXIST)
                    {
                        CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1102T00033", "Role Name Already Exists"));
                        return;
                    }
                    else
                    {
                        CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                        return;
                    }
                }
                else
                {
                    long RoleID = Convert.ToInt64(webReturn.Data);
                    AddRoleUser(RoleID);
                }
                mAsyncResult = true;
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 16
0
        private void InitRecordDataColumns()
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)RequestCode.WSGetUserViewColumnList;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                webRequest.ListData.Add("1112001");
                Service11012Client client = new Service11012Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                List <ViewColumnInfo> listColumns = new List <ViewColumnInfo>();
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <ViewColumnInfo>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    ViewColumnInfo columnInfo = optReturn.Data as ViewColumnInfo;
                    if (columnInfo != null)
                    {
                        columnInfo.Display = columnInfo.ColumnName;
                        listColumns.Add(columnInfo);
                    }
                }
                listColumns = listColumns.OrderBy(c => c.SortID).ToList();
                mListDomainDataColumns.Clear();
                for (int i = 0; i < listColumns.Count; i++)
                {
                    Dispatcher.Invoke(new Action(() => mListDomainDataColumns.Add(listColumns[i])));
                }

                CurrentApp.WriteLog("PageLoad", string.Format("Load RecordColumn"));
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 17
0
        //初始化ListTenant
        public void LoadRentInfo()
        {
            ListTenant.Clear();
            WebRequest webRequestR = new WebRequest();

            webRequestR.Session = CurrentApp.Session;
            webRequestR.Code    = (int)WebCodes.GetRentInfo;
            Service11111Client clientR = new Service11111Client(
                WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                WebHelper.CreateEndpointAddress(
                    CurrentApp.Session.AppServerInfo,
                    "Service11111"));

            //Service1111Client clientR = new Service1111Client();
            WebHelper.SetServiceClient(clientR);
            WebReturn webReturnR = clientR.DoOperation(webRequestR);

            clientR.Close();
            if (!webReturnR.Result)
            {
                CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturnR.Code, webReturnR.Message));
                return;
            }
            if (webReturnR.ListData == null)
            {
                CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturnR.Code, webReturnR.Message));
                return;
            }
            OperationReturn optReturnR;

            for (int i = 0; i < webReturnR.ListData.Count; i++)
            {
                optReturnR = XMLHelper.DeserializeObject <TenantInfo>(webReturnR.ListData[i]);
                if (!optReturnR.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturnR.Code, optReturnR.Message));
                    return;
                }
                TenantInfo info = optReturnR.Data as TenantInfo;
                if (info == null)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("ResourcePropertyInfo is null"));
                    return;
                }
                info.RentName = S1111App.DecryptString(info.RentName);
                ListTenant.Add(info);
            }
        }
Ejemplo n.º 18
0
        private void InitOperations()
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)RequestCode.WSGetUserOptList;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                webRequest.ListData.Add("11");
                webRequest.ListData.Add("1112");
                Service11012Client client = new Service11012Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                ListOperations.Clear();
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <OperationInfo>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    OperationInfo optInfo = optReturn.Data as OperationInfo;
                    if (optInfo != null)
                    {
                        optInfo.Display     = CurrentApp.GetLanguageInfo(string.Format("FO{0}", optInfo.ID), optInfo.ID.ToString());
                        optInfo.Description = optInfo.Display;
                        Dispatcher.Invoke(new Action(() => ListOperations.Add(optInfo)));
                    }
                }

                CurrentApp.WriteLog("PageLoad", string.Format("Load Operation"));
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 19
0
        private void ChangeFrameUrl(string subModule)
        {
            try
            {
                CurrentApp.WriteLog("ChangeFrame", string.Format("Changing frame...\t{0}", subModule));
                var moduleInfo = mListModuleInfos.FirstOrDefault(m => m.Module.ToString() == subModule);
                if (moduleInfo == null)
                {
                    CurrentApp.WriteLog("ChangeFrame", string.Format("ModuleInfo not exist.\t{0}", subModule));
                    return;
                }
                string url = moduleInfo.Url;
                FrameTemp.Navigate(new Uri(url, UriKind.RelativeOrAbsolute));

                CurrentApp.WriteLog("ChangeFrame", string.Format("Frame url setted.\t{0}", url));
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }
Ejemplo n.º 20
0
        private bool CheckValues()
        {
            string description = this.TexDomainDescription.Text.Trim();
            string domainName  = this.TxtDomainName.Text.Trim();
            string username    = this.TxtUserName.Text.Trim();
            string password    = this.PassBoxUserPassword.Password.Trim();

            //1.域名称不能为空,且不重复,添加的时候在wcf里面判断
            //2.域账号和密码要可以查到域里的账号
            //3.域描述不能为空
            //4.密码不能有@
            //5.不能有大写字母
            if (domainName.Trim() == string.Empty)
            {
                CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1112T004", "域名为空"));
                return(false);
            }
            if (description.Trim() == string.Empty)
            {
                CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1112T005", "域描述为空"));
                return(false);
            }
            if (password.Trim().Equals("@"))
            {
                CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1112T006", "密码不能有@字符"));
                return(false);
            }
            bool IsUsed = false;

            try
            {
                string IStrADPath = string.Format("LDAP://{0}", domainName);

                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S1112Codes.CheckDomainInfo;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(IStrADPath);
                webRequest.ListData.Add(username);
                webRequest.ListData.Add(password);

                Service11121Client client = new Service11121Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11121"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (webReturn.Result)
                {
                    IsUsed = true;
                }
                else
                {
                    CurrentApp.ShowExceptionMessage(string.Format("{0}:{1}", CurrentApp.GetLanguageInfo("1112T007", "域连接出错"), webReturn.Message));
                }
            }
            catch (Exception ex)
            {
                //域不可用
                CurrentApp.ShowExceptionMessage(CurrentApp.GetLanguageInfo("1112T007", "域连接出错"));
                //S1112App.ShowExceptionMessage(string.Format("Get Users Info From LDAP Fail:{0}", ex.Message));
                CurrentApp.WriteLog(string.Format("Get all AD users fail.\t{0}", ex.Message));
                return(false);
            }
            if (IsAdd == 1)
            {
                domainInfo = new BasicDomainInfo();
            }
            domainInfo.Description        = description;
            domainInfo.DomainName         = domainName;
            domainInfo.DomainUserName     = username;
            domainInfo.DomainUserPassWord = password;
            domainInfo.IsActiveLogin      = this.CheckDomainActiveLogin.IsChecked == true ? true : false;
            //domainInfo.IsActive = true;
            //domainInfo.IsDelete = false;
            return(IsUsed);
        }
Ejemplo n.º 21
0
        //初始化Listresources
        public void LoadVCLogServerInfo()
        {
            Listresources.Clear();
            WebRequest webRequest = new WebRequest();

            webRequest.Session = CurrentApp.Session;
            webRequest.Code    = (int)WebCodes.GetVoiceIP_Name201;
            Service11111Client client = new Service11111Client(
                WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                WebHelper.CreateEndpointAddress(
                    CurrentApp.Session.AppServerInfo,
                    "Service11111"));

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

            client.Close();
            if (!webReturn.Result)
            {
                CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                return;
            }
            if (webReturn.ListData == null)
            {
                CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                return;
            }
            OperationReturn optReturn;

            for (int i = 0; i < webReturn.ListData.Count; i++)
            {
                optReturn = XMLHelper.DeserializeObject <ResourceInfo>(webReturn.ListData[i]);
                if (!optReturn.Result)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                ResourceInfo info = optReturn.Data as ResourceInfo;
                if (info == null)
                {
                    CurrentApp.ShowExceptionMessage(string.Format("ResourcePropertyInfo is null"));
                    return;
                }

                long InfoID = info.ResourceID;
                for (int j = 0; j < ListRelation.Count; j++)
                {
                    if (ListRelation[j].ResourceID == InfoID)
                    {
                        info.IsUsed   = true;
                        info.TenantID = ListRelation[j].UserID;
                        for (int k = 0; k < ListTenant.Count; k++)
                        {
                            if (ListTenant[k].RentID == ListRelation[j].UserID)
                            {
                                info.TenantName = ListTenant[k].RentName;
                            }
                        }
                    }
                }
                info.Description = info.ToString();
                Listresources.Add(info);
            }
            CurrentApp.WriteLog("PageLoad", string.Format("Init ResourceInfo"));
        }
Ejemplo n.º 22
0
        private void CreateDomainDataColumns()
        {
            try
            {
                GridView             gv = new GridView();
                GridViewColumn       gvc;
                GridViewColumnHeader gvch;
                for (int i = 0; i < mListDomainDataColumns.Count; i++)
                {
                    ViewColumnInfo columnInfo = mListDomainDataColumns[i];
                    if (columnInfo.Visibility == "1")
                    {
                        gvc          = new GridViewColumn();
                        gvch         = new GridViewColumnHeader();
                        gvch.Content = columnInfo.Display;
                        gvch.Content = CurrentApp.GetLanguageInfo(string.Format("COL1112001{0}", columnInfo.ColumnName), columnInfo.Display);
                        gvch.ToolTip = CurrentApp.GetLanguageInfo(string.Format("COL1112001{0}", columnInfo.ColumnName), columnInfo.Display);
                        //gvch.Command = QMMainPageCommands.GridViewColumnHeaderCommand;
                        gvch.CommandParameter = columnInfo;
                        gvc.Header            = gvch;
                        gvc.Width             = columnInfo.Width;
                        //Binding binding;
                        DataTemplate dt = null;
                        if (columnInfo.ColumnName == "SerialID")
                        {
                            dt = Resources["CellRecordListSerialIDTemplate"] as DataTemplate;
                        }
                        if (columnInfo.ColumnName == "State")
                        {
                            dt = Resources["ObjectStateCellTemplate"] as DataTemplate;
                        }
                        //if (columnInfo.ColumnName == "Password")
                        //{
                        //    dt = Resources["ObjectPasswordCellTemplate"] as DataTemplate;
                        //}
                        if (dt != null)
                        {
                            gvc.CellTemplate = dt;
                        }
                        else
                        {
                            gvc.DisplayMemberBinding = new Binding(columnInfo.ColumnName);
                        }

                        if (columnInfo.ColumnName == "Name")
                        {
                            gvc.DisplayMemberBinding = new Binding("DomainName");
                        }
                        if (columnInfo.ColumnName == "Sort")
                        {
                            gvc.DisplayMemberBinding = new Binding("DomainCode");
                        }
                        if (columnInfo.ColumnName == "User")
                        {
                            gvc.DisplayMemberBinding = new Binding("DomainUserName");
                        }

                        gv.Columns.Add(gvc);
                    }
                }
                LvDomianData.View = gv;
            }
            catch (Exception ex)
            {
                CurrentApp.ShowExceptionMessage(ex.Message);
            }
        }