Ejemplo n.º 1
0
        private void 激活工艺ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (var row in ug1.Rows)
            {
                if (row == _activeProcRow || !(row?.ListObject is Process proc))
                {
                    continue;
                }

                if (proc.IsValid)
                {
                    if (!MsgBoxLib.ShowQuestion("发现已激活工艺,确定要更改吗?"))
                    {
                        return;
                    }

                    proc.IsValid = false;
                    _bll.UpdateModel(proc);
                }
            }

            if (_activeProcRow?.ListObject is Process p)
            {
                p.IsValid = true;
                _bll.UpdateModel(p);
                MsgBoxLib.ShowInformationOk("激活工艺设置成功");
            }

            RefreshProc();
        }
Ejemplo n.º 2
0
 private void btnDBInitial_Click(object sender, EventArgs e)
 {
     if (MsgBoxLib.ShowQuestion("该操作将删除现有的数据,是否继续?"))
     {
         Cursor.Current = Cursors.WaitCursor;
         try
         {
             Application.DoEvents();
             //bslMesDbInit.InitialMESDatabase();
             MsgBoxLib.ShowInformationOk("操作结束!");
         }
         catch (Exception ex)
         {
             Cursor.Current = Cursors.Default;
             MsgBoxLib.ShowError(ex.Message);
         }
         finally
         {
             Cursor.Current = Cursors.Default;
         }
     }
 }
Ejemplo n.º 3
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     e.Cancel = !MsgBoxLib.ShowQuestion("确定要退出系统吗?");
 }
Ejemplo n.º 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":
                var thisProj = SelectedNode?.Tag as Project;
                form = new ProjectMgtAddEdit(thisProj == null);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    if (_bll.AddProject(form.TransModel, thisProj))
                    {
                        MsgBoxLib.ShowInformationOk("操作成功!");
                        //将父类加入List,表示需要从数据库中更新子类数据
                        if (thisProj?.Code != null)
                        {
                            _bll.ParentsToBeUpdated.AddFirst(thisProj.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)
                        {
                            _bll.ParentsToBeUpdated.AddFirst(pProj.Code);
                        }
                    }
                    else
                    {
                        MsgBoxLib.ShowStop("操作失败");
                    }
                }

                goto default;

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

                goto default;
            }