private void OrgContentsTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { try { ContentsTree nodeInfo = ContentsCheckableTree.SelectedItem as ContentsTree; if (nodeInfo == null) { return; } _mContentsNodeTemp = nodeInfo; SetTreeBrush(nodeInfo); ButContents.Children.Clear(); ButDelete.Children.Clear(); ButMaterial.Children.Clear(); var btn = new Button(); btn.Click += CreateContents_Click; var opt = new OperationInfo(); opt.Display = CurrentApp.GetLanguageInfo("3604T00003", "Create Contents"); opt.Icon = "Images/add.png"; btn.DataContext = opt; btn.SetResourceReference(StyleProperty, "OptButtonStyle"); ButContents.Children.Add(btn); btn = new Button(); btn.Click += ChangeContents_Click; opt = new OperationInfo(); opt.Display = CurrentApp.GetLanguageInfo("3604T00010", "Change Contents"); opt.Icon = "Images/change.png"; btn.DataContext = opt; btn.SetResourceReference(StyleProperty, "OptButtonStyle"); ButContents.Children.Add(btn); if (nodeInfo.LongParentNodeId != 0) { btn = new Button(); btn.Click += DeleteContents_Click; opt = new OperationInfo(); opt.Display = CurrentApp.GetLanguageInfo("3604T00011", "Delete Contents"); opt.Icon = "Images/Delete.png"; btn.DataContext = opt; btn.SetResourceReference(StyleProperty, "OptButtonStyle"); ButDelete.Children.Add(btn); } btn = new Button(); btn.Click += UploadResources_Click; opt = new OperationInfo(); opt.Display = CurrentApp.GetLanguageInfo("3604T00034", "Upload Resources"); opt.Icon = "Images/Upload.png"; btn.DataContext = opt; btn.SetResourceReference(StyleProperty, "OptButtonStyle"); ButMaterial.Children.Add(btn); } catch (Exception ex) { ShowException(ex.Message); } }
public ContentsProperties() { _mContentsTree = new ContentsTree(); _mContentsTree = S3604App.GContentsTree; _mOptContentsInfo = S3604App.GiOptContentsInfo; _mContentsParam = new ContentsParam(); InitializeComponent(); Loaded += UCCustomSetting_Loaded; }
private void SetTreeBrush(ContentsTree nodeInfo) { foreach (ContentsTree param in _mLstContentsTreeNodes) { if (nodeInfo.LongNodeId == param.LongNodeId) { param.ChangeBrush = null; } } }
public MaterialLibraryView() { _mLstSearchContentsNode = new List <ContentsTree>(); _mLstContentsTreeNodes = new List <ContentsTree>(); _mListPanels = new List <PanelItem>(); _mLstContentsTreeParam = new List <ContentsTree>(); _mContentsRootNode = new ContentsTree(); _mLstContentsNum = new List <long>(); _mContentsNodeTemp = new ContentsTree(); _mlstUploadFiles = new List <FileProperty>(); InitializeComponent(); }
public ContentsTree GetContentsNodeInfo(ContentsTree parentInfo, ContentsTree param) { ContentsTree temp = new ContentsTree(); try { temp.Icon = "/UMPS3604;component/Themes/Default/UMPS3604/Images/document.ico"; temp.LongNodeId = param.LongNodeId; temp.StrNodeName = param.LongParentNodeId == 0 ? CurrentApp.GetLanguageInfo("3604T00009", "Contents") : param.StrNodeName; temp.LongParentNodeId = param.LongParentNodeId; if (_mLstContentsNum.Count <= 0) { if (param.LongParentNodeId == 0) { temp.IsExpanded = true; } } else { int iCount = 0; foreach (var num in _mLstContentsNum) { iCount++; if (param.LongNodeId == num) { temp.IsExpanded = true; if (iCount == _mLstContentsNum.Count) { temp.IsChecked = true; } } } foreach (var contentsTree in _mLstSearchContentsNode) { if (param.LongNodeId == contentsTree.LongNodeId) { temp.ChangeBrush = Brushes.Gold; } } } temp.StrParentNodeName = param.StrParentNodeName; temp.LongFounderId = param.LongFounderId; temp.StrFounderName = param.StrFounderName; temp.StrDateTime = param.StrDateTime; _mLstContentsTreeNodes.Add(temp); AddChildNode(parentInfo, temp); } catch (Exception ex) { ShowException(ex.Message); } return(temp); }
public void RefreshTree(ContentsTree contentsTree) { var temp = _mLstContentsTreeParam.FirstOrDefault(p => p.LongNodeId == contentsTree.LongNodeId); _mLstContentsTreeParam.Remove(temp); _mLstContentsTreeParam.Add(contentsTree); _mLstContentsNum = new List <long>(); GetCategoryNum(contentsTree.LongNodeId); _mLstSearchContentsNode.Clear(); _mContentsRootNode.Children.Clear(); _mLstContentsTreeNodes.Clear(); InitContentsTree(_mLstContentsTreeParam, 0, _mContentsRootNode); }
private List <ContentsTree> GetAllNodeInfo(ContentsTree categoryTreeNode) { List <ContentsTree> lstContentsTreeNode = new List <ContentsTree>(); if (_mLstContentsTreeParam.Count <= 0) { return(null); } foreach (var categoryTree in _mLstContentsTreeParam) { if (categoryTreeNode.LongParentNodeId == categoryTree.LongParentNodeId) { lstContentsTreeNode.Add(categoryTree); } } return(lstContentsTreeNode); }
private void UploadResources_Click(object sender, RoutedEventArgs e) { try { ContentsTree contentsTree = ContentsCheckableTree.SelectedItem as ContentsTree; if (contentsTree == null) { return; } _mlstUploadFiles.Clear(); OpenFileDialog openFileDialog = new OpenFileDialog(); //允许多选 openFileDialog.Multiselect = true; openFileDialog.RestoreDirectory = true; openFileDialog.FilterIndex = 1; openFileDialog.Title = CurrentApp.GetLanguageInfo("3604T00035", "Upload Resource"); if (openFileDialog.ShowDialog() == DialogResult.OK) { foreach (string filePath in openFileDialog.FileNames) { System.IO.FileInfo file = new System.IO.FileInfo(filePath); FileProperty fileProperty = new FileProperty(); fileProperty.LSize = (file.Length) / 1024 + 1; fileProperty.StrName = file.Name; fileProperty.StrPath = file.DirectoryName; fileProperty.StrFileType = file.Extension; _mlstUploadFiles.Add(fileProperty); } UploadResourceFilesPage newPage = new UploadResourceFilesPage(); newPage.ParentPage = this; newPage.MLstFileProperties = _mlstUploadFiles; newPage.CurrentApp = CurrentApp; PopupPanelInfo.Content = newPage; PopupPanelInfo.Title = CurrentApp.GetLanguageInfo("3604T00036", "Upload Resource"); PopupPanelInfo.IsOpen = true; } } catch (Exception ex) { ShowException(ex.Message); } }
private void CreateContents_Click(object sender, RoutedEventArgs e) { var btn = e.Source as Button; if (btn != null) { try { ContentsTree nodeInfo = ContentsCheckableTree.SelectedItem as ContentsTree; if (nodeInfo == null) { return; } _mContentsNodeTemp = nodeInfo; S3604App.GiOptContentsInfo = (int)S3604Consts.OPT_Add; List <ContentsTree> lstCategoryTreeChild = GetAllChildInfo(_mContentsNodeTemp); if (lstCategoryTreeChild == null) { return; } _mContentsNodeTemp.LstChildInfos = lstCategoryTreeChild; S3604App.GContentsTree = _mContentsNodeTemp; S3604App.GQueryModify = false; ContentsProperties newPage = new ContentsProperties { ParentPage = this, CurrentApp = CurrentApp }; PopupPanelInfo.Content = newPage; PopupPanelInfo.Title = CurrentApp.GetLanguageInfo("3604T00003", "Create Contents"); PopupPanelInfo.IsOpen = true; } catch (Exception ex) { ShowException(ex.Message); } } }
private bool CreateContents() { WebRequest webRequest; Service36041Client client; WebReturn webReturn; string[] strContents = new string[10]; long[] strResultId = new long[10]; var lstContentsTree = new List <ContentsTree>(); if (RbutOneContentsName.IsChecked == true) { if (!string.IsNullOrWhiteSpace(TxtOneContentsName.Text)) { strContents[0] = TxtOneContentsName.Text; if (strContents[0] == _mContentsTree.StrNodeName) { ShowInformation(CurrentApp.GetLanguageInfo("3604T00019", "Subfolder name can not be the same as the parent")); return(false); } foreach (var param in _mContentsTree.LstChildInfos) { if (string.Equals(TxtOneContentsName.Text, param.StrNodeName)) { ShowInformation(CurrentApp.GetLanguageInfo("3604T00020", "Contents has been created!")); return(false); } } } else { ShowInformation(CurrentApp.GetLanguageInfo("3604T00021", "Please Input ContentsName")); return(false); } } else { if (!string.IsNullOrWhiteSpace(TxtMoreContentsName.Text)) { strContents = TxtMoreContentsName.Text.Split(new char[] { '\\' }); if (strContents[0] == S3604App.GContentsTree.StrNodeName) { ShowInformation(CurrentApp.GetLanguageInfo("3604T00019", "Subfolder name can not be the same as the parent")); return(false); } for (int i = 0; i < strContents.Length - 1; i++) { if (strContents[i] == strContents[i + 1]) { ShowInformation(CurrentApp.GetLanguageInfo("3604T00019", "Subfolder name can not be the same as the parent")); return(false); } if (i + 2 > 10) { ShowInformation(CurrentApp.GetLanguageInfo("3604T00022", "Create cannot exceed 10 more Contents")); return(false); } } } else { ShowInformation(CurrentApp.GetLanguageInfo("3604T00021", "Please Input ContentsName")); return(false); } } for (int i = 0; i < strContents.Length; i++) { if (!S3604App.GQueryModify) { //生成新的查询配置表主键 webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)RequestCode.WSGetSerialID; webRequest.ListData.Add("36"); webRequest.ListData.Add("3604"); webRequest.ListData.Add(DateTime.Now.ToString("yyyyMMddHHmmss")); // client = new Service36041Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), // WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36041")); client = new Service36041Client(); 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 < strContents.Length; i++) { var contentsTree = new ContentsTree(); if (string.IsNullOrEmpty(strContents[i])) { break; } if (i == 0) { _mContentsParam.LongParentNodeId = _mContentsTree.LongNodeId; _mContentsParam.StrParentNodeName = _mContentsTree.StrNodeName; contentsTree.LongParentNodeId = _mContentsTree.LongNodeId; } else { _mContentsParam.LongParentNodeId = strResultId[i - 1]; _mContentsParam.StrParentNodeName = strContents[i - 1]; contentsTree.LongParentNodeId = strResultId[i - 1]; } _mContentsParam.StrNodeName = strContents[i]; _mContentsParam.LongNodeId = strResultId[i]; _mContentsParam.StrDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); contentsTree.LongNodeId = strResultId[i]; contentsTree.StrNodeName = strContents[i]; webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3604Codes.OptCreateContents; OperationReturn optReturn = XMLHelper.SeriallizeObject(_mContentsParam); 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 Service36041Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), // WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36041")); client = new Service36041Client(); webReturn = client.UmpTaskOperation(webRequest); client.Close(); string strLog; if (!webReturn.Result) { #region 写操作日志 strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("3604T00003"), Utils.FormatOptLogString("3604T00026"), webReturn.Message); CurrentApp.WriteOperationLog(S3604Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_FAIL, strLog); #endregion ShowException(string.Format("{0} : {1}", CurrentApp.GetLanguageInfo("3604T00026", "Insert data failed"), webReturn.Message)); return(false); } #region 写操作日志 strLog = string.Format("{0}", Utils.FormatOptLogString("3604T00003")); CurrentApp.WriteOperationLog(S3604Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_SUCCESS, strLog); #endregion CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3604T00003", "Add Contents!")); CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3604T00027", "Add Success!")); lstContentsTree.Add(contentsTree); } ParentPage.RefreshTree(lstContentsTree); return(true); }
private List <ContentsTree> GetAllChildInfo(ContentsTree contentsTreeNode) { return(_mLstContentsTreeParam.Count <= 0 ? null : _mLstContentsTreeParam.Where(param => param.LongParentNodeId == contentsTreeNode.LongNodeId).ToList()); }
private void AddChildNode(ContentsTree parentItem, ContentsTree item) { Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); }
public void InitContentsTree(List <ContentsTree> listPapersContentsParam, long longParentNodeId, ContentsTree contentsNodes) { foreach (ContentsTree param in listPapersContentsParam) { if (param.LongParentNodeId == longParentNodeId) { var nodeTemp = GetContentsNodeInfo(contentsNodes, param); InitContentsTree(listPapersContentsParam, param.LongNodeId, nodeTemp); } } }
public void InitContentsTreeInfo(string strSql) { try { _mLstContentsTreeParam.Clear(); WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3604Codes.OptGetContents; //Service36041Client client = new Service36041Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), // WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36041")); var client = new Service36041Client(); 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) { ShowException(webReturn.Message); return; } for (int i = 0; i < webReturn.ListData.Count; i++) { optReturn = XMLHelper.DeserializeObject <ContentsParam>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); continue; } ContentsParam param = optReturn.Data as ContentsParam; if (param == null) { ShowException("Fail. queryItem is null"); return; } ContentsTree tempTree = new ContentsTree(); tempTree.LongNodeId = param.LongNodeId; tempTree.StrNodeName = param.StrNodeName; tempTree.LongParentNodeId = param.LongParentNodeId; tempTree.StrParentNodeName = param.StrParentNodeName; tempTree.LongFounderId = param.LongFounderId; tempTree.StrFounderName = param.StrFounderName; tempTree.StrDateTime = param.StrDateTime; _mLstContentsTreeParam.Add(tempTree); } _mContentsRootNode.Children.Clear(); _mLstContentsTreeNodes.Clear(); ContentsCheckableTree.ItemsSource = _mContentsRootNode.Children; InitContentsTree(_mLstContentsTreeParam, 0, _mContentsRootNode); } catch (Exception ex) { ShowException(ex.Message); } }
private void DeleteContents_Click(object sender, RoutedEventArgs e) { try { string strChildNode = String.Empty; ContentsTree nodeInfo = ContentsCheckableTree.SelectedItem as ContentsTree; List <ContentsTree> lstContentsTreeChild = GetAllChildInfo(nodeInfo); if (lstContentsTreeChild.Count > 0) { strChildNode = string.Format("{0} {1}", lstContentsTreeChild.Count, CurrentApp.GetLanguageInfo("3604T00028", "Child Node Information")); } else { strChildNode = string.Format("{0}", CurrentApp.GetLanguageInfo("3604T00029", "Child Node Information")); } MessageBoxResult result = MessageBox.Show( string.Format("{0}\n{1}", CurrentApp.GetLanguageInfo("3604T00030", "Confirm whether delete categories? Delete nodes will also delete all child nodes."), strChildNode), CurrentApp.GetLanguageInfo("3604T00031", "Warning"), MessageBoxButton.OKCancel); if (result != MessageBoxResult.OK) { return; } var btn = e.Source as Button; ContentsParam contentsParam = new ContentsParam(); if (nodeInfo != null) { contentsParam.LongNodeId = nodeInfo.LongNodeId; contentsParam.StrNodeName = nodeInfo.StrNodeName; contentsParam.LongParentNodeId = nodeInfo.LongParentNodeId; contentsParam.StrParentNodeName = nodeInfo.StrParentNodeName; contentsParam.LongFounderId = nodeInfo.LongFounderId; contentsParam.StrFounderName = nodeInfo.StrFounderName; contentsParam.StrDateTime = nodeInfo.StrDateTime; } else { ShowException(CurrentApp.GetLanguageInfo("3604T00032", "The Contents information for failure!")); return; } if (btn != null) { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S3604Codes.OptDeleteContents; // Service36041Client client = new Service36041Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), // WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service36011")); // OperationReturn optReturn = XMLHelper.SeriallizeObject(contentsParam); // if (!optReturn.Result) // { // ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); // return; // } // webRequest.ListData.Add(optReturn.Data.ToString()); // var client = new Service36041Client(); // WebReturn webReturn = client.UmpTaskOperation(webRequest); // client.Close(); // CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3604T00033", "Delete")); // string strLog; // if (!webReturn.Result) // { // ShowException(CurrentApp.GetLanguageInfo("3107T00092", "Delete Failed")); // #region 写操作日志 // strLog = string.Format("{0} {1}{2}", Utils.FormatOptLogString("3601T00014"), Utils.FormatOptLogString("3601T00083"), papersCategoryParam.StrName); // CurrentApp.WriteOperationLog(S3604Consts.OPT_Delete.ToString(), ConstValue.OPT_RESULT_FAIL, strLog); // #endregion // CurrentApp.WriteLog(webReturn.Message); // return; // } // if (webReturn.Message == S3604Consts.HadUse)// 该查询条件被使用无法删除 // { // #region 写操作日志 // strLog = string.Format("{0} {1}{2}", Utils.FormatOptLogString("3601T00014"), Utils.FormatOptLogString("3601T00011"), papersCategoryParam.StrName); // CurrentApp.WriteOperationLog(S3601Consts.OPT_Delete.ToString(), ConstValue.OPT_RESULT_FAIL, strLog); // #endregion // CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3601T00011", "Can't Delete")); // ShowInformation(CurrentApp.GetLanguageInfo("3601T00011", "Can't Delete")); // } // else // { // CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("3601T00012", "Delete Sucessed")); // ShowInformation(CurrentApp.GetLanguageInfo("3601T00012", "Delete Sucessed")); // string strSql = string.Format("SELECT * FROM T_36_021_{0}", CurrentApp.Session.RentInfo.Token); // InitCategoryTreeInfo(strSql); // } } } catch (Exception ex) { ShowException(ex.Message); } }