예제 #1
0
        private void dgCustomAction_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                UnEnableControl();
                this.lblHourc.Enabled   = true;
                this.lblMinc.Enabled    = true;
                this.lblSecc.Enabled    = true;
                this.tabActions.Enabled = true;
                this.btnUpdate.Enabled  = true;
                m_customID = Convert.ToInt32(dgvCustomActions.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                //获取该步骤信息
                ALS.BLL.customactions bllc = new ALS.BLL.customactions();
                m_modc = bllc.GetModel(m_customID);
                if (m_modc != null)
                {
                    this.cmbAction.Text = m_modc.actionName;
                    this.cmbAction.Text = m_modc.actionName;
                    this.lbltsPump.Text = Cls.utils.SecondsToTime((int)m_modc.timeSpan);
                    int hour = (int)m_modc.timeCount / 3600;
                    int min  = (int)(m_modc.timeCount % 3600) / 60;
                    int sec  = (int)m_modc.timeCount % 60;
                    this.lblHour.Text = hour.ToString("00");
                    this.lblMin.Text  = (min).ToString("00");
                    this.lblSec.Text  = sec.ToString("00");

                    int hourc = (int)m_modc.timeSpan / 3600;
                    int minc  = (int)(m_modc.timeSpan % 3600) / 60;
                    int secc  = (int)(m_modc.timeSpan % 60);
                    this.lblHourc.Text = hourc.ToString("00");
                    this.lblMinc.Text  = minc.ToString("00");
                    this.lblSecc.Text  = secc.ToString("00");
                }
                //获取该时间点作列表
                ShowActions(m_customID);
            }
            else
            {
                m_customID = -1;
                m_modc     = null;
                this.tabActions.Enabled = false;
            }
        }
