/// <summary>
        /// Add ProcessPlanning module
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ProcessPlanningModule processPlanningModule = new ProcessPlanningModule();

            processPlanningModule.BusinessId = ProcessPlanningMod.BusinessId;
            processPlanningModule.BType      = BusinessType.Folder;
            processPlanningModule.Name       = txtBusinessName.Text.Trim();
            processPlanningModule.ParentNode = ProcessPlanningMod.ParentNode;
            processPlanningModule.ProcessPlanningModuleId = Guid.NewGuid();

            try
            {
                int currentNode
                    = ProcessPlanningModuleBLL.AddProcessPlanningModule(processPlanningModule);

                NewNodeNameDic
                    = new Dictionary <string, ProcessPlanningModule>()
                    {
                    { txtBusinessName.Text.Trim(), processPlanningModule }
                    };
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.DialogResult = DialogResult.Cancel;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get card manager list
        /// </summary>
        /// <param name="nodeName"></param>
        /// <returns></returns>
        public void LoadTreeData()
        {
            //if (tvProcessPlanningModule.InvokeRequired)
            //{
            //    LoadTreeEventHandler loadtreeEventHandler = new LoadTreeEventHandler(() =>
            //    {
            try
            {
                List <Model.ProcessPlanningModule> processPlanningModuleList =
                    ProcessPlanningModuleBLL.GetProcesPlanningModuleList(0);

                //if (processPlanningModuleList.Count <= 0) return;
                //如果数据库内没有工艺规程模版记录,则默认增加一条root记录
                if (processPlanningModuleList.Count <= 0)
                {
                    processPlanningModuleList = new List <ProcessPlanningModule>();
                    ProcessPlanningModule planningModule = new ProcessPlanningModule();
                    planningModule.BusinessId = Guid.NewGuid();
                    planningModule.Name       = "工艺规程模板";
                    planningModule.BType      = 0;
                    planningModule.ParentNode = 0;
                    planningModule.Sort       = 1;

                    int currentNode = ProcessPlanningModuleBLL.AddProcessPlanningModule(planningModule);

                    planningModule.CurrentNode = currentNode;
                    processPlanningModuleList.Add(planningModule);
                }

                Model.ProcessPlanningModule processPlanningModule = processPlanningModuleList[0];

                TreeNode root = new TreeNode();
                root.Text     = processPlanningModule.Name;
                root.Tag      = processPlanningModule.BusinessId + "@" + processPlanningModule.CurrentNode.ToString();
                root.ImageKey = "folder";
                root.Name     = processPlanningModule.Sort.ToString(); //processPlanningModule.CurrentNode.ToString();
                root.Expand();

                ShowChildNode(root);

                tvProcessPlanningModule.Nodes.Add(root);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //});
            //tvProcessPlanningModule.BeginInvoke(loadtreeEventHandler, new object[] { });
            //}
        }
Exemplo n.º 3
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (selecedCardModuleNameIdDic.Count <= 0)
            {
                this.DialogResult = DialogResult.Cancel;
            }
            else
            {
                List <ProcessPlanningModule> _processCardModuleList = new List <ProcessPlanningModule>();
                try
                {
                    List <ProcessPlanningModule> listPlanningModules = ProcessPlanningModuleBLL.GetProcesPlanningModuleList(_processPlanningMod.ParentNode);
                    int sort = listPlanningModules.Count + 1;

                    /// add process planning module
                    foreach (var kv in selecedCardModuleNameIdDic)
                    {
                        ProcessPlanningModule p = new ProcessPlanningModule();
                        p.ProcessPlanningModuleId = Guid.NewGuid();
                        p.BType      = BusinessType.Card;
                        p.ParentNode = ProcessPlanningMod.ParentNode;
                        p.Name       = kv.Value;
                        p.BusinessId = new Guid(kv.Key);
                        p.Sort       = sort;

                        _processCardModuleList.Add(p);

                        sort++;
                    }

                    ProcessPlanningModuleBLL.AddProcessPlanningModule(_processCardModuleList);

                    Dictionary <string, ProcessPlanningModule> pDic = new Dictionary <string, ProcessPlanningModule>();
                    foreach (ProcessPlanningModule p in _processCardModuleList)
                    {
                        pDic.Add(p.Name, p);
                    }

                    ProcessPlanningModuleDic = pDic;

                    this.DialogResult = DialogResult.OK;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    this.DialogResult = DialogResult.Cancel;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 加载规程模版卡片
        /// </summary>
        private void LoadPlanningTreeData()
        {
            try
            {
                List <Model.ProcessPlanningModule> processPlanningModuleList =
                    ProcessPlanningModuleBLL.GetProcesPlanningModuleList(0);

                //if (processPlanningModuleList.Count <= 0) return;
                //如果数据库内没有工艺规程模版记录,则默认增加一条root记录
                if (processPlanningModuleList.Count <= 0)
                {
                    processPlanningModuleList = new List <Model.ProcessPlanningModule>();
                    Model.ProcessPlanningModule planningModule = new Model.ProcessPlanningModule();
                    planningModule.BusinessId = Guid.NewGuid();
                    planningModule.Name       = "工艺规程模板";
                    planningModule.BType      = 0;
                    planningModule.ParentNode = 0;
                    planningModule.Sort       = 1;

                    int currentNode = ProcessPlanningModuleBLL.AddProcessPlanningModule(planningModule);

                    planningModule.CurrentNode = currentNode;
                    processPlanningModuleList.Add(planningModule);
                }

                Model.ProcessPlanningModule processPlanningModule = processPlanningModuleList[0];

                TreeNode root = new TreeNode();
                root.Text     = processPlanningModule.Name;
                root.Tag      = processPlanningModule.BusinessId;
                root.ImageKey = "folder";
                root.Name     = processPlanningModule.CurrentNode.ToString();
                root.Expand();

                ShowPlanningChildNode(root);

                tvProcessPlanningModule.Nodes.Add(root);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }