/// <summary>
        /// 彻底删除一条记录,一旦删除无法恢复,建议不要使用此功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");
                //删除前判断
                DialogResult dialogResult = XtraMessageBox.Show("此操作将永久删除数据并有可能导致其他关联数据出错,是否继续?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }
                //检查必填字段
                bool isAllOk = CheckNotNullField();

                if (!isAllOk)
                {
                    return;
                }

                //准备要存储的数据
                ModelDEV_COILPOWER_INFO modelCoilInfo = PrepareCoilInfo();

                //判断是否有关系
                bool hasRelation = _bllDevCoilpowerInfo.HasRelation(modelCoilInfo.F_COILPOWER_ID);
                if (hasRelation)
                {
                    XtraMessageBox.Show("此设备有和其他设备的关系,不能删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //更新数据
                bool status = _bllDevCoilpowerInfo.Drop(modelCoilInfo.F_COILPOWER_ID);

                //获得当前rowhandle
                int rowhandle = gvList.FocusedRowHandle;

                //绑定数据
                BindGridview();

                //设置焦点行
                gvList.FocusedRowHandle = rowhandle;

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

                    //刷新数据
                    gvList_RowClick(this, null);
                }
                else
                {
                    XtraMessageBox.Show("没有数据被更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
        /// <summary>
        /// 启动其中的一条记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEnabled_Click(object sender, EventArgs e)
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

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

                if (!isAllOk)
                {
                    return;
                }

                //准备要存储的数据
                ModelDEV_COILPOWER_INFO modelCoilInfo = PrepareCoilInfo();
                //更新数据
                bool status = _bllDevCoilpowerInfo.Enabled(modelCoilInfo.F_COILPOWER_ID);

                //获得当前rowhandle
                int rowhandle = gvList.FocusedRowHandle;

                //绑定数据
                BindGridview();

                //设置焦点行
                gvList.FocusedRowHandle = rowhandle;

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

                    //刷新数据
                    gvList_RowClick(this, null);
                }
                else
                {
                    XtraMessageBox.Show("没有数据被更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

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

                if (!isAllOk)
                {
                    return;
                }

                //准备要存储的数据
                ModelDEV_COILPOWER_INFO modelCoilInfo = PrepareCoilInfo();


                //判断此数据是否已经存在
                bool isDataExist = _bllDevCoilpowerInfo.Exists(modelCoilInfo.F_COILPOWER_ID);

                if (isDataExist)
                {
                    //已经存在判断是否更新
                    DialogResult dialogResult = XtraMessageBox.Show("当前数据已存在,是否更新?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (dialogResult == DialogResult.No)
                    {
                        return;
                    }
                    //更新数据
                    bool status = _bllDevCoilpowerInfo.Update(modelCoilInfo);

                    //获得当前rowhandle
                    int rowhandle = gvList.FocusedRowHandle;

                    //绑定数据
                    BindGridview();

                    //设置焦点行
                    gvList.FocusedRowHandle = rowhandle;


                    if (status)
                    {
                        XtraMessageBox.Show("此数据已更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        XtraMessageBox.Show("没有数据被更新,操作中断。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    _bllDevCoilpowerInfo.Add(modelCoilInfo);


                    //获得当前rowhandle
                    int rowhandle = gvList.FocusedRowHandle;

                    //绑定数据
                    BindGridview();

                    //设置焦点行
                    gvList.FocusedRowHandle = rowhandle + 1;


                    XtraMessageBox.Show("此数据已增加。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
        /// <summary>
        ///     准备要操作的ModelPARAMETER_MONITORCOMMON
        /// </summary>
        /// <returns></returns>
        private ModelDEV_COILPOWER_INFO PrepareCoilInfo()
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");


                ModelDEV_COILPOWER_INFO modelCoilInfo = new ModelDEV_COILPOWER_INFO();


                //线圈电源
                modelCoilInfo.F_COILPOWER_ID = txtF_COILPOWER_ID.Text;
                //负载线圈电源名称
                modelCoilInfo.F_COILPOWER_NAME = txtF_COILPOWER_NAME.Text;

                //校验编号
                modelCoilInfo.F_COILPOWER_CALIBRATION = txtF_COILPOWER_CALIBRATION.Text;
                //端口
                modelCoilInfo.F_COM_ADDRESS = txtF_COM_ADDRESS.Text.ToUpper();

                //地址
                decimal coilPowerAddress;
                decimal.TryParse(txtF_COILPOWER_ADDRESS.Text, out coilPowerAddress);
                modelCoilInfo.F_COILPOWER_ADDRESS = coilPowerAddress;

                //状态
                decimal coilPowerStatus;
                decimal.TryParse(lueF_COILPOWER_RUN_STATUS.EditValue.ToString(), out coilPowerStatus);
                modelCoilInfo.F_COILPOWER_RUN_STATUS = coilPowerStatus;

                //输出电压上限
                if (txtF_COILPOWER_VOLTAGE_CEILING.Text == "")
                {
                    modelCoilInfo.F_COILPOWER_VOLTAGE_CEILING = null;
                }
                else
                {
                    modelCoilInfo.F_COILPOWER_VOLTAGE_CEILING = decimal.Parse(txtF_COILPOWER_VOLTAGE_CEILING.Text);
                }

                //输出电压下限
                if (txtF_COILPOWER_VOLTAGE_FLOOR.Text == "")
                {
                    modelCoilInfo.F_COILPOWER_VOLTAGE_FLOOR = null;
                }
                else
                {
                    modelCoilInfo.F_COILPOWER_VOLTAGE_FLOOR = decimal.Parse(txtF_COILPOWER_VOLTAGE_FLOOR.Text);
                }

                //输出电流上限
                if (txtF_COILPOWER_CURRENT_CEILING.Text == "")
                {
                    modelCoilInfo.F_COILPOWER_CURRENT_CEILING = null;
                }
                else
                {
                    modelCoilInfo.F_COILPOWER_CURRENT_CEILING = decimal.Parse(txtF_COILPOWER_CURRENT_CEILING.Text);
                }

                //输出电压下限
                if (txtF_COILPOWER_CURRENT_FLOOR.Text == "")
                {
                    modelCoilInfo.F_COILPOWER_CURRENT_FLOOR = null;
                }
                else
                {
                    modelCoilInfo.F_COILPOWER_CURRENT_FLOOR = decimal.Parse(txtF_COILPOWER_CURRENT_FLOOR.Text);
                }

                //输出电压上限
                if (txtF_COILPOWER_POWER.Text == "")
                {
                    modelCoilInfo.F_COILPOWER_POWER = null;
                }
                else
                {
                    modelCoilInfo.F_COILPOWER_POWER = decimal.Parse(txtF_COILPOWER_POWER.Text);
                }
                //备注
                modelCoilInfo.F_COILPOWER_MEMO = txtF_COILPOWER_MEMO.Text;

                //创建时间
                DateTime optDateTime = DateTime.Now;
                modelCoilInfo.F_CREATE_TIME = optDateTime;

                //操作员
                modelCoilInfo.F_OPERATOR_ID = AppGlobal.GUserId;

                //操作时间
                modelCoilInfo.F_OPERATIONTIME = optDateTime;

                //是否删除
                modelCoilInfo.F_DEL = 0;

                return(modelCoilInfo);
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }