Пример #1
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            ListView.SelectedIndexCollection selectCol = lstTerminalConfigView.SelectedIndices;
            if (selectCol != null && selectCol.Count > 0)
            {
                if (DialogResult.Yes == XtraMessageBox.Show("确定要删除该数据?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk))
                {
                    if (configBLL.DeletePreTer(lstTerminalConfigView.Items[selectCol[0]].SubItems[0].Text))
                    {
                        XtraMessageBox.Show("删除成功", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MonitorView = (PreTerMonitor)GlobalValue.MainForm.GetView(typeof(PreTerMonitor));
                        if (MonitorView != null)
                        {
                            MonitorView.ShowTerList(false, true);
                            MonitorView.ShowTerData();
                        }

                        ClearConfigControls();
                        GetConfigFromDB();
                    }
                    else
                    {
                        XtraMessageBox.Show("删除失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("请选择一条数据操作", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                TerminalConfigEntity entity = null;
                if (configBLL.IsExist(txtTerminalID.Text.Trim()))
                {
                    if (DialogResult.Yes == XtraMessageBox.Show("终端编号[" + txtTerminalID.Text + "]已经存在,是否更新?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk))
                    {
                        entity = GetEntity();
                        if (configBLL.Modify(entity))
                        {
                            XtraMessageBox.Show("更新成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            MonitorView = (PreTerMonitor)GlobalValue.MainForm.GetView(typeof(PreTerMonitor));
                            if (MonitorView != null)
                            {
                                MonitorView.ShowTerList(false, true);
                                MonitorView.ShowTerData();
                            }

                            ClearConfigControls();
                            GetConfigFromDB();
                        }
                        else
                        {
                            XtraMessageBox.Show("更新失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    if (DialogResult.Yes == XtraMessageBox.Show("是否新增终端编号[" + txtTerminalID.Text + "]?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk))
                    {
                        entity = GetEntity();
                        if (configBLL.Insert(entity))
                        {
                            XtraMessageBox.Show("新增成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            MonitorView = (PreTerMonitor)GlobalValue.MainForm.GetView(typeof(PreTerMonitor));
                            if (MonitorView != null)
                            {
                                MonitorView.ShowTerList(false, true);
                                MonitorView.ShowTerData();
                            }

                            ClearConfigControls();
                            GetConfigFromDB();
                        }
                        else
                        {
                            XtraMessageBox.Show("新增失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }