Example #1
0
 private void LoadAvaliableAgent(OrgUserItem parentItem, string parentId)
 {
     try
     {
         WebRequest webRequest = new WebRequest
         {
             Session = CurrentApp.Session,
             Code    = (int)S3603Codes.OptGetCtrolAgent
         };
         webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
         webRequest.ListData.Add(parentId);
         Service36031Client client = new Service36031Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(
                 CurrentApp.Session.AppServerInfo,
                 "Service36031"));
         //var client = new Service36031Client();
         WebReturn webReturn = client.UmpTaskOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException("Fail.\tListData is null");
             return;
         }
         foreach (string strInfo in webReturn.ListData)
         {
             string[] arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                              StringSplitOptions.RemoveEmptyEntries);
             if (arrInfo.Length < 3)
             {
                 continue;
             }
             string      strId       = arrInfo[0];
             string      strName     = arrInfo[1];
             string      strFullName = arrInfo[2];
             OrgUserItem item        = new OrgUserItem
             {
                 ObjType     = ConstValue.RESOURCE_AGENT,
                 ObjID       = Convert.ToInt64(strId),
                 Name        = strName,
                 Description = strFullName,
                 Data        = strInfo,
                 Icon        = "Images/user_suit.png"
             };
             Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
             _mListOrgUserItems.Add(item);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
        private void GetTestUserInfo(TestInfoParam testInfoTemp)
        {
            _mlstTestUserParam.Clear();
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = App.Session;
                webRequest.Code    = (int)S3603Codes.OptGetTestUserInfo;
                Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(App.Session),
                                                                   WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                OperationReturn optReturn = XMLHelper.SeriallizeObject(testInfoTemp);
                if (!optReturn.Result)
                {
                    UMPApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    App.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                App.WriteLog("GetTestUserInfo", webReturn.Data);

                if (webReturn.ListData.Count <= 0)
                {
                    _mObservableCollectionTestUser.Clear();
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    optReturn = XMLHelper.DeserializeObject <TestUserParam>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        UMPApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    var testInfo = optReturn.Data as TestUserParam;
                    if (testInfo == null)
                    {
                        UMPApp.ShowExceptionMessage("Fail. filesItem is null");
                        return;
                    }

                    _mlstTestUserParam.Add(testInfo);
                }
                SetObservableCollectionTestUser();
            }
            catch (Exception ex)
            {
                UMPApp.ShowExceptionMessage(ex.Message);
            }
        }
Example #3
0
        private void GetPaperQuesions()
        {
            try
            {
                _mlPaperQuestionParams.Clear();
                var webRequest            = new WebRequest();
                Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3603Codes.GetPaperQuestions;
                OperationReturn optReturn = XMLHelper.SeriallizeObject(_mPaperParam);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("{0}: {1}",
                                                CurrentApp.GetLanguageInfo("3603T00053", "Paper Search failed"), webReturn.Message));
                    return;
                }

                if (webReturn.ListData.Count <= 0)
                {
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    optReturn = new OperationReturn();
                    optReturn = XMLHelper.DeserializeObject <CPaperQuestionParam>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    var cEditPaper = optReturn.Data as CPaperQuestionParam;
                    if (cEditPaper == null)
                    {
                        ShowException(string.Format("Fail. filesItem is null"));
                        return;
                    }

                    _mlPaperQuestionParams.Add(cEditPaper);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        private bool GetPaperInfo(string strSql, out CPaperParam paperParam)
        {
            paperParam = new CPaperParam();
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = UMPApp.Session;
                webRequest.Code    = (int)S3603Codes.OptSearchPapers;
                OperationReturn optReturn = XMLHelper.SeriallizeObject(strSql);
                if (!optReturn.Result)
                {
                    UMPApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return(false);
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(App.Session),
                                                                   WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    UMPApp.ShowExceptionMessage(string.Format("{0}: {1}",
                                                              UMPApp.GetLanguageInfo("3603T00065", "Search Failed"), webReturn.Message));
                    return(false);
                }

                if (webReturn.ListData.Count <= 0)
                {
                    return(true);
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    optReturn = XMLHelper.DeserializeObject <CPaperParam>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        UMPApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    var paperInfo = optReturn.Data as CPaperParam;
                    if (paperInfo == null)
                    {
                        UMPApp.ShowExceptionMessage("Fail. filesItem is null");
                        return(false);
                    }

                    paperParam = paperInfo;
                }
            }
            catch (Exception ex)
            {
                UMPApp.ShowExceptionMessage(ex.Message);
            }
            return(true);
        }
        private void GetAllTestInfos()
        {
            try
            {
                _mlstTestInformations.Clear();
                var webRequest            = new WebRequest();
                Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                webRequest.Session = UMPApp.Session;
                webRequest.Code    = (int)S3603Codes.OptGetTestInfo;

                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    UMPApp.ShowExceptionMessage(UMPApp.GetLanguageInfo("3603T00015", "Insert data failed"));
                    return;
                }

                if (webReturn.ListData.Count <= 0)
                {
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <TestInfoParam>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        UMPApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    var testInfo = optReturn.Data as TestInfoParam;
                    if (testInfo == null)
                    {
                        UMPApp.ShowExceptionMessage("Fail. filesItem is null");
                        return;
                    }

                    _mlstTestInformations.Add(testInfo);
                }
                SetObservableCollectionTestInfo();
            }
            catch (Exception ex)
            {
                UMPApp.ShowExceptionMessage(ex.Message);
            }
        }
