private void loadSssions() { try { if (Session["LGIDforNewSession"] != null) { var today = DateTime.Now; id = Convert.ToInt32(Session["LGIDforNewSession"].ToString()); SessionRepository Sesrep = new SessionRepository(); SessionNumber.Text = Sesrep.CountSessionsByLGID(id); vLessonGroupRepository vLesRep = new vLessonGroupRepository(); var lessonGroup = vLesRep.FindByLGID(id); ClassNumber.Text = lessonGroup.Class; LessonName.Text = lessonGroup.LessonTitle; Grade.Text = vLesRep.FindByLGID(id).GradeTitle; OzviatRepository ozviatRep = new OzviatRepository(); StudentCount.Text = ozviatRep.StudentCountByLGID(id); gvStudents.DataSource = ozviatRep.FindByLGID(id); gvStudents.DataBind(); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Teacher/News.aspx'", true); } } catch (Exception) { throw; } }
protected void gvSelectedStudents_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Details") { // Retrieve the row index stored in the // CommandArgument property. int index = Convert.ToInt32(e.CommandArgument); // Retrieve the row that contains the button // from the Rows collection. GridViewRow row = gvSelectedStudents.Rows[index]; //Response.Redirect("http://*****:*****@"<script type='text/javascript'>"); sb.Append("$('#modalShowDetails').modal('show');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModalScript", sb.ToString(), false); } } if (e.CommandName == "Delet") { // Retrieve the row index stored in the // CommandArgument property. int index = Convert.ToInt32(e.CommandArgument); // Retrieve the row that contains the button // from the Rows collection. GridViewRow row = gvSelectedStudents.Rows[index]; string id = row.Cells[0].Text; OzviatRepository rep = new OzviatRepository(); rep.DeleteOzviat(id.ToInt()); LoadSelectedStudents(); LoadStudents(); } }
public void loadLessonGroup() { if (Session["LGIDforStudentsFromClassManagment"] != null) { string id = Session["LGIDforStudentsFromClassManagment"].ToString(); Session.Remove("LGIDforStudentsFromClassManagment"); OzviatRepository rep = new OzviatRepository(); gvClassStudents.DataSource = rep.FindByLGID(id.ToInt()); gvClassStudents.DataBind(); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Teacher/News.aspx'", true); } }
public void setLabel() { vReportExamsRepository v = new vReportExamsRepository(); string id = Request.QueryString["LGID"]; lblmianginkatbi.InnerText = Convert.ToDouble(v.getAverageLessonGroup(id.ToInt(), 0)).ToString(); lblmianginshafahi.InnerText = Convert.ToDouble(v.getAverageLessonGroup(id.ToInt(), 1)).ToString(); lblKatbiExamCount.InnerText = v.ExamCountByLGID(id.ToInt(), 0).ToString(); lblShafahiExamCount.InnerText = v.ExamCountByLGID(id.ToInt(), 1).ToString(); TamrinRepository tr = new TamrinRepository(); int cnt = tr.countTamrinByid(id.ToInt()); lbltamrincount.InnerText = cnt.ToString(); vJavabeTamrinRepository jt = new vJavabeTamrinRepository(); OzviatRepository or = new OzviatRepository(); int stucnt = or.countStudentsOfLessonGroupByid(id.ToInt()); int tjt = jt.TedadejavabeTamrin(id.ToInt()); if (cnt == 0 || stucnt == 0) { lblanswer.InnerText = "0"; } else { lblanswer.InnerText = (((Convert.ToDouble(tjt) / (stucnt * cnt) * 100))).ToString(); } vLessonGroupRepository lg = new vLessonGroupRepository(); List <string> St = or.FindStudentCodeByLGID(id.ToInt()); lblStuCount.InnerText = St.Count.ToString(); vLessonGroup lgg = lg.FindByLGID(id.ToInt()); lblTeacharName.InnerText = lgg.FirstName + " " + lgg.LastName; lblClassNum.InnerText = lgg.Class; lblLessonTitle.InnerText = lgg.LessonTitle; SessionRepository sr = new SessionRepository(); lblSessionCount.InnerText = sr.countSessionsByLGID(id.ToInt()).ToString(); }
protected void Page_Load(object sender, EventArgs e) { tamrinid = Session["TamrinIDForHomeWorkDetails"].ToString().ToInt(); Session.Add("stuID", 93124345);// OzviatRepository r = new OzviatRepository(); ozviatid = r.OzviatIDByLGIDAndStudentCode(Session["LGIDForHomeWork"].ToString().ToInt(), Session["stuID"].ToString()); vJavabeTamrinRepository vr = new vJavabeTamrinRepository(); dtable = vr.getJavabeTamrinInfoByTamrinID_OzviatID(tamrinid, ozviatid); if (!IsPostBack) { // ozviatid = -2; // dtable = new DataTable(); setLabels(); setDataTable(); } }
private bool saveChanges() { bool result = true; TransactionOptions op = new TransactionOptions(); op.IsolationLevel = System.Transactions.IsolationLevel.Serializable; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, op)) { try { if (Session["LGIDforSessionHistory"] != null) { id = Convert.ToInt32(Session["LGIDforSessionHistory"].ToString()); ///////////////// Save session //////////////// Sessoin newSes = new Sessoin(); newSes.Date = tbxSessionDate.Text; newSes.LGID = id; SessionRepository sRep = new SessionRepository(); newSes.SessionNum = sRep.CountSessionsByLGID(id).ToInt(); sRep.SaveSession(newSes); ////////////////// Save Score /////////////////////// foreach (GridViewRow row in gvStudents.Rows) { string stuCode = row.Cells[1].Text.ToString(); Nomarat nomre = new Nomarat(); OzviatRepository oRep = new OzviatRepository(); int ozviatid = oRep.OzviatIDByLGIDAndStudentCode(id, stuCode); nomre.OzviatID = ozviatid; int lastSession = sRep.FindLastSessionID(); nomre.SessionID = lastSession; nomre.Date = tbxSessionDate.Text; nomre.Nomre = (row.FindControl("Score") as TextBox).Text; vNomratRepository nomreRep = new vNomratRepository(); nomreRep.SaveNomre(nomre); ///////////////////Save Present/////////////////// Presence presence = new Presence(); presence.OzviatID = ozviatid; presence.SessionID = sRep.FindLastSessionID(); presence.Date = tbxSessionDate.Text; presence.Status = (row.FindControl("RowChB") as CheckBox).Checked; presence.isMovajjah = (row.FindControl("RowChB2") as CheckBox).Checked; presence.Description = (row.FindControl("DescriptionTbx") as TextBox).Text.ToString(); vPresenceRepository PRep = new vPresenceRepository(); PRep.SavePresenc(presence); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Teacher/News.aspx'", true); } scope.Complete(); } catch (Exception e) { string s = e.Message; result = false; } return(result); } }