Пример #1
0
        /// <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_LOAD_INFO modelDevLoadInfo = PrepareModelLoadInfo();

                //更新数据
                bool status = _bllDevLoadInfo.Enabled(modelDevLoadInfo.F_LOAD_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;
            }
        }
Пример #2
0
        /// <summary>
        ///     准备要操作的ModelPARAMETER_MONITORCOMMON
        /// </summary>
        /// <returns></returns>
        private ModelDEV_LOAD_INFO PrepareModelLoadInfo()
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");


                ModelDEV_LOAD_INFO modelDevLoadInfo = new ModelDEV_LOAD_INFO();


                //负载柜编号
                modelDevLoadInfo.F_LOAD_ID = txtF_LOAD_ID.Text;
                //负载柜名称
                modelDevLoadInfo.F_LOAD_NAME = txtF_LOAD_NAME.Text;
                //校验编号
                modelDevLoadInfo.F_LOAD_CALIBRATION = txtF_LOAD_CALIBRATION.Text;
                //负载柜位置
                modelDevLoadInfo.F_LOAD_POSTION = txtF_LOAD_POSTION.Text;
                //资产编号
                modelDevLoadInfo.F_PROPERTY_ID = txtF_PROPERTY_ID.Text;
                //负载类型
                modelDevLoadInfo.F_LOAD_TYPE = decimal.Parse(lueF_LOAD_TYPE.EditValue.ToString());
                //感性负载功率因素
                modelDevLoadInfo.F_CONDUCTYLOAD_COEFFECIENCY = decimal.Parse(txtF_CONDUCTYLOAD_COEFFECIENCY.Text);
                //负载电压类型
                modelDevLoadInfo.F_LOAD_VOLTAGE_TYPE = decimal.Parse(lueF_LOAD_VOLTAGE_TYPE.EditValue.ToString());
                //稳态电流上限
                modelDevLoadInfo.F_LOAD_STABLECURRENT_CEILING = decimal.Parse(txtF_LOAD_STABLECURRENT_CEILING.Text);
                //稳态电流下限
                modelDevLoadInfo.F_LOAD_STABLECURRENT_FLOOR = decimal.Parse(txtF_LOAD_STABLECURRENT_FLOOR.Text);
                //冲击电流上限
                modelDevLoadInfo.F_LOAD_PULSECURRENT_CEILING = decimal.Parse(txtF_LOAD_PULSECURRENT_CEILING.Text);
                //冲击电流下限
                modelDevLoadInfo.F_LOAD_PULSECURRENT_FLOOR = decimal.Parse(txtF_LOAD_PULSECURRENT_FLOOR.Text);
                //负载电压上限
                modelDevLoadInfo.F_LOAD_VOLTAGE_CEILING = decimal.Parse(txtF_LOAD_VOLTAGE_CEILING.Text);
                //负载电压下限
                modelDevLoadInfo.F_LOAD_VOLTAGE_FLOOR = decimal.Parse(txtF_LOAD_VOLTAGE_FLOOR.Text);
                //描述信息
                modelDevLoadInfo.F_LOAD_DESCRIPTION = txtF_LOAD_DESCRIPTION.Text;


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

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

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

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

                return(modelDevLoadInfo);
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
Пример #3
0
        /// <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;
                }
                //若存在通道数据则不能禁用或者删除
                int subDataCount;

                int.TryParse(txtChannelNum.Text, out subDataCount);

                if (subDataCount != 0)
                {
                    XtraMessageBox.Show("有附属信息不能禁用或者删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    gvList_RowClick(this, null);
                    return;
                }
                //检查必填字段
                bool isAllOk = CheckNotNullField();

                if (!isAllOk)
                {
                    return;
                }

                //准备要存储的数据
                ModelDEV_LOAD_INFO modelDevLoadInfo = PrepareModelLoadInfo();

                //更新数据
                bool status = _bllDevLoadInfo.Drop(modelDevLoadInfo.F_LOAD_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;
            }
        }
Пример #4
0
        /// <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_LOAD_INFO modelDevLoadInfo = PrepareModelLoadInfo();


                //判断此数据是否已经存在
                bool isDataExist = _bllDevLoadInfo.Exists(modelDevLoadInfo.F_LOAD_ID);

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

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

                    //获得当前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
                {
                    _bllDevLoadInfo.Add(modelDevLoadInfo);


                    //获得当前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;
            }
        }