Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.txtInsertProcess.Text.Trim() == "")
            {
                MessageBox.Show("Plaease Input Process name", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            bool   status      = true;
            string processName = this.txtInsertProcess.Text.Trim();

            foreach (ProcessProperty _process in _listProcess)
            {
                if (processName == _process.PROCESS_NAME.Trim())
                {
                    status = false;
                }
            }

            if (status == true)
            {
                ProcessProperty _addProcess = new ProcessProperty {
                    PROCESS_NAME = processName, PRODUCT_SUB_CODE = (cmbProduct.SelectedItem as ComboboxItem).Value.ToString(), CREATE_USER = _frmMain._empLogin.code
                };

                //Insert Process.
                if (_controllers.InsertProcess(_addProcess))
                {
                    this.SetPage();
                    //this.ResetInsertProcess();
                    this.LoadProcess();
                    this.SearchProcess();
                    this.pnlProcess.Enabled = false;
                }
            }
            else
            {
                MessageBox.Show("Duplicate Process Name.", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
        }