Пример #1
0
        /// <summary>
        /// 当光标焦点至于流水号时,用户回车产生新的流水号或获取流水号对应数据信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void serial_Leave(object sender, EventArgs e)
        {
            if (this.serial.ReadOnly || (this.serial.Text.Length != 11 && this.serial.Text.Length != 0))
            {
                return;
            }

            //InitComboBox();

            if (Utilities.IsNullOrEmpty(this.serial.Text))
            {
                alter = new Alter();

                this.serial.Text = AlterDao.GetLatestSerial();

                this.setControlReadOnly(false);

                this.category.Focus();

                this.isUpdate = false;
            }
            else
            {
                alter = AlterDao.GetBySerial(this.serial.Text);

                if (alter != null)
                {
                    this.setControlReadOnly(false);

                    this.isUpdate = true;

                    setAlterInfo(alter);

                    this.category.Focus();
                }
                else
                {
                    this.serial.Focus();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 保存按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveBtn_Click(object sender, EventArgs e)
        {
            Alter alter = getAlterInfo();

            try
            {
                if (this.isUpdate)
                {
                    AlterDao.Update(alter);
                }
                else
                {
                    AlterDao.Add(alter);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            this.isUpdate = true;
        }
Пример #3
0
        /// <summary>
        /// 保存
        /// </summary>
        private void saveInfo()
        {
            Alter alter = getPrintInfo();

            try
            {
                if (this.isUpdate)
                {
                    AlterDao.Update(alter);
                }
                else
                {
                    object id = AlterDao.Add(alter);

                    MessageBox.Show("当前流水号为 " + id);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }