Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateData() == true)
            {
                DocTypePara para = new DocTypePara();
                para.ID = Convert.ToInt64(txtID.Text);
                para.DOCTYPE_CODE = txtDocTypeCode.Text;
                para.DOCTYPE_NAME = txtDoctypeName.Text;

                DocTypeFunc fnc = new DocTypeFunc();
                if (fnc.SaveDocType(para) == true)
                {
                    getDocTypeAllList();
                    ClearForm();
                    MessageBox.Show("บันทึกข้อมูลเรียบร้อย");
                    txtDocTypeCode.Focus();
                }
                else
                {
                    MessageBox.Show(fnc.ErrorMessage);
                    txtDocTypeCode.Focus();
                    txtDocTypeCode.SelectAll();
                }
            }
        }
Exemplo n.º 2
0
        private bool ValidateData()
        {
            bool ret = true;

            if (txtDocTypeCode.Text.Trim() == "") {
                ret = false;
                MessageBox.Show("กรุณาระบุรหัสเอกสาร");
                txtDocTypeCode.Focus();
            }else if(txtDocTypeCode.Text.Length != Func.Utilities.Config.DocTypeCodeLength){
                ret = false;
                MessageBox.Show("จำนวนหลักของรหัสเอกสารไม่ถูกต้อง");
                txtDocTypeCode.Focus();
                txtDocTypeCode.SelectAll();
            }
            else if (txtDoctypeName.Text.Trim() == "")
            {
                ret = false;
                MessageBox.Show("กรุณาระบุชื่อเอกสาร");
                txtDoctypeName.Focus();
            }
            else{
                DocTypePara para = new DocTypePara();
                para.ID = Convert.ToInt64(txtID.Text);
                para.DOCTYPE_CODE = txtDocTypeCode.Text.Trim();
                para.DOCTYPE_NAME = txtDoctypeName.Text.Trim();

                DocTypeFunc fnc = new DocTypeFunc();
                if (fnc.ChkDupData(para) == true) {
                    ret = false;
                    MessageBox.Show(fnc.InfoMessage);
                    txtDocTypeCode.Focus();
                    txtDocTypeCode.SelectAll();
                }
            }

            return ret;
        }
Exemplo n.º 3
0
 private void txtDocTypeCode_TextChanged(object sender, EventArgs e)
 {
     DocTypePara para = new DocTypePara();
     DocTypeFunc fnc = new DocTypeFunc();
     para = fnc.GetDocTypeByDocTypeCode(txtDocTypeCode.Text.Trim());
     txtDocTypeName.Text = para.DOCTYPE_NAME;
 }