Ejemplo n.º 1
0
        private void VerCodeInfo_Load(object sender, EventArgs e)
        {
            cboVerType.SelectedIndex = 0;
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_VER_FORMAT verformat = new Maticsoft.BLL.SMT_VER_FORMAT();
                    var list = verformat.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in list)
                        {
                            DoAddToGrid(item);
                        }
                    }));
                }
                catch (System.Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载失败:" + ex.Message);
                    log.Error("加载失败:", ex);
                }
            });

            waiting.Show(this, 300);
        }
Ejemplo n.º 2
0
        private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
            {
                if (dgvData.Columns[e.ColumnIndex].Name == "ColDelete")
                {
                    Maticsoft.BLL.SMT_VER_FORMAT verBll = new Maticsoft.BLL.SMT_VER_FORMAT();
                    DataGridViewRow row = dgvData.Rows[e.RowIndex];
                    Maticsoft.Model.SMT_VER_FORMAT verModel = (Maticsoft.Model.SMT_VER_FORMAT)row.Tag;
                    if (MessageBox.Show("确定删除该证件编码?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                    {
                        return;
                    }
                    CtrlWaiting waiting = new CtrlWaiting(() =>
                    {
                        try
                        {
                            verBll.Delete(verModel.ID);
                            this.Invoke(new Action(() =>
                            {
                                dgvData.Rows.Remove(row);
                            }));
                        }
                        catch (Exception ex)
                        {
                            log.Error("删除证件编码异常!", ex);

                            WinInfoHelper.ShowInfoWindow(this, "删除证件编码异常:" + ex.Message);
                        }
                    });
                    waiting.Show(this);
                }
            }
        }
Ejemplo n.º 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (tbVerName.Text.Trim() == "")
            {
                WinInfoHelper.ShowInfoWindow(this, "证件名称不能为空!");
                tbVerName.Focus();
                return;
            }
            if (cboVerType.SelectedIndex < 0)
            {
                WinInfoHelper.ShowInfoWindow(this, "证件类型不能为空!");
                cboVerType.Focus();
                return;
            }
            if (tbVerFormat.Text.Trim() == "")
            {
                WinInfoHelper.ShowInfoWindow(this, "编码格式不能为空!");
                tbVerFormat.Focus();
                return;
            }
            Maticsoft.Model.SMT_VER_FORMAT format = new Maticsoft.Model.SMT_VER_FORMAT()
            {
                VER_FORMAT = tbVerFormat.Text.Trim(),
                VER_NAME   = tbVerName.Text.Trim(),
                VER_TYPE   = cboVerType.SelectedIndex
            };
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_VER_FORMAT verformat = new Maticsoft.BLL.SMT_VER_FORMAT();
                    format.ID = verformat.Add(format);
                    this.Invoke(new Action(() =>
                    {
                        DoAddToGrid(format);
                    }));
                }
                catch (System.Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "添加失败:" + ex.Message);
                    log.Error("添加失败:", ex);
                }
            });

            waiting.Show(this);
        }