Example #1
0
        /// <summary>
        /// 保存按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveBtn_Click(object sender, EventArgs e)
        {
            this.ValidateChildren(ValidationConstraints.Enabled & ValidationConstraints.TabStop & ValidationConstraints.Selectable);
            if (!VTMS.ControlLib.ValidatorManager.ValidateControls(this))
            {
                MessageBox.Show("控件内容不合法");
                return;
            }
            Apply apply = getApplyInfo();

            try
            {
                if (this.isUpdate)
                {
                    ApplyDao.Update(apply);
                }
                else
                {
                    object id = ApplyDao.Add(apply);
                    MessageBox.Show("当前流水号为 " + id);
                }
                this.isUpdate = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }
Example #2
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))
            {
                apply = new Apply();

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

                this.setControlReadOnly(false);

                this.category.Focus();

                this.isUpdate = false;
            }
            else
            {
                apply = ApplyDao.GetBySerial(this.serial.Text);

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

                    this.isUpdate = true;

                    setApplyInfo(apply);

                    this.category.Focus();
                }
                else
                {
                    this.serial.Focus();
                }
            }
        }
Example #3
0
        /// <summary>
        /// 保存
        /// </summary>
        private void saveInfo()
        {
            Apply apply = getPrintInfo();

            try
            {
                if (this.isUpdate)
                {
                    ApplyDao.Update(apply);
                }
                else
                {
                    object id = ApplyDao.Add(apply);
                    MessageBox.Show("当前流水号为 " + id); ApplyDao.Add(apply);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }