protected void AddUserBTN_Click(object sender, EventArgs e) { string ClassCode = ""; Dictionary <string, string> Classes = new Dictionary <string, string>(); ClassCode = ChooseClassDLL.SelectedValue; Subject s = new Subject(); string LessonsCode = s.GetSubjectCodeBySubjectName(ChooseLessonsDLL.SelectedValue); string date = DateTime.Today.ToShortDateString(); string TeacherId = Request.Cookies["UserID"].Value; HomeWork HW = new HomeWork(); Users u = new Users(); string day = DDLday.SelectedValue, month = DDLmonth.SelectedValue, year = DDLyear.SelectedValue; string Bday = day + "/" + month + "/" + year; if (day == "יום" || month == "חודש" || year == "שנה") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('תאריך לא יכול להיות ריק');", true); return; } else if (!u.IsLegalBday(day, month)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('תאריך לא חוקי');", true); return; } int res1 = HW.InserHomeWork(LessonsCode, HomeWorkDesc.Text, TeacherId, ClassCode, Bday, ChangeHagashaCB.Checked); if (res1 == 1) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('שיעורי בית נוספו בהצלחה'); location.href='THomeWorkInsert.aspx';", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('הייתה בעיה בהוספת שיעורי בית, בדוק נתונים');", true); } }