Example #1
0
        private void Delete_button_Click(object sender, EventArgs e)
        {
            int position_Now = 0;

            try
            {
                position_Now = lessonsBindingSource.Position;
                position_Now = position_Now - 1;
                int deleted_id = ((DataSetCodeLab.LessonsRow)((DataRowView)lessonsBindingSource.Current).Row).ID;
                this.lessonsTableAdapter.UpdateLesson(LessonAr_textBox.Text, LessonEn_textBox.Text, (int)Lang_comboBox.SelectedValue, (int)Level_comboBox.SelectedValue, int.Parse(LessonNo_textBox.Text), true, deleted_id);
                ModuleClass.ShowMessage(null, "Deleted", Delete_button);
            }
            catch (Exception ex)
            {
                ModuleClass.ShowMessage(null, ex.Message, Delete_button);
                return;
            }
            LoadForm(true);
            try
            {
                lessonsBindingSource.Position = position_Now;
            }
            catch
            {
            }
        }
Example #2
0
        private void Delete_button_Click(object sender, EventArgs e)
        {
            int position_Now = 0;

            try
            {
                position_Now = languagesBindingSource.Position;
                position_Now = position_Now - 1;
                int deleted_id = ((DataSetCodeLab.LanguagesRow)((DataRowView)languagesBindingSource.Current).Row).ID;
                this.languagesTableAdapter.UpdateLanguage(LangAr_textBox.Text, LangEn_textBox.Text, true, deleted_id);
                ModuleClass.ShowMessage(null, "Deleted", Save_button);
            }
            catch (Exception ex)
            {
                ModuleClass.ShowMessage(null, ex.Message, Save_button);
                return;
            }
            LoadForm(true);
            try
            {
                languagesBindingSource.Position = position_Now;
            }
            catch
            {
            }
        }
Example #3
0
        private void Save_button_Click(object sender, EventArgs e)
        {
            int upated_id = 0;

            if (LangAr_textBox.Text.Trim() == "")
            {
                ModuleClass.ShowMessage(null, "Enter Value", LangAr_textBox);
                return;
            }
            if (LangEn_textBox.Text.Trim() == "")
            {
                ModuleClass.ShowMessage(null, "Enter Value", LangEn_textBox);
                return;
            }
            if (operation == 1)
            {
                try
                {
                    this.languagesTableAdapter.Insert(LangAr_textBox.Text, LangEn_textBox.Text, false);
                    ModuleClass.ShowMessage(null, "Saved", Save_button);
                    languagesBindingSource.MoveLast();
                }
                catch (Exception ex)
                {
                    ModuleClass.ShowMessage(null, ex.Message, Save_button);
                    return;
                }
            }
            else
            {
                upated_id = ((DataSetCodeLab.LanguagesRow)((DataRowView)languagesBindingSource.Current).Row).ID;
                try
                {
                    this.languagesTableAdapter.UpdateLanguage(LangAr_textBox.Text, LangEn_textBox.Text, false, upated_id);
                    ModuleClass.ShowMessage(null, "Updated", Save_button);
                }
                catch (Exception ex)
                {
                    ModuleClass.ShowMessage(null, ex.Message, Save_button);
                    return;
                }
            }
            int temp_operation = operation;

            LoadForm(true);
            if (temp_operation == 1)
            {
                languagesBindingSource.MoveLast();
            }
            else
            {
                languagesBindingSource.Position = languagesBindingSource.Find("ID", upated_id);
            }
        }
Example #4
0
        private void Save_button_Click(object sender, EventArgs e)
        {
            int upated_id = 0;

            if (LessonAr_textBox.Text.Trim() == "")
            {
                ModuleClass.ShowMessage(null, "Enter Value", LessonAr_textBox);
                return;
            }
            if (LessonEn_textBox.Text.Trim() == "")
            {
                ModuleClass.ShowMessage(null, "Enter Value", LessonEn_textBox);
                return;
            }
            int levelno = 0;

            try
            {
                levelno = int.Parse(LessonNo_textBox.Text);
            }
            catch
            {
                ModuleClass.ShowMessage(null, "Must Be Number", LessonNo_textBox);
            }
            if (levelno <= 0)
            {
                ModuleClass.ShowMessage(null, "Must Be Number More Than Zero", LessonNo_textBox);
            }
            int langid = 0;

            try
            {
                langid = (int)Lang_comboBox.SelectedValue;
            }
            catch
            {
            }
            int levelid = 0;

            try
            {
                levelid = (int)Level_comboBox.SelectedValue;
            }
            catch
            {
            }
            if (langid <= 0)
            {
                ModuleClass.ShowMessage(null, "Must Select Language", Lang_comboBox);
            }
            if (levelid <= 0)
            {
                ModuleClass.ShowMessage(null, "Must Select Level", Level_comboBox);
            }
            if (operation == 1)
            {
                try
                {
                    this.lessonsTableAdapter.Insert1(LessonAr_textBox.Text, LessonEn_textBox.Text, langid, levelid, levelno, false);
                    ModuleClass.ShowMessage(null, "Saved", Save_button);
                    lessonsBindingSource.MoveLast();
                }
                catch (Exception ex)
                {
                    ModuleClass.ShowMessage(null, ex.Message, Save_button);
                    return;
                }
            }
            else
            {
                upated_id = ((DataSetCodeLab.LessonsRow)((DataRowView)lessonsBindingSource.Current).Row).ID;
                try
                {
                    this.lessonsTableAdapter.UpdateLesson(LessonAr_textBox.Text, LessonEn_textBox.Text, langid, levelid, levelno, false, upated_id);
                    ModuleClass.ShowMessage(null, "Updated", Save_button);
                }
                catch (Exception ex)
                {
                    ModuleClass.ShowMessage(null, ex.Message, Save_button);
                    return;
                }
            }
            int temp_operation = operation;

            LoadForm(true);
            if (temp_operation == 1)
            {
                lessonsBindingSource.MoveLast();
            }
            else
            {
                lessonsBindingSource.Position = lessonsBindingSource.Find("ID", upated_id);
            }
        }