Example #6
0
        private void GetAllPaperInfos()
        {
            try
            {
                _mListPaperInfos.Clear();
                var webRequest            = new WebRequest();
                Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3603Codes.OptGetPapers;

                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(CurrentApp.GetLanguageInfo("3603T00015", "Insert data failed"));
                    return;
                }

                if (webReturn.ListData.Count <= 0)
                {
                    return;
                }
                foreach (string strDate in webReturn.ListData)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <CPaperParam>(strDate);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    var cExamPapers = optReturn.Data as CPaperParam;
                    if (cExamPapers == null)
                    {
                        ShowException("Fail. filesItem is null");
                        return;
                    }

                    _mListPaperInfos.Add(cExamPapers);
                }
                SetObservableCollection(_mListPaperInfos);
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        private bool LoadFiles()
        {
            try
            {
                WebRequest         webRequest;
                Service36031Client client;
                WebReturn          webReturn;
                webRequest         = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3603Codes.OptLoadFile;
                OperationReturn optReturn = XMLHelper.SeriallizeObject(SetQuestionInfo.questionParam);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return(false);
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                client = new Service36031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));

                //client = new Service36031Client();
                webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(webReturn.Message);
                    return(false);
                }
                if (string.IsNullOrWhiteSpace(webReturn.Data))
                {
                    return(false);
                }
                _mLoadPath = webReturn.Data;
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
                return(false);
            }
            return(true);
        }
Example #8
0
 private long CreateTestNum()
 {
     try
     {
         if (!S3603App.GQueryModify)
         {
             //生成新的查询配置表主键
             WebRequest webRequest = new WebRequest
             {
                 Session = CurrentApp.Session,
                 Code    = (int)RequestCode.WSGetSerialID
             };
             webRequest.ListData.Add("36");
             webRequest.ListData.Add("370");//"3603"
             webRequest.ListData.Add(DateTime.Now.ToString("yyyyMMddHHmmss"));
             Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));
             //var client = new Service36031Client();
             WebReturn webReturn = client.UmpTaskOperation(webRequest);
             client.Close();
             if (!webReturn.Result)
             {
                 return(0);
             }
             string strNewResultId = webReturn.Data;
             if (string.IsNullOrEmpty(strNewResultId))
             {
                 return(0);
             }
             return(Convert.ToInt64(strNewResultId));
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
     return(0);
 }
 private bool DeleteTest(TestInfoParam testInfoParam)
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Session = UMPApp.Session;
         webRequest.Code    = (int)S3603Codes.OptDeleteTestInfo;
         Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(App.Session),
                                                            WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service36031"));
         //var client = new Service36031Client();
         OperationReturn optReturn = XMLHelper.SeriallizeObject(testInfoParam);
         if (!optReturn.Result)
         {
             UMPApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
             return(false);
         }
         webRequest.ListData.Add(optReturn.Data.ToString());
         //Service36031Client client = new Service36031Client();
         WebReturn webReturn = client.UmpTaskOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             UMPApp.ShowExceptionMessage(UMPApp.GetLanguageInfo("3603T00083", "Delete Failed"));
             return(false);
         }
         if (webReturn.Message == S3603Consts.HadUse)// 该查询条件被使用无法删除
         {
             UMPApp.ShowInfoMessage(UMPApp.GetLanguageInfo("3603T00011", "Can't Delete"));
             return(false);
         }
     }
     catch (Exception ex)
     {
         UMPApp.ShowExceptionMessage(ex.Message);
         return(false);
     }
     return(true);
 }
