private bool DeleteDb() { WebRequest webRequest = new WebRequest(); WebReturn webReturn = new WebReturn(); try { webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3601Codes.OperationDeletePaperQuestions; OperationReturn optReturn = XMLHelper.SeriallizeObject(_mlPaperQuestionParam); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return(false); } webRequest.ListData.Add(optReturn.Data.ToString()); Service36011Client client = new Service36011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //var client = new Service36011Client(); webReturn = client.UmpTaskOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(CurrentApp.GetLanguageInfo("3601T00083", "Delete Error")); return(false); } return(true); } catch (Exception ex) { ShowInformation(ex.Message); } return(false); }
private bool UpdatePaperInfo() { try { WebRequest webRequest; Service36011Client client; WebReturn webReturn; webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3601Codes.OperationUpdatePaper; 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()); client = new Service36011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //client = new Service36011Client(); webReturn = client.UmpTaskOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(CurrentApp.GetLanguageInfo("3601T00015", "Insert data failed")); return(false); } } catch (Exception ex) { ShowException(ex.Message); return(false); } return(true); }
private void GetPaperInfos() { try { _mListPapersInfoCollection.Clear(); var webRequest = new WebRequest(); Service36011Client client = new Service36011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //var client = new Service36011Client(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3601Codes.OperationSearchPapers; OperationReturn optReturn = XMLHelper.SeriallizeObject(_mlPaperParamsTemp); 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(CurrentApp.GetLanguageInfo("3601T00015", "Insert data failed")); return; } if (webReturn.ListData.Count <= 0) { return; } for (int i = 0; i < webReturn.ListData.Count; i++) { optReturn = new OperationReturn(); optReturn = XMLHelper.DeserializeObject <CPaperParam>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); continue; } CPaperParam cExamPapers = optReturn.Data as CPaperParam; if (cExamPapers == null) { ShowException(string.Format("Fail. filesItem is null")); return; } _mListPapersInfoCollection.Add(cExamPapers); _mlPaperParamsOld.Add(cExamPapers); } } catch (Exception ex) { ShowException(ex.Message); } }
private bool GetQuestionsOfPaper() { WebRequest webRequest = new WebRequest(); WebReturn webReturn = new WebReturn(); _mlLongs.Clear(); try { webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3601Codes.OperationGetQuestionsOfPaper; OperationReturn optReturn = XMLHelper.SeriallizeObject(_mlQuestionsParams); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return(false); } webRequest.ListData.Add(optReturn.Data.ToString()); Service36011Client client = new Service36011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //var client = new Service36011Client(); webReturn = client.UmpTaskOperation(webRequest); client.Close(); if (!webReturn.Result) { return(false); } 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; } CPaperQuestionParam paperQuestionParam = optReturn.Data as CPaperQuestionParam; if (paperQuestionParam == null) { ShowException(string.Format("Fail. filesItem is null")); return(false); } _mlLongs.Add(paperQuestionParam.LongPaperNum); } return(true); } catch (Exception ex) { ShowInformation(ex.Message); } return(true); }
private bool QuestionExist() { WebRequest webRequest = new WebRequest(); WebReturn webReturn = new WebReturn(); try { webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3601Codes.OperationPaperQuestionsExist; OperationReturn optReturn = XMLHelper.SeriallizeObject(_mlPaperQuestionParam); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return(false); } webRequest.ListData.Add(optReturn.Data.ToString()); Service36011Client client = new Service36011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //var client = new Service36011Client(); webReturn = client.UmpTaskOperation(webRequest); client.Close(); if (!webReturn.Result) { return(false); } for (int i = 0; i < webReturn.ListData.Count; i++) { optReturn = new OperationReturn(); optReturn = XMLHelper.DeserializeObject <long>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); continue; } long questionNum = optReturn.Data is long?(long)optReturn.Data : 0; if (questionNum > 0) { ShowException(string.Format("{0}", CurrentApp.GetLanguageInfo("3601T00067", "Question exist!"))); return(false); } } return(true); } catch (Exception ex) { ShowInformation(ex.Message); } return(true); }
private bool LoadFiles() { try { WebRequest webRequest; Service36011Client client; WebReturn webReturn; webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3601Codes.OperationLoadFile; 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 Service36011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //client = new Service36011Client(); 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); }
private bool EnablePaperName() { try { WebRequest webRequest; Service36011Client client; WebReturn webReturn; webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3601Codes.OperationPaperSameName; 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()); client = new Service36011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //client = new Service36011Client(); webReturn = client.UmpTaskOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(CurrentApp.GetLanguageInfo("3601T00076", "Failed to query the database!")); return(false); } if (webReturn.Message == S3601Consts.PaperExist) { ShowInformation(CurrentApp.GetLanguageInfo("3601T00075", "Paper already exist")); return(false); } } catch (Exception ex) { ShowException(ex.Message); return(false); } return(true); }
private long GetPaperNum() { try { if (!S3601App.GQueryModify) { //生成新的查询配置表主键 WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)RequestCode.WSGetSerialID; webRequest.ListData.Add("36"); webRequest.ListData.Add("369");//"3601" webRequest.ListData.Add(DateTime.Now.ToString("yyyyMMddHHmmss")); Service36011Client client = new Service36011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //var client = new Service36011Client(); 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); }
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); } }
private bool CreateCategory() { WebRequest webRequest; Service36011Client client; WebReturn webReturn; string[] strCategroy = new string[10]; long[] strResultId = new long[10]; CCategoryTree cCategoryTree = new CCategoryTree(); if (RbutOneCategroyName.IsChecked == true) { if (!string.IsNullOrWhiteSpace(TxtOneCategroyName.Text)) { strCategroy[0] = TxtOneCategroyName.Text; if (strCategroy[0] == S3601App.GCategoryTree.StrName) { 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("3601T00157", "Category has been created!")); return(false); } } } else { ShowInformation(CurrentApp.GetLanguageInfo("3601T00129", "Please Input CategroyName")); return(false); } } else { if (!string.IsNullOrWhiteSpace(TxtMoreCategroyName.Text)) { strCategroy = TxtMoreCategroyName.Text.Split(new char[] { '\\' }); if (strCategroy[0] == S3601App.GCategoryTree.StrName) { 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(strCategroy[0], categoryTree.StrName)) { ShowInformation(CurrentApp.GetLanguageInfo("3601T00157", "Category has been created!")); return(false); } } for (int i = 0; i < strCategroy.Length - 1; i++) { if (strCategroy[i] == strCategroy[i + 1]) { ShowInformation(CurrentApp.GetLanguageInfo("3601T00128", "Subfolder name can not be the same as the parent")); return(false); } if (i + 2 > 10) { ShowInformation(CurrentApp.GetLanguageInfo("3601T00130", "Create cannot exceed 10 more category")); return(false); } } } else { ShowInformation(CurrentApp.GetLanguageInfo("3601T00129", "Please Input CategroyName")); return(false); } } for (int i = 0; i < strCategroy.Length; i++) { if (!S3601App.GQueryModify) { if (string.IsNullOrEmpty(strCategroy[i])) { break; } //生成新的查询配置表主键 webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)RequestCode.WSGetSerialID; webRequest.ListData.Add("36"); webRequest.ListData.Add("364");//"3601" webRequest.ListData.Add(DateTime.Now.ToString("yyyyMMddHHmmss")); client = new Service36011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); //client = new Service36011Client(); webReturn = client.UmpTaskOperation(webRequest); client.Close(); if (!webReturn.Result) { return(false); } string strNewResultId = webReturn.Data; if (string.IsNullOrEmpty(strNewResultId)) { return(false); } strResultId[i] = Convert.ToInt64(strNewResultId); } } for (int i = 0; i < strCategroy.Length; i++) { if (string.IsNullOrEmpty(strCategroy[i])) { break; } if (i == 0) { _mPapersCategoryParam.LongParentNodeId = S3601App.GCategoryTree.LongNum; _mPapersCategoryParam.StrParentNodeName = S3601App.GCategoryTree.StrName; cCategoryTree.LongParentNodeId = S3601App.GCategoryTree.LongNum; } else { _mPapersCategoryParam.LongParentNodeId = strResultId[i - 1]; _mPapersCategoryParam.StrParentNodeName = strCategroy[i - 1]; cCategoryTree.LongParentNodeId = strResultId[i - 1]; } _mPapersCategoryParam.StrName = strCategroy[i]; _mPapersCategoryParam.LongNum = strResultId[i]; _mPapersCategoryParam.StrDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); cCategoryTree.LongNum = strResultId[i]; webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3601Codes.OperationCreateCategory; 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("3601T00013"), Utils.FormatOptLogString("3601T00184"), webReturn.Message); CurrentApp.WriteOperationLog(S3601Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_FAIL, strLog); #endregion ShowException(CurrentApp.GetLanguageInfo("3601T00015", "Insert data failed")); return(false); } #region 写操作日志 strLog = string.Format("{0}", Utils.FormatOptLogString("3601T00013")); CurrentApp.WriteOperationLog(S3601Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_SUCCESS, strLog); #endregion CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3601T00013", "Add Category!")); CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3601T00185", "Add Success!")); } ParentPage.RefreshTree(cCategoryTree); return(true); }
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); }