コード例 #1
0
ファイル: ProjectMgtForm.cs プロジェクト: ChenglongMa/DNA_MES
        private void btnSearch_Click(object sender, EventArgs e)
        {
            var code      = txtCode.Text.Trim();
            var name      = txtName.Text.Trim();
            var startTime = dteStartTime.Enabled ? dteStartTime.DateTime : SysInfo.IllegalDateTime;
            var endTime   = dteEndTime.Enabled ? dteEndTime.DateTime : SysInfo.IllegalDateTime;
            var exp       = _bll.BuildExp(code, name, startTime, endTime);
            var projs     = _bll.GetDataSource(exp);

            GridBindingBll <Project> .BindingData(ug1, projs, FieldName);

            if (projs.IsNullOrEmpty())
            {
                MsgBoxLib.ShowWarning("无查询结果");
            }
        }
コード例 #2
0
        private void ug1_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
        {
            ResetNodeBackColor();
            if (!(e.Row.ListObject is Project proj))
            {
                return;
            }
            var node = _bll.FindNode(uTree, proj);

            if (node == null)
            {
                MsgBoxLib.ShowWarning("未找到该项目结构");
            }
            else
            {
                node.Override.NodeAppearance.BackColor = Color.DarkTurquoise;
                _nodesWithColor.Enqueue(node);
            }
        }
コード例 #3
0
ファイル: ProcessMgtForm.cs プロジェクト: ChenglongMa/DNA_MES
        private void btnSearch_Click(object sender, EventArgs e)
        {
            var code      = txtCode.Text.Trim();
            var name      = txtName.Text.Trim();
            var startTime = dteStartTime.Enabled ? dteStartTime.DateTime : SysInfo.IllegalDateTime;
            var endTime   = dteEndTime.Enabled ? dteEndTime.DateTime : SysInfo.IllegalDateTime;
            var exp       = _bll.BuildExp(code, name, startTime, endTime);
            var proj      = _bll.GetDataSource(exp).FirstOrDefault(); //只能查询单个项目
            var node      = _bll.FindNode(uTree, proj);

            if (node != null)
            {
                node.Override.NodeAppearance.BackColor = Color.DarkTurquoise;
                NodesWithColor.Enqueue(node);
            }
            else
            {
                MsgBoxLib.ShowWarning("无查询结果");
            }
        }
コード例 #4
0
        private void toolBarManager_ToolClick(object sender, ToolClickEventArgs e)
        {
            var pProj = SelectedNode?.Parent?.Tag as Project;
            ProjectMgtAddEdit form;

            switch (e.Tool.Key)
            {
            case "Refresh":
            default:
                RefreshData();
                break;

            case "Add":

                form = new ProjectMgtAddEdit("新增项目");
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    if (_bll.AddProject(form.TransModel, pProj))
                    {
                        MsgBoxLib.ShowInformationOk("操作成功!");
                        //将父类加入List,表示需要从数据库中更新子类数据
                        if (pProj != null)
                        {
                            _projectsNeedRefresh.AddFirst(pProj.Code);
                        }
                    }
                    else
                    {
                        MsgBoxLib.ShowStop("操作失败");
                    }
                }

                goto default;

            case "Edit":
                form = new ProjectMgtAddEdit("编辑项目", SelectedNode?.Tag as Project);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    if (_bll.UpdateModel(form.TransModel, pProj))
                    {
                        MsgBoxLib.ShowInformationOk("操作成功!");
                        //将父类加入List,表示需要从数据库中更新子类数据
                        if (pProj != null)
                        {
                            _projectsNeedRefresh.AddFirst(pProj.Code);
                        }
                    }
                    else
                    {
                        MsgBoxLib.ShowStop("操作失败");
                    }
                }

                goto default;

            case "Delete":
                if (SelectedNode?.Tag is Project proj)
                {
                    if (_bll.DeleteModel <Project, ProjectProject>(proj, pProj))
                    {
                        MsgBoxLib.ShowInformationOk("操作成功");
                        //将父类加入List,表示需要从数据库中更新子类数据
                        if (pProj != null)
                        {
                            _projectsNeedRefresh.AddFirst(pProj.Code);
                        }
                    }
                    else
                    {
                        MsgBoxLib.ShowStop("操作失败");
                    }
                }
                else
                {
                    MsgBoxLib.ShowWarning("请先选择要删除的项目");
                }
                goto default;

            case "AddChild":
                //TODO:还未想出解决方案
                goto default;
            }
        }