Example #10
0
        private bool WriteTestInfo(TestInfoParam testInformation)
        {
            string strLog;

            try
            {
                var webRequest = new WebRequest
                {
                    Session = CurrentApp.Session,
                    Code    = (int)S3603Codes.OptAddTestInfo
                };
                OperationReturn optReturn = XMLHelper.SeriallizeObject(testInformation);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return(false);
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                var client = new Service36031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                var webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3603T00006", "Create"));
                if (!webReturn.Result)
                {
                    #region 写操作日志

                    strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00006"),
                                           Utils.FormatOptLogString("3603T00091"), webReturn.Message);
                    CurrentApp.WriteOperationLog(S3603Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                    #endregion

                    CurrentApp.WriteLog(webReturn.Message);
                    ShowException(webReturn.Message);
                    return(false);
                }

                #region 写操作日志

                strLog = string.Format("{0} {1}", Utils.FormatOptLogString("3603T00006"),
                                       Utils.FormatOptLogString("3603T00092"));
                CurrentApp.WriteOperationLog(S3603Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_SUCCESS, strLog);

                #endregion

                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3603T00092", "Create Success"));
            }
            catch (Exception ex)
            {
                #region 写操作日志

                strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00006"),
                                       Utils.FormatOptLogString("3603T00091"), ex.Message);
                CurrentApp.WriteOperationLog(S3603Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                #endregion

                CurrentApp.WriteLog(ex.Message);
                ShowException(ex.Message);
                return(false);
            }
            return(true);
        }
Example #11
0
        private void PaperSearch_Click(object sender, RoutedEventArgs e)
        {
            string strLog;

            try
            {
                if (!CheckText())
                {
                    return;
                }

                string sql = SetSearchInfo();
                _mListPaperInfos.Clear();
                var webRequest            = new WebRequest();
                Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3603Codes.OptSearchPapers;
                OperationReturn optReturn = XMLHelper.SeriallizeObject(sql);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3603T00033", "Search"));
                if (!webReturn.Result)
                {
                    #region 写操作日志
                    strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00033"),
                                           Utils.FormatOptLogString("3603T00089"), webReturn.Message);
                    CurrentApp.WriteOperationLog(S3603Consts.OPT_Search.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);
                    #endregion
                    CurrentApp.WriteLog(webReturn.Message);

                    ShowException(CurrentApp.GetLanguageInfo("3603T00065", "Insert data failed"));
                    return;
                }
                #region 写操作日志
                strLog = string.Format("{0} {1} ", Utils.FormatOptLogString("3603T00033"),
                                       Utils.FormatOptLogString("3603T00090"));
                CurrentApp.WriteOperationLog(S3603Consts.OPT_Search.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);
                #endregion
                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3603T00090", "Search Success"));

                if (webReturn.ListData.Count <= 0)
                {
                    ShowException(CurrentApp.GetLanguageInfo("3603T00077", "Did not find the information!"));
                    return;
                }
                foreach (string strDate in webReturn.ListData)
                {
                    optReturn = XMLHelper.DeserializeObject <CPaperParam>(strDate);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    var cExamPapers = optReturn.Data as CPaperParam;
                    if (cExamPapers == null)
                    {
                        ShowException("Fail. filesItem is null");
                        return;
                    }

                    _mListPaperInfos.Add(cExamPapers);
                }
                SetObservableCollection(_mListPaperInfos);
            }
            catch (Exception ex)
            {
                #region 写操作日志
                strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00033"),
                                       Utils.FormatOptLogString("3603T00089"), ex.Message);
                CurrentApp.WriteOperationLog(S3603Consts.OPT_Search.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);
                #endregion
                CurrentApp.WriteLog(ex.Message);
                ShowException(ex.Message);
            }
        }
