Esempio n. 1
0
        public NewMainCategory()
        {
            _mPapersCategoryParam = new PapersCategoryParam();
            _mCategoryTree        = S3601App.GCategoryTreeNode;
            InitializeComponent();
            RbutOneCategroyName.IsChecked = true;
            if (S3601App.GMessageSource == S3601Codes.MessageUpdateCategory)
            {
                RbutMoreCategroyName.IsEnabled = false;
                TxtOneCategroyName.Text        = _mCategoryTree.StrName;
            }

            this.Loaded += UCCustomSetting_Loaded;
        }
Esempio n. 2
0
        public void SearchCategoryTreeInfo(string strSql)
        {
            try
            {
                _mlstSearchCategoryNode = new List <CCategoryTree>();
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3601Codes.OperationGetQuestionCategory;
                Service36011Client client = new Service36011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011"));
                //var client = new Service36011Client();
                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);
            }
        }
Esempio n. 3
0
        private bool UpdateCateGory()
        {
            if (!string.IsNullOrWhiteSpace(TxtOneCategroyName.Text))
            {
                if (string.Equals(TxtOneCategroyName.Text, _mCategoryTree.StrParentNodeName))
                {
                    ShowInformation(CurrentApp.GetLanguageInfo("3601T00128",
                                                               "Subfolder name can not be the same as the parent"));
                    return(false);
                }
                foreach (var categoryTree in _mCategoryTree.LstChildInfos)
                {
                    if (string.Equals(TxtOneCategroyName.Text, categoryTree.StrName))
                    {
                        ShowInformation(CurrentApp.GetLanguageInfo("3601T00128",
                                                                   "Subfolder name can not be the same as the parent"));
                        return(false);
                    }
                }
                foreach (var categoryTree in _mCategoryTree.LstNodeInfos)
                {
                    if (string.Equals(TxtOneCategroyName.Text, categoryTree.StrName))
                    {
                        ShowInformation(CurrentApp.GetLanguageInfo("3601T00158",
                                                                   "Subfolder name can not be the same as the parent"));
                        return(false);
                    }
                }
            }
            else
            {
                ShowInformation(CurrentApp.GetLanguageInfo("3601T00129", "Please Input CategroyName"));
                return(false);
            }

            _mPapersCategoryParam         = new PapersCategoryParam();
            _mPapersCategoryParam.LongNum = _mCategoryTree.LongNum;
            _mCategoryTree.StrName        = TxtOneCategroyName.Text;
            _mPapersCategoryParam.StrName = TxtOneCategroyName.Text;

            WebRequest         webRequest;
            Service36011Client client;
            WebReturn          webReturn;

            webRequest         = new WebRequest();
            webRequest.Session = CurrentApp.Session;
            webRequest.Code    = (int)S3601Codes.OperationUpdateCategory;
            OperationReturn optReturn = XMLHelper.SeriallizeObject(_mPapersCategoryParam);

            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 Service36011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011"));
            //client = new Service36011Client();
            webReturn = client.UmpTaskOperation(webRequest);
            client.Close();
            string strLog;

            if (!webReturn.Result)
            {
                #region 写操作日志
                strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3601T00153"), Utils.FormatOptLogString("3601T00186"), webReturn.Message);
                CurrentApp.WriteOperationLog(S3601Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);
                #endregion
                ShowException(string.Format("{0}: {1}",
                                            CurrentApp.GetLanguageInfo("3601T00015", "Insert data failed"), webReturn.Message));
                return(false);
            }
            #region 写操作日志
            strLog = string.Format("{0}", Utils.FormatOptLogString("3601T00153"));
            CurrentApp.WriteOperationLog(S3601Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_SUCCESS, strLog);
            #endregion
            CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3601T00153", "Change Category!"));
            CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3601T00187", "Change Success!"));

            ParentPage.RefreshTree(_mCategoryTree);
            return(true);
        }