public WorkMaintainControl(MainController mainController)
        {
            InitializeComponent();
            _mainController = mainController;
            _workManager    = mainController.WorkManager;

            int Num, Fin;

            Num = _workManager.GetNoncont();

            Fin = _workManager.GetFincont();

            Nontbx1.Text = Convert.ToString(Num);

            Fintbx1.Text = Convert.ToString(Fin);
        }
        private void btnSearch_KeyDown(object sender, KeyEventArgs e)
        {
            Nontbx1.Text = "";
            Fintbx1.Text = "";
            tbxnom.Text  = "";

            int Num, Fin, Non;

            Non =

                Num = _workManager.GetNoncont();

            Fin = _workManager.GetFincont();

            Nontbx1.Text = Convert.ToString(Num);

            Fintbx1.Text = Convert.ToString(Fin);
        }
        private void btnCreate_Click(object sender, EventArgs e)
        {
            bool   success = true;
            string field   = "";

            // 以下為防呆檢查
            if (tbxWorkNumber.Text.Trim() == "")
            {
                success = false;
                field  += "工單單號、";
            }

            // 檢查工單號是否重覆
            if (_mainController.IsExistWorkId(tbxWorkNumber.Text.Trim()))
            {
                success = false;
                field  += "工單單號重覆,請重新確認工單號碼";
            }

            if (_mainController.IsExitsWorkNom(tbxWorkNumber.Text.Trim()))
            {
                success = false;
                field  += "工單單號未滿8碼,請重新確認工單號碼";
            }

            if (tbxCustomName.Text.Trim() == "")
            {
                success = false;
                field  += "客戶編號、";
            }
            if (cbxFrameMode.Text.Trim() == "")
            {
                success = false;
                field  += "框型種類、";
            }
            if (tbxGlassType.Text.Trim() == "")
            {
                success = false;
                field  += "片種、";
            }
            if (cbxCreateMan.Text.Trim() == "")
            {
                success = false;
                field  += "製作人、";
            }



            if (success == false)
            {
                success = false;
                MessageBox.Show(string.Format("資料不完整!\n{0}", field.TrimEnd('、')), "建立失敗");
                return;
            }

            //以下為載入資料
            WorkModel workModel = new WorkModel();

            workModel.WorkNumber  = tbxWorkNumber.Text.Trim();
            workModel.CustomName  = tbxCustomName.Text.Trim();
            workModel.CustcName   = tbxCustcName.Text.Trim();
            workModel.RightDegree = tbxRightDegree.Text.Trim();
            workModel.LeftDegree  = tbxLeftDegree.Text.Trim();
            workModel.Memo        = tbxMemo.Text.Trim();
            workModel.FrameMode   = cbxFrameMode.Text;
            if (rbtnSignal.Checked)
            {
                workModel.Degree = rbtnSignal.Text;
            }

            else
            {
                workModel.Degree = rbtnMulti.Text;
            }
            workModel.GlassType = tbxGlassType.Text.Trim();
            workModel.CreateMan = cbxCreateMan.Text;
            workModel.AddDegree = cbxAddDegree.Text;

            setControl(true, workModel);

            _inserWorkModel.Enqueue(workModel);
            _idleCommandSendEvent.Set();
            textClear();

            WorkManager Text = new WorkManager();
            int         Num;

            Num          = _workManager.GetNoncont();
            Nontbx1.Text = Convert.ToString(Num);
        }