예제 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int hourc    = int.Parse(this.lblHourc.Text);
            int minc     = int.Parse(this.lblMinc.Text);
            int secc     = int.Parse(this.lblSecc.Text);
            int timespan = hourc * 3600 + minc * 60 + secc;

            if (timespan == 0)
            {
                MessageBox.Show("持续时间不能为 0 ", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            ALS.BLL.customactions   bllcustom   = new ALS.BLL.customactions();
            ALS.Model.customactions modelcustom = bllcustom.GetModel(this._method, this.cmbAction.Text.Trim());
            //CustomActions.BLL.actions bllaction = new CustomActions.BLL.actions();
            //DataSet dsaction = bllaction.GetList("customID='"+ modelcustom.ID+"'");
            //先查询该时间点是否有重复的
            if (modelcustom != null)
            {
                //m_modc = new CustomActions.Model.customactions();
                modelcustom.timeString     = Cls.utils.SecondsToTime(0);
                modelcustom.actionName     = this.cmbAction.Text.Trim();
                modelcustom.methodName     = _method;
                modelcustom.timeCount      = 0;
                modelcustom.timeSpan       = timespan;
                modelcustom.timeSpanString = Cls.utils.SecondsToTime(timespan);
                m_bllc = new ALS.BLL.customactions();
                if (m_bllc.Update(modelcustom))
                {
                    //刷新列表,sort by timecount
                    ShowCustomActions(_method);
                    UnEnableControl();
                }
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //int hour = int.Parse(this.lblHour.Text);
            //int min = int.Parse(this.lblMin.Text);
            //int sec = int.Parse(this.lblSec.Text);
            //int timecount = hour * 3600 + min * 60 + sec;

            int hourc    = int.Parse(this.lblHourc.Text);
            int minc     = int.Parse(this.lblMinc.Text);
            int secc     = int.Parse(this.lblSecc.Text);
            int timespan = hourc * 3600 + minc * 60 + secc;

            //if (!this.txtAction.Enabled)
            //{
            //    MessageBox.Show("请点击'输入步骤'按钮", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return;
            //}

            //if (string.IsNullOrEmpty(this.txtAction.Text))
            //{
            //    MessageBox.Show("请输入该步骤描述信息", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return;
            //}

            if (string.IsNullOrEmpty(this.cmbAction.Text))
            {
                MessageBox.Show("请输入该步骤描述信息", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (timespan == 0)
            {
                if (DialogResult.OK == MessageBox.Show("持续时间为0,点确定将添加为提示信息!", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
                {
                    //添加的是一个提示框
                    m_modc                = new ALS.Model.customactions();
                    m_modc.timeString     = Cls.utils.SecondsToTime(0);
                    m_modc.actionName     = this.cmbAction.Text.Trim();
                    m_modc.methodName     = _method;
                    m_modc.timeCount      = 0;
                    m_modc.timeSpan       = 0;
                    m_modc.timeSpanString = Cls.utils.SecondsToTime(0);
                    m_bllc                = new ALS.BLL.customactions();
                    if (m_bllc.Add(m_modc))
                    {
                        //刷新列表,sort by timecount
                        ShowCustomActions(_method);
                        m_modc = null;
                        UnEnableControl();
                    }
                }
                else
                {
                    return;
                }
            }

            ALS.BLL.customactions   bllcustom   = new ALS.BLL.customactions();
            ALS.Model.customactions modelcustom = bllcustom.GetModel(this._method, this.cmbAction.Text.Trim());
            //CustomActions.BLL.actions bllaction = new CustomActions.BLL.actions();
            //DataSet dsaction = bllaction.GetList("customID='"+ modelcustom.ID+"'");
            //先查询该时间点是否有重复的
            if (modelcustom != null)
            {
                MessageBox.Show("已存在相同的步骤名称,请重新设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                m_modc                = new ALS.Model.customactions();
                m_modc.timeString     = Cls.utils.SecondsToTime(0);
                m_modc.actionName     = this.cmbAction.Text.Trim();
                m_modc.methodName     = _method;
                m_modc.timeCount      = 0;
                m_modc.timeSpan       = timespan;
                m_modc.timeSpanString = Cls.utils.SecondsToTime(timespan);
                m_bllc                = new ALS.BLL.customactions();
                if (m_bllc.Add(m_modc))
                {
                    //刷新列表,sort by timecount
                    ShowCustomActions(_method);
                    m_modc = null;
                    UnEnableControl();
                }
            }
        }
예제 #4
0
        private void dgCustomAction_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                UnEnableControl();
                this.lblHourc.Enabled   = true;
                this.lblMinc.Enabled    = true;
                this.lblSecc.Enabled    = true;
                this.tabActions.Enabled = true;
                this.btnUpdate.Enabled  = true;
                m_customID = Convert.ToInt32(dgvCustomActions.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                //获取该步骤信息
                m_modc = m_bllc.GetModel(m_customID);
                if (m_modc != null)
                {
                    this.cmbAction.Text = m_modc.actionName;
                    this.lbltsPump.Text = Cls.utils.SecondsToTime((int)m_modc.timeSpan);
                    if (m_modc.timeSpan == 0)
                    {
                        //如果持续时间为0 则表示提示框
                        btnUpdate.Enabled = false;
                    }
                    else
                    {
                        btnUpdate.Enabled = true;
                    }

                    int hour = (int)m_modc.timeCount / 3600;
                    int min  = (int)(m_modc.timeCount % 3600) / 60;
                    int sec  = (int)m_modc.timeCount % 60;


                    this.lblHour.Text = hour.ToString("00");
                    this.lblMin.Text  = (min).ToString("00");
                    this.lblSec.Text  = sec.ToString("00");

                    int hourc = (int)m_modc.timeSpan / 3600;
                    int minc  = (int)(m_modc.timeSpan % 3600) / 60;
                    int secc  = (int)(m_modc.timeSpan % 60);

                    this.lblHourc.Text = hourc.ToString("00");
                    this.lblMinc.Text  = minc.ToString("00");
                    this.lblSecc.Text  = secc.ToString("00");
                    //读取提示图片
                    byte[] b = (byte[])m_modc.tipPic;
                    if (b != null)
                    {
                        MemoryStream ms  = new MemoryStream(b);
                        Bitmap       bmp = new Bitmap(ms);
                        this.picTip.Image = bmp;
                        ms.Close();
                        ms.Dispose();
                    }
                    else
                    {
                        this.picTip.Image = null;
                    }
                }
                //获取该时间点作列表
                ShowActions(m_customID);
            }
            else
            {
                m_customID = -1;
                m_modc     = null;
                this.tabActions.Enabled = false;
            }
        }