Example #1
0
        /// <summary>
        /// 永久删除一条数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");
                //删除前判断
                DialogResult dialogResult = XtraMessageBox.Show("此操作将永久删除数据并有可能导致其他关联数据出错,是否继续?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }

                //检查必填字段
                bool isAllOk = CheckNotNullField();

                if (!isAllOk)
                {
                    return;
                }

                //准备要存储的数据
                ModelTESTTASK_PARVALUE modelParameterMonitorcommon = PrepaireModelParameterMonitorcommon();

                //更新数据
                bool status = _bllteTestTtaskParvalue.Drop(modelParameterMonitorcommon.F_TYPE_CODE, modelParameterMonitorcommon.F_CODE);

                //绑定数据
                BindGridview();
                //重新刷新数据
                lueParameterType_EditValueChanged(this, null);

                if (status)
                {
                    XtraMessageBox.Show("此数据已删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //刷新数据
                    gvList_RowClick(this, null);
                }
                else
                {
                    XtraMessageBox.Show("没有数据被删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }