Exemplo n.º 1
0
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            string code = btn_JianYanBianHao.Text;

            if (string.IsNullOrWhiteSpace(txt_jianceshuliang.Text))
            {
                MessageBox.Show("请输入规格数量!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrWhiteSpace(cb_DangQianDangHao.Text))
            {
                MessageBox.Show("请设置樘号!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrWhiteSpace(code))
            {
                MessageBox.Show("请设置当前编号!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            DAL_dt_Settings dal = new DAL_dt_Settings();

            try
            {
                var setting = GetSettings();
                var tong    = this.cb_DangQianDangHao.Text;
                if (dal.Add(setting, tong))
                {
                    //  MessageBox.Show("设定完成!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //获取樘号
                    deleBottomTypeEvent(GetBottomType(true));
                    DefaultBase.base_SpecCount = int.Parse(txt_jianceshuliang.Text);
                    DefaultBase.base_TestItem  = cb_JianCeXiangMu.Text;
                    DefaultBase.LockPoint      = cbb_danshandansuodian.Text == "是" ? true : false;

                    int def = 0;
                    int.TryParse(txt_ganjianchangdu.Text, out def);

                    DefaultBase.BarLength   = def;
                    this.btn_add.Enabled    = true;
                    this.btn_select.Enabled = true;
                    this.btn_delete.Enabled = true;
                    this.btn_Ok.Enabled     = true;

                    // this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("添加异常!", "异常", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Logger.Error(ex);
            }
        }
Exemplo n.º 2
0
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            string code = btn_JianYanBianHao.Text;

            if (string.IsNullOrWhiteSpace(btn_GuiGeShuLiang.Text))
            {
                MessageBox.Show("请输入规格数量!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                return;
            }

            if (string.IsNullOrWhiteSpace(cb_DangQianDangHao.Text))
            {
                MessageBox.Show("请设置樘号!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                return;
            }

            if (string.IsNullOrWhiteSpace(code))
            {
                MessageBox.Show("请设置当前编号!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                return;
            }

            DAL_dt_Settings dal = new DAL_dt_Settings();

            try
            {
                var setting = GetSettings();
                var tong    = this.cb_DangQianDangHao.Text;
                if (dal.Add(setting, tong))
                {
                    MessageBox.Show("设定完成!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                    //获取樘号
                    deleBottomTypeEvent(GetBottomType(true));
                    DefaultBase.base_SpecCount = int.Parse(btn_GuiGeShuLiang.Text);
                    DefaultBase.base_TestItem  = cb_JianYanXiangMu.Text;

                    this.btn_add.Enabled    = true;
                    this.btn_select.Enabled = true;
                    this.btn_delete.Enabled = true;
                    this.btn_Ok.Enabled     = true;
                    //this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("添加异常!", "异常", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                Logger.Error(ex);
            }
        }