Example #12
0
        private void SetTestUser(List <string> listObjectState)
        {
            string strLog;

            try
            {
                List <TestUserParam> lstTestUserParams = new List <TestUserParam>();
                foreach (var objectState in listObjectState)
                {
                    string[] strTemp = objectState.Split(new[] { ConstValue.SPLITER_CHAR },
                                                         StringSplitOptions.RemoveEmptyEntries);
                    TestUserParam testUserParam = new TestUserParam
                    {
                        LongTestNum     = MTestInfoParam.LongTestNum,
                        LongTestUserNum = Convert.ToInt64(strTemp[0]),
                        StrTestUserName = strTemp[3],
                        LongPaperNum    = MTestInfoParam.LongPaperNum,
                        StrPaperName    = MTestInfoParam.StrPaperName,
                        StrTestStatue   = "N",
                        IntEable        = Convert.ToInt16(strTemp[1])
                    };
                    lstTestUserParams.Add(testUserParam);
                }
                WebRequest webRequest = new WebRequest
                {
                    Session = CurrentApp.Session,
                    Code    = (int)S3603Codes.OptSetTestUserT36036
                };
                Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                OperationReturn optReturn = XMLHelper.SeriallizeObject(lstTestUserParams);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3603T00007", "Set User"));
                if (!webReturn.Result)
                {
                    #region 写操作日志

                    strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00007"),
                                           Utils.FormatOptLogString("3603T00097"), webReturn.Message);
                    CurrentApp.WriteOperationLog(S3603Consts.OPT_SetUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                    #endregion

                    CurrentApp.WriteLog(webReturn.Message);
                    ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                #region 写操作日志

                strLog = string.Format("{0} {1}", Utils.FormatOptLogString("3603T00007"),
                                       Utils.FormatOptLogString("3603T00096"));
                CurrentApp.WriteOperationLog(S3603Consts.OPT_SetUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                #endregion
                CurrentApp.WriteLog("SetTestUser", webReturn.Data);
            }
            catch (Exception ex)
            {
                #region 写操作日志

                strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00007"),
                                       Utils.FormatOptLogString("3603T00097"), ex.Message);
                CurrentApp.WriteOperationLog(S3603Consts.OPT_SetUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                #endregion

                CurrentApp.WriteLog(ex.Message);
                ShowException(ex.Message);
            }
        }
Example #13
0
        private void SetTestUser()
        {
            if (MTestInfoParam == null)
            {
                return;
            }
            List <string> listObjectState = new List <string>();

            SetTestUser(MRootItem, ref listObjectState);

            if (listObjectState.Count > 0)
            {
                if (PageParent != null)
                {
                    PageParent.SetBusy(true, CurrentApp.GetMessageLanguageInfo("001", "Ready"));
                }
                _mWorker         = new BackgroundWorker();
                _mWorker.DoWork += (s, de) =>
                {
                    string strLog;
                    try
                    {
                        int        count      = listObjectState.Count;
                        WebRequest webRequest = new WebRequest
                        {
                            Session = CurrentApp.Session,
                            Code    = (int)S3603Codes.OptSetTestUserT11201
                        };
                        webRequest.ListData.Add(MTestInfoParam.LongTestNum.ToString());
                        webRequest.ListData.Add(count.ToString());
                        for (int i = 0; i < count; i++)
                        {
                            webRequest.ListData.Add(listObjectState[i]);
                        }
                        Service36031Client client = new Service36031Client(
                            WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));

                        //var client = new Service36031Client();
                        WebReturn webReturn = client.UmpTaskOperation(webRequest);
                        client.Close();
                        CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3603T00007", "Set User"));
                        if (!webReturn.Result)
                        {
                            #region 写操作日志

                            strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00007"),
                                                   Utils.FormatOptLogString("3603T00097"), webReturn.Message);
                            CurrentApp.WriteOperationLog(S3603Consts.OPT_SetUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                            #endregion

                            CurrentApp.WriteLog(webReturn.Message);
                            ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                            return;
                        }
                        CurrentApp.WriteLog("SetTestUser", webReturn.Data);
                        SetTestUser(listObjectState);

                        #region 写操作日志

                        strLog = string.Format("{0} {1}", Utils.FormatOptLogString("3603T00007"),
                                               Utils.FormatOptLogString("3603T00096"));
                        CurrentApp.WriteOperationLog(S3603Consts.OPT_SetUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                        #endregion

                        ShowInformation(CurrentApp.GetLanguageInfo("3603T00076", "Set Test user end"));
                    }
                    catch (Exception ex)
                    {
                        #region 写操作日志

                        strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00007"),
                                               Utils.FormatOptLogString("3603T00097"), ex.Message);
                        CurrentApp.WriteOperationLog(S3603Consts.OPT_SetUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                        #endregion

                        CurrentApp.WriteLog(ex.Message);
                        ShowException(ex.Message);
                    }
                };
                _mWorker.RunWorkerCompleted += (s, re) =>
                {
                    _mWorker.Dispose();
                    if (PageParent != null)
                    {
                        PageParent.SetBusy(false, CurrentApp.GetMessageLanguageInfo("001", "Ready"));
                    }
                    var parent = Parent as PopupPanel;
                    if (parent != null)
                    {
                        if (PageParent != null)
                        {
                            PageParent.RefreshTestUserInfo();
                        }
                        parent.IsOpen = false;
                    }
                };
                _mWorker.RunWorkerAsync();
            }
        }
Example #14
0
        private void LoadTestUser()
        {
            string strLog;

            try
            {
                if (MTestInfoParam == null)
                {
                    return;
                }
                string     testNum    = MTestInfoParam.LongTestNum.ToString();
                WebRequest webRequest = new WebRequest
                {
                    Code    = (int)S3603Codes.OptGetTestUserList,
                    Session = CurrentApp.Session
                };
                webRequest.ListData.Add(testNum);
                Service36031Client client = new Service36031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36031"));
                //var client = new Service36031Client();
                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3603T00093", "Load User"));
                if (!webReturn.Result)
                {
                    #region 写操作日志

                    strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00093"),
                                           Utils.FormatOptLogString("3603T00095"), webReturn.Message);
                    CurrentApp.WriteOperationLog(S3603Consts.OPT_LoadUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                    #endregion

                    CurrentApp.WriteLog(webReturn.Message);

                    ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                if (webReturn.ListData == null)
                {
                    ShowException("WebReturn ListData is null");
                    return;
                }

                #region 写操作日志

                strLog = string.Format("{0} {1} ", Utils.FormatOptLogString("3603T00093"),
                                       Utils.FormatOptLogString("3603T00094"));
                CurrentApp.WriteOperationLog(S3603Consts.OPT_LoadUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                #endregion

                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3603T00094", "Load User Success"));

                foreach (string strData in webReturn.ListData)
                {
                    _mListTestUsers.Add(strData);
                }
            }
            catch (Exception ex)
            {
                #region 写操作日志

                strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3603T00093"),
                                       Utils.FormatOptLogString("3603T00095"), ex.Message);
                CurrentApp.WriteOperationLog(S3603Consts.OPT_LoadUser.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                #endregion

                CurrentApp.WriteLog(ex.Message);
                ShowException(ex.Message);
            }
        }