Ejemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (key == "" || textBoxKey.Text == "")
            {
                MessageBox.Show("Cập nhật thất bại, vui lòng thử lại\n An error has occured, please try again");
                return;
            }
            if (btnUpdate.Text == "Update")
            {
                DictionaryDTO.EN_VN_Word w = new DictionaryDTO.EN_VN_Word();

                w.ENKey          = textBoxKey.Text;
                w.Pronounciation = textBoxPronunciation.Text;
                w.WordType       = textBoxWordType.Text;
                w.Means          = textBoxMean.Text;
                w.Example        = textBoxExample.Text;

                EVDict.updateWord(key, w);
                MessageBox.Show("Update word successfully");
            }
            else
            {
                DictionaryDTO.VN_EN_Word w = new DictionaryDTO.VN_EN_Word();

                w.VNKey        = textBoxKey.Text;
                w.VNSuggestion = textBoxPronunciation.Text;
                w.WordType     = textBoxWordType.Text;
                w.Means        = textBoxMean.Text;
                w.Example      = textBoxExample.Text;

                VEDict.updateWord(key, w);
                MessageBox.Show("Cập nhật thành công");
            }
        }
Ejemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (textBoxKey.Text == "" || textBoxMean.Text == "" || textBoxWordType.Text == "")
            {
                if (ktSwitch)
                {
                    MessageBox.Show("Vui lòng điền đầy đủ các trường cần thiết (từ vựng, nghĩa, từ loại)");
                }
                else
                {
                    MessageBox.Show("Please insert text in all required fields (key, meaning, wordtype)");
                }
                return;
            }

            if (ktSwitch)
            {
                if (VEDict.searchWord(textBoxKey.Text) != null)
                {
                    MessageBox.Show("Từ này đã có trong từ điển!");
                    return;
                }
                DictionaryDTO.VN_EN_Word w = new DictionaryDTO.VN_EN_Word();

                w.VNKey        = textBoxKey.Text;
                w.VNSuggestion = textBoxPronunciation.Text;
                w.WordType     = textBoxWordType.Text;
                w.Means        = textBoxMean.Text;
                w.Example      = textBoxExample.Text;

                VEDict.addWord(w);
                btnClear_Click(null, null);
                MessageBox.Show("Thêm từ mới thành công");
            }
            else
            {
                if (EVDict.searchWord(textBoxKey.Text) != null)
                {
                    MessageBox.Show("This word is already in the dictionary!");
                    return;
                }
                DictionaryDTO.EN_VN_Word w = new DictionaryDTO.EN_VN_Word();

                w.ENKey          = textBoxKey.Text;
                w.Pronounciation = textBoxPronunciation.Text;
                w.WordType       = textBoxWordType.Text;
                w.Means          = textBoxMean.Text;
                w.Example        = textBoxExample.Text;

                EVDict.addWord(w);
                btnClear_Click(null, null);
                MessageBox.Show("Added new word successfully");
            }
        }
Ejemplo n.º 3
0
 private void buttonSearch_Click(object sender, EventArgs e)
 {
     if (ktSwitch)
     {
         currentVEWord = VEDict.searchWord(textboxSearch.Text);
     }
     else
     {
         currentEVWord = EVDict.searchWord(textboxSearch.Text);
     }
     btnUpdateWord_Click(btnUpdateWord, null);
 }
Ejemplo n.º 4
0
        public UpdateWordForm(DictionaryDTO.VN_EN_Word w)
        {
            InitializeComponent();
            key = w.VNKey;

            textBoxKey.Text           = w.VNKey;
            textBoxPronunciation.Text = w.VNSuggestion;
            textBoxWordType.Text      = w.WordType;
            textBoxMean.Text          = w.Means;
            textBoxExample.Text       = w.Example;

            btnUpdate.Text = "Cập nhật";
        }