123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- using CollaborativePlatformMain.DFEntity.MessageSubUtil;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- namespace CollaborativePlatformMain.Form.MessageSubPage.Project
- {
-
-
-
- public partial class NewProjrctPage : Page
- {
-
-
-
- public SeconProjectPage SeconProjectPage;
- public NewProjrctPage(SeconProjectPage seconProjectPage)
- {
- InitializeComponent();
- SeconProjectPage = seconProjectPage;
- }
-
-
-
-
-
- private void close_Click(object sender, RoutedEventArgs e)
- {
- gd_top.Visibility = Visibility.Collapsed;
- }
-
-
-
-
-
- private void bt_build_Click(object sender, RoutedEventArgs e)
- {
- string buildName = tb_buildName.Text.ToString();
- if (buildName == null || buildName == "")
- {
- MessageBox.Show("请输入新增楼栋名称");
- return;
- }
- TextBox textBox = new TextBox();
- textBox.Width = 100;
- textBox.Text = buildName;
- DockPanel dockPanel = new DockPanel();
- dockPanel.Margin = new Thickness(30, 10, 0, 0);
- dockPanel.HorizontalAlignment = HorizontalAlignment.Left;
- dockPanel.Children.Add(textBox);
- sp_buildNames.Children.Add(dockPanel);
- tb_buildName.Text = "";
- }
-
-
-
-
-
- private void bt_addPorject_Click(object sender, RoutedEventArgs e)
- {
-
- string projectName = tb_projectName.Text.ToString();
- if (projectName == null || projectName == "")
- {
- MessageBox.Show("请输入项目名称");
- return;
- }
-
- string businessName = tb_staus.Text.ToString();
- if (businessName == null || businessName == "")
- {
- MessageBox.Show("请输入项目业态");
- return;
- }
-
- string pathName = tb_Path.Text.ToString();
- if (pathName == null || pathName == "")
- {
- MessageBox.Show("请输入项目地址");
- return;
- }
-
- BuildNames = new List<string>();
- GetBuildNames(sp_buildNames);
-
- ProjectEntity projectEntity = new ProjectEntity(projectName, businessName, pathName);
- List<ProjectEntity> buildDatas = new List<ProjectEntity>();
- foreach (var buildName in BuildNames)
- {
-
- ProjectEntity subData1 = new ProjectEntity("项目信息", projectEntity);
-
- Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
- keyValuePairs.Add("主管", "");
- keyValuePairs.Add("建筑", "");
- keyValuePairs.Add("结构", "");
- keyValuePairs.Add("给排水", "");
- keyValuePairs.Add("暖通", "");
- keyValuePairs.Add("电气", "");
- ProjectEntity subData2 = new ProjectEntity("团队成员", keyValuePairs);
-
- OperatingFloorData operatingFloorData = new OperatingFloorData(projectName);
- ProjectEntity subData3 = new ProjectEntity("工作台", operatingFloorData);
-
- ProjectEntity subData4 = new ProjectEntity("自定义", new List<ProjectEntity>());
-
- buildDatas.Add(new ProjectEntity(buildName, new List<ProjectEntity>() { subData1, subData2, subData3, subData4 }));
- }
- ProjectEntity projectInfo = new ProjectEntity(projectName, buildDatas);
-
- if (!projectName.Contains("项目")) projectName = projectName + " 项目";
-
- string seconNode = projectName + "建筑" + "图纸更新";
- bool isExisteSecon = false;
- for (int i = 0; i < SeconMessagePage.MessageDatas.Count; i++)
- {
- MessageData existMessageData = SeconMessagePage.MessageDatas[i];
- if (existMessageData.SeconNode.Equals(seconNode))
- {
- foreach (var item in BuildNames)
- {
- string addStringName = projectName + item + "更新";
- bool isExisteThree = false;
- foreach (var threeNode in SeconMessagePage.MessageDatas[i].ThreeNodes)
- {
- if (addStringName.Equals(threeNode))
- {
- isExisteThree = true;
- }
- }
- if (!isExisteThree)
- {
- SeconMessagePage.MessageDatas[i].ThreeNodes.Add(addStringName);
- }
- }
- isExisteSecon = true;
- break;
- }
- }
- if (!isExisteSecon)
- {
- MessageData newMessageData = new MessageData();
- newMessageData.SeconNode = seconNode;
- foreach (var item in BuildNames)
- {
- newMessageData.ThreeNodes.Add(projectName + "建筑" + item + "更新");
- }
- SeconMessagePage.MessageDatas.Add(newMessageData);
- }
-
- SeconProjectPage.ProjectEntities.Add(projectInfo);
- SeconProjectPage.FlushData();
- }
-
-
-
- public List<string> BuildNames = new List<string>();
-
-
-
-
- public void GetBuildNames(DependencyObject obj)
- {
- for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
- {
- DependencyObject child = VisualTreeHelper.GetChild(obj, i);
- if (child is TextBox textBox)
- {
- BuildNames.Add(textBox.Text.ToString());
- }
- GetBuildNames(child);
- }
- }
- }
- }
|