Exemplo n.º 1
0
    protected void AddLessonsBTN_Click(object sender, EventArgs e)
    {
        Subject newS       = new Subject();
        string  newSubject = LessonsNameTB.Text;

        if (newS.IsExists(newSubject))
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('המקצוע כבר קיים ברשימת המקצועות.');", true);
            return;
        }
        else if (newSubject == "")
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('לא הוזן מקצוע.');", true);
            return;
        }
        else
        {
            int answer = newS.AddNewSubject(newSubject);
            if (answer > 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('המקצוע נוסף בהצלחה') ; location.href='AAddLessons.aspx';", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('עקב תקלה לא ניתן להוסיף מקצוע זה.<br/> אנא נסה מאוחר יותר. במידה והתקלה נמשכת אנא פנה לשירות הלקוחות.');", true);
            }
        }
    }