コード例 #1
0
        private void GetPaperQuesions()
        {
            try
            {
                _mlPaperQuestionParams.Clear();
                var webRequest            = new WebRequest();
                Service36021Client client = new Service36021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36021"));
                //var client = new Service36021Client();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3602Codes.OptGetPaperQuestions;
                OperationReturn optReturn = XMLHelper.SeriallizeObject(_mPaperInfo.PaperParam);
                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("3602T00076", "Insert data 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);
            }
        }
コード例 #2
0
 private bool LoadFiles()
 {
     try
     {
         WebRequest         webRequest;
         Service36021Client client;
         WebReturn          webReturn;
         webRequest         = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = (int)S3602Codes.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 Service36021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                         WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36021"));
         //client = new Service36021Client();
         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);
 }
コード例 #3
0
ファイル: AddPaperPage.xaml.cs プロジェクト: chenmj201601/UMP
 private long GetPaperNum()
 {
     try
     {
         if (!S3602App.GQueryModify)
         {
             //生成新的查询配置表主键
             WebRequest webRequest = new WebRequest
             {
                 Session = CurrentApp.Session,
                 Code    = (int)RequestCode.WSGetSerialID
             };
             //Service36021Client client = new Service36021Client();
             webRequest.ListData.Add("36");
             webRequest.ListData.Add("3602");
             webRequest.ListData.Add(DateTime.Now.ToString("yyyyMMddHHmmss"));
             Service36021Client client = new Service36021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36021"));
             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);
 }
コード例 #4
0
ファイル: AddPaperPage.xaml.cs プロジェクト: chenmj201601/UMP
 private bool EnablePaperName()
 {
     try
     {
         var webRequest = new WebRequest
         {
             Session = CurrentApp.Session,
             Code    = (int)S3602Codes.OptPaperSameName
         };
         OperationReturn optReturn = XMLHelper.SeriallizeObject(_mCAddPaper);
         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 Service36021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36021"));
         //client = new Service36021Client();
         var webReturn = client.UmpTaskOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("{0}{1}", CurrentApp.GetLanguageInfo("3602T00076", "Failed to query the database!"), webReturn.Message));
             return(false);
         }
         if (webReturn.Message == S3602Consts.PaperExist)
         {
             ShowInformation(CurrentApp.GetLanguageInfo("3602T00075", "Paper already exist"));
             return(false);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
         return(false);
     }
     return(true);
 }
コード例 #5
0
ファイル: AddPaperPage.xaml.cs プロジェクト: chenmj201601/UMP
        private bool UpdatePaperInfo()
        {
            string strLog;

            try
            {
                var webRequest = new WebRequest
                {
                    Session = CurrentApp.Session,
                    Code    = (int)S3602Codes.OptUpdatePaper
                };
                OperationReturn optReturn = XMLHelper.SeriallizeObject(_mCAddPaper);
                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 Service36021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36021"));
                //client = new Service36021Client();
                var webReturn = client.UmpTaskOperation(webRequest);
                client.Close();

                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3602T00008", "Change"));
                if (!webReturn.Result)
                {
                    #region 写操作日志

                    strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3602T00008"),
                                           Utils.FormatOptLogString("3602T00161"), webReturn.Message);
                    CurrentApp.WriteOperationLog(S3602Consts.OPT_Change.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                    #endregion

                    CurrentApp.WriteLog(webReturn.Message);
                    ShowException(string.Format("{0}: {1}",
                                                CurrentApp.GetLanguageInfo("3602T00076", "Insert data failed"),
                                                webReturn.Message));
                    return(false);
                }
                #region 写操作日志

                strLog = string.Format("{0} {1}", Utils.FormatOptLogString("3602T00008"),
                                       Utils.FormatOptLogString("3602T00162"));
                CurrentApp.WriteOperationLog(S3602Consts.OPT_Change.ToString(), ConstValue.OPT_RESULT_SUCCESS, strLog);
                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3602T00162", "Change Success"));
                #endregion
            }
            catch (Exception ex)
            {
                #region 写操作日志

                strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3602T00008"),
                                       Utils.FormatOptLogString("3602T00161"), ex.Message);
                CurrentApp.WriteOperationLog(S3602Consts.OPT_Change.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                #endregion

                CurrentApp.WriteLog(ex.Message);
                ShowException(ex.Message);
                return(false);
            }
            return(true);
        }
コード例 #6
0
        public void SearchCategoryTreeInfo(string strSql)
        {
            try
            {
                _mlstSearchCategoryNode = new List <CCategoryTree>();
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3602Codes.OptGetQuestionCategory;
                Service36021Client client = new Service36021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36021"));
                //var client = new Service36021Client();
                OperationReturn optReturn = XMLHelper.SeriallizeObject(strSql);
                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)
                {
                    return;
                }

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

                    CCategoryTree tempTree = new CCategoryTree();
                    tempTree.LongNum           = param.LongNum;
                    tempTree.StrName           = param.StrName;
                    tempTree.LongParentNodeId  = param.LongParentNodeId;
                    tempTree.StrParentNodeName = param.StrParentNodeName;
                    tempTree.LongFounderId     = param.LongFounderId;
                    tempTree.StrFounderName    = param.StrFounderName;
                    tempTree.StrDateTime       = param.StrDateTime;
                    _mlstSearchCategoryNode.Add(tempTree);
                }

                _mlstCategoryNum = new List <long>();
                foreach (var categoryTree in _mlstSearchCategoryNode)
                {
                    GetCategoryNum(categoryTree.LongNum);
                }

                var distinctNames = _mlstCategoryNum.Distinct();
                _mlstCategoryNum = new List <long>(distinctNames.ToList());

                _mCategoryNode.Children.Clear();
                CategoryTree.ItemsSource = _mCategoryNode.Children;
                InitCategoryTree(_mListCategoryTreeParam, 0, _mCategoryNode);
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }