示例#1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txt_PaName.Text.Length == 0)
            {
                MessageBoxEx.Show("该简称不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if ((cmcsProvinceAbbreviation == null || cmcsProvinceAbbreviation.PaName != txt_PaName.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsProvinceAbbreviation>(" where PaName=:PaName", new { PaName = txt_PaName.Text }).Count > 0)
            {
                MessageBoxEx.Show("该程序唯一标识中配置名称不可重复!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.EditMode == eEditMode.修改)
            {
                cmcsProvinceAbbreviation.PaName = txt_PaName.Text;
                Dbers.GetInstance().SelfDber.Update(cmcsProvinceAbbreviation);
            }
            else if (this.EditMode == eEditMode.新增)
            {
                cmcsProvinceAbbreviation        = new CmcsProvinceAbbreviation();
                cmcsProvinceAbbreviation.PaName = txt_PaName.Text;
                Dbers.GetInstance().SelfDber.Insert(cmcsProvinceAbbreviation);
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
示例#2
0
 private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e)
 {
     foreach (GridRow gridRow in e.GridPanel.Rows)
     {
         CmcsProvinceAbbreviation entity = gridRow.DataItem as CmcsProvinceAbbreviation;
         if (entity == null)
         {
             return;
         }
     }
 }
示例#3
0
        private void FrmProvinceAbbreviation_Oper_Load(object sender, EventArgs e)
        {
            this.cmcsProvinceAbbreviation = Dbers.GetInstance().SelfDber.Get <CmcsProvinceAbbreviation>(this.PId);
            if (this.cmcsProvinceAbbreviation != null)
            {
                txt_PaName.Text = cmcsProvinceAbbreviation.PaName;
            }

            if (this.EditMode == eEditMode.查看)
            {
                btnSubmit.Enabled = false;
                HelperUtil.ControlReadOnly(panelEx2, true);
            }
        }
示例#4
0
        private void superGridControl1_CellMouseDown(object sender, GridCellMouseEventArgs e)
        {
            CmcsProvinceAbbreviation entity = Dbers.GetInstance().SelfDber.Get <CmcsProvinceAbbreviation>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmProvinceAbbreviation_Oper frmShow = new FrmProvinceAbbreviation_Oper(entity.Id, eEditMode.查看);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmProvinceAbbreviation_Oper frmEdit = new FrmProvinceAbbreviation_Oper(entity.Id, eEditMode.修改);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                // 查询正在使用该供应商的车数
                if (MessageBoxEx.Show("确定要删除该配置信息?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    try
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsProvinceAbbreviation>(entity.Id);
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该配置信息正在使用中,禁止删除!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;
            }
        }