protected void btnAddStu_onClick(object sender, EventArgs e) { string stuId = ddlSearch.SelectedValue.ToString(); double selectedStuId = Convert.ToDouble(stuId); int lessID = Convert.ToInt32(Session["selectedLessonNum"]); DateTime lesDate = Convert.ToDateTime(Session["selectedLessonDate"]); string dateFormat = lesDate.ToString("yyyy-MM-dd"); ActualLesson acl = new ActualLesson(); SignedToLesson stl; int studentsNum = Convert.ToInt32(Session["studentsNumber"]); int actual_quan = studentsNum + 1; try { stl = new SignedToLesson(lessID, dateFormat, selectedStuId); int numEffected3 = acl.updateSpecificActualLesson(lessID, dateFormat, actual_quan); //הגדלת כמות משתתפים ב-1 int numEffected2 = stl.InsertSigendToLesson(); //הכנסת התלמיד לטבלת "רשום לתגבור" Server.TransferRequest(Request.Url.AbsolutePath, false); } catch (Exception ex) { Response.Write("There was an error " + ex.Message); } }
protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { //string tea_name = (string)(Session["teaNme"]); //string proffesion = (string)(Session["proffesion"]); //string lessDate = (string)(Session["lessDate"]); //int lessDay = Convert.ToInt32(Session["lessDay"]); //string lessHour = (string)(Session["lessHour"]); string tea_name = (string)(Session["selectedLessonTeacher"]); string proffesion = (string)(Session["selectedLessonProf"]); string lessDate = (string)(Session["selectedLessonDate"]); int lessDay = Convert.ToInt32(Session["selectedLessonDay"]); string lessHour = (string)(Session["selectedLessonHour"]); int lessID = Convert.ToInt32(Session["selectedLessonNum"]); teacherLBL.Text = "שם המתגבר: " + tea_name; profssionLBL.Text = proffesion; dateLBL.Text = lessDate; DayLBL.Text = "יום " + Convert.ToString(lessDay); hourLBL.Text = "שעה: " + lessHour; DateTime date_less = Convert.ToDateTime(lessDate); SignedToLesson stl = new SignedToLesson(); DataTable dt = stl.readStudentsList(lessID, date_less); //DataTable studentsDT = new DataTable(); foreach (DataRow dr in dt.Rows) { Student s = new Student(); double Stu_id = Convert.ToDouble(dr["StLes_stuId"]); DataTable dt2 = s.readSpecipicStudent(Stu_id); foreach (DataRow dr2 in dt2.Rows) { string stuFirstlName = (string)(dr2["stu_firstName"]); string stuLastlName = (string)(dr2["stu_lastName"]); string stuFullName = stuFirstlName + " " + stuLastlName; //studentsDT.Rows.Add(stuFullName); Label lbl = new Label(); lbl.Text = stuFullName; CheckBox cb = new CheckBox(); cb.Checked = true; TextBox tb = new TextBox(); //tb.placeholder = "הערות..."; PlaceHolder1.Controls.Add(cb); PlaceHolder1.Controls.Add(lbl); PlaceHolder1.Controls.Add(new LiteralControl("   ")); PlaceHolder1.Controls.Add(tb); PlaceHolder1.Controls.Add(new LiteralControl("<br/>")); } } } }
protected void ApproveButton_Click(object sender, EventArgs e) { Request req = new Request(); GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent; int index = gvRow.RowIndex; int req_num = Convert.ToInt32(gvRow.Cells[1].Text); int status = 1; int numEffected = req.updateSpecificRequest(req_num, status); int req_type = 1; string req_typeName = gvRow.Cells[15].Text; if (req_typeName != "ביטול השתתפות") { req_type = 0; } ActualLesson acl = new ActualLesson(); SignedToLesson stl; double stuId = Convert.ToDouble(gvRow.Cells[3].Text); int lesId = Convert.ToInt32(gvRow.Cells[14].Text); DateTime tmpDate = Convert.ToDateTime(gvRow.Cells[7].Text); string lesDate = tmpDate.ToString("yyyy-MM-dd"); if (req_type != 1) //אם זו בקשה להרשמה (זו לא בקשה לביטול השתתפות) { try { stl = new SignedToLesson(lesId, lesDate, stuId); } catch (Exception ex) { Response.Write("illegal values to the SignedToLesson attributes - error message is " + ex.Message); return; } int actual_quan = Convert.ToInt32(gvRow.Cells[11].Text) + 1; try { int numEffected3 = acl.updateSpecificActualLesson(lesId, lesDate, actual_quan); //הגדלת כמות משתתפים ב-1 int numEffected2 = stl.InsertSigendToLesson(); //הכנסת התלמיד לטבלת "רשום לתגבור" Server.TransferRequest(Request.Url.AbsolutePath, false); } catch (Exception ex) { Response.Write("There was an error " + ex.Message); } } }
protected void cancelButton_Click(object sender, EventArgs e) { GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent; int cancelled = 1; ActualLesson acl = new ActualLesson(); SignedToLesson stl = new SignedToLesson(); int lesId = Convert.ToInt32(gvRow.Cells[1].Text); DateTime tmpDate = Convert.ToDateTime(gvRow.Cells[3].Text); string lesDate = tmpDate.ToString("yyyy-MM-dd"); Request stuReq = new Request(); string proff = gvRow.Cells[2].Text; string start = gvRow.Cells[4].Text; Session["cancelledLesId"] = lesId; Session["cancelledLesDate"] = lesDate; string lesDateMES = tmpDate.ToString("dd-MM-yyyy"); Manager m = (Manager)(Session["manUserSession"]); double manID = m.Man_id; DataTable dt = this.GetStudents(); string currnetDate = DateTime.Now.ToString("yyyy-MM-dd"); Messages mes; string mesContent = "תלמיד יקר, שיעור " + proff + " שחל בתאריך " + lesDateMES + " ובשעה " + start + " בוטל."; foreach (DataRow dr in dt.Rows) { double stuID = Convert.ToDouble(dr["StLes_stuId"]); mes = new Messages(manID, stuID, "ביטול שיעור", mesContent, false, currnetDate); int NumEffected = mes.InsertMessage(); } DataTable teaIDtable = this.GetTeaId(); double teaID = Convert.ToDouble(teaIDtable.Rows[0]["Les_Tea_Id"]); string mesToTeaContent = "מתגבר יקר, שיעור " + proff + " שחל בתאריך " + lesDateMES + " ובשעה " + start + " בוטל."; Messages TeaMes = new Messages(manID, teaID, "ביטול שיעור", mesToTeaContent, false, currnetDate); int numEffected1 = TeaMes.InsertMessageFromManagerToTeacher(); try { int numEffected2 = acl.cancelSpecificActualLesson(lesId, lesDate, cancelled); //עדכון שהתגבור בוטל int numEffected3 = stl.deleteStudentsFromLesson(lesId, lesDate); //מחיקת התלמידים שמשתתפים בתגבור זה בטבלת "רשום לתגבור" int numEffected4 = stuReq.deleteCancelldLessonRequests(lesId, lesDate); //מחיקת כל הבקשות להרשמה לתגבור זה Server.TransferRequest(Request.Url.AbsolutePath, false); } catch (Exception ex) { Response.Write("illegal values to the SignedToLesson attributes - error message is " + ex.Message); return; } }
public void delBTNButton_Click(Object sender, EventArgs e) { SignedToLesson stl = new SignedToLesson(); Button button = (Button)sender; string buttonId = button.ID; string stuId = buttonId.Substring(6); int delStuId = Convert.ToInt32(stuId); string lessDate = (Session["selectedLessonDate"]).ToString(); DateTime lesDate = Convert.ToDateTime(lessDate); int lesId = (int)(Session["selectedLessonNum"]); int numEff = stl.deleteStudentFromLesson(delStuId, lesId, lesDate.ToString("yyyy-MM-dd")); ActualLesson actl = new ActualLesson(); int quan = (int)Session["studentsNumber"] - 1; int numEf = actl.updateSpecificActualLesson(lesId, lesDate.ToString("yyyy-MM-dd"), quan); Server.TransferRequest(Request.Url.AbsolutePath, false); }
protected void ApproveButton_Click(object sender, EventArgs e) { teachersRequests req = new teachersRequests(); GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent; int index = gvRow.RowIndex; int req_num = Convert.ToInt32(gvRow.Cells[1].Text); int status = 1; int cancelled = 1; ActualLesson acl = new ActualLesson(); SignedToLesson stl = new SignedToLesson(); int lesId = Convert.ToInt32(gvRow.Cells[2].Text); DateTime tmpDate = Convert.ToDateTime(gvRow.Cells[3].Text); string lesDate = tmpDate.ToString("yyyy-MM-dd"); Request stuReq = new Request(); string proff = gvRow.Cells[4].Text; string start = gvRow.Cells[6].Text; Session["cancelledLesId"] = lesId; Session["cancelledLesDate"] = lesDate; string lesDateMES = tmpDate.ToString("dd-MM-yyyy"); Manager m = (Manager)(Session["manUserSession"]); double manID = m.Man_id; DataTable dt = this.GetStudents(); string currnetDate = DateTime.Now.ToString("yyyy-MM-dd"); Messages mes; DataTable teaIDtable = this.GetTeaId(); double teaID = Convert.ToDouble(teaIDtable.Rows[0]["Les_Tea_Id"]); string mesToTeaContent = "מתגבר יקר, בקשתך לביטול שיעור " + proff + " שחל בתאריך " + lesDateMES + " ובשעה " + start + " אושרה והתגבור בוטל."; // Messages TeaMes = new Messages(manID, teaID, "ביטול שיעור", mesToTeaContent, false, currnetDate); Messages TeaMes = new Messages(); TeaMes.Msg_fromManagerId = manID; TeaMes.Msg_toTeacherId = teaID; TeaMes.Msg_subject = "ביטול שיעור"; TeaMes.Msg_content = mesToTeaContent; TeaMes.Msg_hasRead = false; TeaMes.Msg_date = currnetDate; int numEffected1 = TeaMes.InsertMessageFromManagerToTeacher(); string mesContent = "תלמיד יקר, שיעור " + proff + " שחל בתאריך " + lesDateMES + " ובשעה " + start + " בוטל."; foreach (DataRow dr in dt.Rows) { double stuID = Convert.ToDouble(dr["StLes_stuId"]); mes = new Messages(manID, stuID, "ביטול שיעור", mesContent, false, currnetDate); int NumEffected = mes.InsertMessage(); } try { int numEffected = req.updateSpecificTeacherRequest(req_num, status); int numEffected2 = acl.cancelSpecificActualLesson(lesId, lesDate, cancelled); int numEffected3 = stl.deleteStudentsFromLesson(lesId, lesDate); int numEffected4 = stuReq.deleteCancelldLessonRequests(lesId, lesDate); Server.TransferRequest(Request.Url.AbsolutePath, false); } catch (Exception ex) { Response.Write("illegal values to the SignedToLesson attributes - error message is " + ex.Message); return; } }
public void updateInDB(double id, int updateIsEntitledTo) { int countOfmissingForStudent; Student stud = new Student(); if (Convert.ToBoolean(Session["transferBack"]) == true) { try { DataTable dt = stud.readSpecipicStudent(id); foreach (DataRow row in dt.Rows) { countOfmissingForStudent = Convert.ToInt32(row["stu_counter"]); if (countOfmissingForStudent == 5) { stud.updateStu_CounterToZero(id); } } } catch (Exception ex) { Response.Write("There was an error when trying to update stu_counter in the database" + ex.Message); } try { int numEffected = stud.updateIsEntittled(id, updateIsEntitledTo); } catch (Exception ex) { Response.Write("There was an error when trying to update stu_isEntitled in the database" + ex.Message); } } else { try { int numEffected = stud.updateIsEntittled(id, updateIsEntitledTo); Request req = new Request(); int numEf = req.deleteRequests(id); // מחיקת כל הבקשות שלו להרשמה לתגבורים שעוד לא עברו SignedToLesson delStu = new SignedToLesson(); Session["entStu"] = id; //נביא את כל התגבורים שבהם התלמיד משתתף ותאריך התגבור עוד לא עבר ונמחק את התלממיד מתגבורים אלה DataTable classesForStuIdDT = this.GetClassForStu(); foreach (DataRow ro in classesForStuIdDT.Rows) { DateTime dat = (DateTime)(ro["StLes_ActLesDate"]); if (dat >= DateTime.Now) { string da = dat.ToString("yyyy-MM-dd"); int lesNum = Convert.ToInt32(ro["StLes_ActLesId"]); int numEf1 = delStu.deleteStudentFromLesson(id, lesNum, da); ActualLesson actls = new ActualLesson(); int numEfc = actls.reduceQuan(lesNum, da); } } } catch (Exception ex) { Response.Write("There was an error when trying to update stu_isEntitled in the database" + ex.Message); } } }
protected void ApproveButton_Click(object sender, EventArgs e) { Session["flgSendReq"] = "1"; Request req = new Request(); GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent; int req_num = Convert.ToInt32(gvRow.Cells[1].Text); ActualLesson acl = new ActualLesson(); SignedToLesson stl; double stuId = Convert.ToDouble(gvRow.Cells[3].Text); int lesId = Convert.ToInt32(gvRow.Cells[5].Text); DateTime tmpDate = Convert.ToDateTime(gvRow.Cells[7].Text); string lesDate = tmpDate.ToString("yyyy-MM-dd"); int req_type = 1; string req_typeName = gvRow.Cells[2].Text; if (req_typeName != "ביטול השתתפות") { req_type = 0; } else //נאשר בקשה לביטול השתתפות- נשנה סטטוס בקשה ל-1 { int status = 1; int numEffected = req.updateSpecificRequest(req_num, status); try { stl = new SignedToLesson(lesId, lesDate, stuId); } catch (Exception ex) { Response.Write("illegal values to the SignedToLesson attributes - error message is " + ex.Message); return; } int actual_quan = Convert.ToInt32(gvRow.Cells[13].Text) - 1; try { int numEffected3 = acl.updateSpecificActualLesson(lesId, lesDate, actual_quan); //הקטנת כמות משתתפים ב-1 int numEffected2 = stl.deleteStudentFromLesson(stuId, lesId, lesDate); //הוצאת התלמיד מטבלת "רשום לתגבור" Server.TransferRequest(Request.Url.AbsolutePath, false); } catch (Exception ex) { Response.Write("There was an error " + ex.Message); } } int flg = 0; //מסמן שאין התנגשות בין תגבור מבוקש לבין תגבור אחר כלשהו שהתלמיד משובץ אליו DataTable checkTable = new DataTable(); checkTable.Columns.Add("flg", typeof(int)); //מסמן אם ניתן להוסיף תגבור או לא- 1 ניתן 0 לא ניתן if (req_type != 1) //אם זו בקשה להרשמה (זו לא בקשה לביטול השתתפות) { //ניקח את שעות התגבור המבוקש ע"מ לראות אם באותם שעות בתאריך התגבור, התלמיד משובץ לתגבור אחר DateTime reqLesStart = DateTime.Parse((gvRow.Cells[9].Text).ToString()); DateTime reqLesEnd = DateTime.Parse((gvRow.Cells[10].Text).ToString()); Session["reqStuId"] = stuId; Session["reqLesDate"] = lesDate; //נביא את כל התגבורים (תאריך+שעת התחלה+שעת סיום+מס תגבור) עבור מתגבר זה DataTable DTclassForReqStuId = this.GetClassForReqStuId(); if (DTclassForReqStuId.Rows.Count > 0)//המשמעות שהתלמיד המבקש משובץ לתגבורים אחרים בתאריך המבוקש- נבדוק התנגשות בשעות { foreach (DataRow dr in DTclassForReqStuId.Rows) { //אם יש לו תגבור באותו יום, אבל התגבור הנבחר מתחיל ומסתיים לפני התגבורים אחרים שיש לו באותו יום- ניתן לשבץ if (reqLesStart < DateTime.Parse((dr["Les_StartHour"]).ToString()) && reqLesEnd <= DateTime.Parse((dr["Les_StartHour"]).ToString())) { DataRow newRow = checkTable.NewRow(); // Set values in the columnn: newRow["flg"] = 1; // Add the row to the rows collection. checkTable.Rows.Add(newRow); } //אם יש לו תגבור באותו יום, אבל התגבור הנבחר מתחיל אחרי שהתגבורים אחרים שיש לו באותו יום כבר התחילו והסתיימו- ניתן לשבץ else if (reqLesStart > DateTime.Parse((dr["Les_StartHour"]).ToString()) && reqLesStart >= DateTime.Parse((dr["Les_EndHour"]).ToString())) { DataRow newRow = checkTable.NewRow(); // Set values in the column newRow["flg"] = 1; // Add the row to the rows collection. checkTable.Rows.Add(newRow); } else //כל מצב אחר המשמעות שיש תגבור לתלמיד באותו התאריך וגם השעות מתנגשות { DataRow newRow = checkTable.NewRow(); // Set values in the column newRow["flg"] = 0; // Add the row to the rows collection. checkTable.Rows.Add(newRow); } } } if (checkTable.Rows.Count > 0) { foreach (DataRow dr in checkTable.Rows) { if (Convert.ToInt32(dr["flg"]) != 1) { flg = 1; break;//מספיק שלפחות אחד מהתגבורים בתאריך זה מתנגש עם שעות התגבור הנבחר } } } if (flg == 0) //אין התנגשות, אז נבדוק האם יש מקום בתגבור ואם כן נאשר { if (Convert.ToInt32(gvRow.Cells[13].Text) < (Convert.ToInt32(gvRow.Cells[12].Text))) //אם יש מקום בתגבור הבקשה תאושר והתלמיד נרשם לתגבור { int status = 1; int numEffected = req.updateSpecificRequest(req_num, status); try { stl = new SignedToLesson(lesId, lesDate, stuId); } catch (Exception ex) { Response.Write("illegal values to the SignedToLesson attributes - error message is " + ex.Message); return; } int actual_quan = Convert.ToInt32(gvRow.Cells[13].Text) + 1; try { int numEffected3 = acl.updateSpecificActualLesson(lesId, lesDate, actual_quan); //הגדלת כמות משתתפים ב-1 int numEffected2 = stl.InsertSigendToLesson(); //הכנסת התלמיד לטבלת "רשום לתגבור" Server.TransferRequest(Request.Url.AbsolutePath, false); } catch (Exception ex) { Response.Write("There was an error " + ex.Message); } } } else //התלמיד משובץ כבר לתגבור אחר שמתנגש עם התגבור המבוקש- נדחה את הבקשה עם סיבת דחייה לתלמיד ואלרט למנהלת { int status = 0; int Decliend = 1; int numEffected = req.updateSpecificRequest(req_num, status); //נעדכן שהבקשה נדחתה int numEffected4 = req.updateReqDecliendField(req_num, Decliend); //נעדכן שהסיבה לדחיית הבקשה היא "אילוץ" ההתנגשות string proffTitle = gvRow.Cells[6].Text; string start = gvRow.Cells[9].Text; string LesDateFormat = tmpDate.ToString("dd/MM/yyyy"); string currnetDate = DateTime.Now.ToString("yyyy-MM-dd"); Messages mes; Manager m = (Manager)(Session["manUserSession"]); double manID = m.Man_id; string mesContent = "תלמיד יקר, שיעור " + proffTitle + " שחל בתאריך " + LesDateFormat + ", בשעה " + reqLesStart.ToString("HH:mm") + " מתנגש עם תגבור אחר שאתה משובץ אליו בתאריך זה"; mes = new Messages(manID, stuId, "בקשתך להירשם לתגבור נדחתה", mesContent, false, currnetDate); int NumEffected = mes.InsertMessage(); Session["declineReq"] = true; Server.TransferRequest(Request.Url.AbsolutePath, false); } } }
protected void updateForm_Click(object sender, EventArgs e) { int lessID = Convert.ToInt32(Session["selectedLessonNum"]); string lesDate = (string)(Session["selectedLessonDate"]); DateTime lessDate = Convert.ToDateTime(lesDate); DataTable dt = (DataTable)(Session["studentsList"]); foreach (DataRow dr in dt.Rows) { double Stu_id = Convert.ToDouble(dr["StLes_stuId"]); CheckBox cb = (CheckBox)PlaceHolder1.FindControl("cb" + Stu_id.ToString()); if (cb != null) { if (cb.Checked == false) { int stuPresence = 0; SignedToLesson stl = new SignedToLesson(); stl.updateStudentPresence(lessID, lessDate, Stu_id, stuPresence); Student stud = new Student(); stud.updateStudentCounter(Stu_id); DataTable dtCounter = stud.getStudentCounter(Stu_id); DataTable manDT = this.GetManeger(); foreach (DataRow drMan in manDT.Rows) { double msg_toManagerId = Convert.ToDouble(drMan["Man_Id"]); Session["msg_toManagerId"] = msg_toManagerId; } bool msg_has_read = false; DateTime msg_date = DateTime.Now; foreach (DataRow d in dtCounter.Rows) { if (Convert.ToInt32(d[0]) == 5)//להכניס את התלמיד לרשימת הלא זכאים { int updateIsEntitledTo = 0; string currnetDate = DateTime.Now.ToString("yyyy-MM-dd"); Messages mes; double msg_ManagerId = Convert.ToDouble(Session["msg_toManagerId"]); string mesContent = "תלמיד יקר, עקב אי הגעתך לתגבורים אינך זכאי להגיש בקשות. אנא פנה למנהל/ת"; mes = new Messages(msg_ManagerId, Stu_id, "עדכון זכאות לתגבורים", mesContent, false, currnetDate); Messages messageForStudent = new Messages(); messageForStudent.Msg_fromStudentId = Stu_id; messageForStudent.Msg_toManagerId = msg_ManagerId; messageForStudent.Msg_subject = "עדכון זכאות- הודעת מערכת"; messageForStudent.Msg_content = " זוהי הודעה אוטומטית: המערכת הכניסה את תלמיד זה לרשימת הלא זכאים, עקב אי הגעתו לתגבורים. באפשרותך להוציא אותו מהרשימה"; messageForStudent.Msg_hasRead = msg_has_read; messageForStudent.System_msg = 1; messageForStudent.Msg_date = msg_date.ToString("yyyy-MM-dd"); string date = lessDate.ToString("yyyy-MM-dd"); Session["entStu"] = Stu_id; try { Request req = new Request(); int numEf = req.deleteRequests(Stu_id); // מחיקת כל הבקשות שלו להרשמה לתגבורים שעוד לא עברו int numEffected = stud.updateIsEntittled(Stu_id, updateIsEntitledTo); int NumEffected2 = mes.InsertMessage(); int numEffected11 = messageForStudent.InsertMessageSystemStudent(); SignedToLesson delStu = new SignedToLesson(); //int numEf1 = delStu.deleteStudentFromLesson(Stu_id, lessID, date); //נביא את כל התגבורים שבהם התלמיד משתתף ותאריך התגבור עוד לא עבר ונמחק את התלממיד מתגבורים אלה DataTable classesForStuIdDT = this.GetClassForStu(); foreach (DataRow ro in classesForStuIdDT.Rows) { DateTime dat = (DateTime)(ro["StLes_ActLesDate"]); if (dat >= DateTime.Now) { string da = dat.ToString("yyyy-MM-dd"); int lesNum = Convert.ToInt32(ro["StLes_ActLesId"]); int numEf1 = delStu.deleteStudentFromLesson(Stu_id, lesNum, da); ActualLesson actl = new ActualLesson(); int quan = actl.readSpecificActualLessonQuan(lesNum, da) - 1; int numEfc = actl.updateSpecificActualLesson(lesNum, da, quan); } } } catch (Exception ex) { Response.Write("There was an error when trying to insert the product into the database" + ex.Message); } } } } else { int stuPresence = 1; SignedToLesson stl = new SignedToLesson(); stl.updateStudentPresence(lessID, lessDate, Stu_id, stuPresence); } } TextBox tb = (TextBox)PlaceHolder1.FindControl("tb" + Stu_id.ToString()); if (tb != null) { string stuNotes = tb.Text; SignedToLesson stl = new SignedToLesson(); stl.updateStudentNotes(lessID, lessDate, Stu_id, stuNotes); } Session["updateForm"] = true; } Response.Redirect("ClassesForTeacher.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["selectedLessonNum"] == null) { Response.Redirect("ClassesForTeacher.aspx"); } { Button butt = new Button(); butt.ID = "sendForm"; if (Convert.ToInt32(Session["flg"]) == 1) { //addStuTB.Visible = true; butt.Text = "שלח טופס"; butt.Click += sendForm_Click; butt.CssClass = "btn btn-sm btn-primary margin-top20"; } else { //addStuTB.Visible = false; butt.Text = "עדכן טופס"; butt.Click += updateForm_Click; butt.CssClass = "btn btn-sm btn-primary margin-top20"; } PlaceHolder2.Controls.Add(butt); string tea_name = (string)(Session["selectedLessonTeacher"]); string proffesion = (string)(Session["selectedLessonProf"]); string lessDate = (string)(Session["selectedLessonDate"]); string lessDay = Convert.ToString(Session["selectedLessonDay"]); if (lessDay == "1") { lessDay = "ראשון"; } else if (lessDay == "2") { lessDay = "שני"; } else if (lessDay == "3") { lessDay = "שלישי"; } else if (lessDay == "4") { lessDay = "רביעי"; } else { lessDay = "חמישי"; } string lessHour = (string)(Session["selectedLessonHour"]); lessHour = lessHour.Substring(0, lessHour.Length - 3); int lessID = Convert.ToInt32(Session["selectedLessonNum"]); teacherLBL.Text = "<b>מתגבר : </b> " + tea_name; profssionLBL.Text = "<b>מקצוע : </b>" + proffesion; dateLBL.Text = "<b>תאריך : </b> " + lessDate; DayLBL.Text = "<b>יום </b>" + lessDay; hourLBL.Text = "<b>בשעה </b> " + lessHour; DateTime date_less = Convert.ToDateTime(lessDate); SignedToLesson stl = new SignedToLesson(); DataTable dt = stl.readStudentsList(lessID, date_less); Session["studentsList"] = dt; //DataTable studentsDT = new DataTable(); Session["studentsNumber"] = dt.Rows.Count; int counter = 1; foreach (DataRow dr in dt.Rows) { Student s = new Student(); double Stu_id = Convert.ToDouble(dr["StLes_stuId"]); DataTable dt2 = s.readSpecipicStudent(Stu_id); int Presence = Convert.ToInt32(dr["Presence"]); string comments = Convert.ToString(dr["comments"]); foreach (DataRow dr2 in dt2.Rows) { string stuFirstlName = (string)(dr2["stu_firstName"]); string stuLastlName = (string)(dr2["stu_lastName"]); string stuFullName = stuFirstlName + " " + stuLastlName; //studentsDT.Rows.Add(stuFullName); Label lbl = new Label(); lbl.Text = stuFullName; CheckBox cb = new CheckBox(); cb.ID = "cb" + Convert.ToString(Stu_id); cb.CssClass = "regular-checkbox"; TextBox tb = new TextBox(); tb.ID = "tb" + Convert.ToString(Stu_id); tb.CssClass = "comment_box"; tb.Attributes.Add("placeholder", "הוסף הערה לתלמיד.."); Button delBTN = new Button(); delBTN.ID = "delBTN" + Convert.ToString(Stu_id); delBTN.Text = "מחק תלמיד"; delBTN.ToolTip = "מחיקת התלמיד מתגבור זה"; delBTN.CssClass = "btn btn-danger btn-sm"; delBTN.Click += delBTNButton_Click; if (Presence == 1) { cb.Checked = true; } else { cb.Checked = false; } if (comments != null) { tb.Text = comments; } //tb.placeholder = "הערות..."; PlaceHolder1.Controls.Add(new LiteralControl("<tr>")); PlaceHolder1.Controls.Add(new LiteralControl("<td class='presenceCB'>")); PlaceHolder1.Controls.Add(cb); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); PlaceHolder1.Controls.Add(new LiteralControl("<td>")); PlaceHolder1.Controls.Add(new LiteralControl(counter + ". ")); PlaceHolder1.Controls.Add(lbl); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); PlaceHolder1.Controls.Add(new LiteralControl("<td>")); PlaceHolder1.Controls.Add(tb); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); PlaceHolder1.Controls.Add(new LiteralControl("<td>")); PlaceHolder1.Controls.Add(delBTN); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); PlaceHolder1.Controls.Add(new LiteralControl("</tr>")); counter++; } } } if (!IsPostBack) { GetAllStudents(); } }