示例#1
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                if (languageValidation.validateLanguage(txtLanguageCreate.Text.Trim()))
                {
                    language._Language = txtLanguageCreate.Text;
                    language.InsBy     = FormLoggedUser.Id;

                    int error = languageBLL.Add(language);
                    if (error == 0)
                    {
                        MessageBox.Show("This Language is created succesfully!");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Language could not be inserted!");
                    }
                }
                else
                {
                    throw new FormatException();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
        private void BtnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                if (langValidate.validateLanguage(txtInsert.Text.Trim()))
                {
                    lang._Language = txtInsert.Text;
                    lang.InsBy     = 80;//FormLoggedUser.Id;

                    int error = langbll.Add(lang);
                    if (error == 0)
                    {
                        this.Close();
                    }

                    else if (error == 1)
                    {
                        MessageBox.Show("Genre name  should be uniqe, please if this material type is deactivated update it");
                    }
                }
                else
                {
                    throw new FormatException();
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Genre is not valid");
            }
            catch (Exception)
            {
                MessageBox.Show("Genre is not inserted please contact your administrator");
            }
        }