private void setGrid() { vLessonGroupRepository r = new vLessonGroupRepository(); gvLessonGroups.DataSource = r.getStudentLessonGroups(Session["stuID"].ToString().ToInt()); gvLessonGroups.DataBind(); }
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 btnSearch_Click(object sender, EventArgs e) { vLessonGroupRepository sr = new vLessonGroupRepository(); gvLessonGroups.DataSource = sr.FindByClass(tbxSearch.Value); gvLessonGroups.DataBind(); }
protected void btnEditLessonGroup_ServerClick(object sender, EventArgs e) { string id = Request.QueryString["LGID"]; if (id != "" || id != null) { LessonGroup vlg = rep.FindFromLgByLGID(id.ToInt()); LessonGroup lg = new LessonGroup(); if (ddGrade.SelectedIndex != 0 && Class.SelectedIndex != 0 && Day.SelectedIndex != 0 && Time.SelectedIndex != 0 && LessonDrpDList.SelectedIndex != 0 && Teacher.SelectedIndex != 0) { LessonGroup newLesson = new LessonGroup(); newLesson.LGID = id.ToInt(); if (Field.SelectedIndex > 0) { newLesson.FieldID = Field.SelectedItem.Value.ToInt(); } else { newLesson.FieldID = 0; } newLesson.GradeID = ddGrade.SelectedItem.Value.ToInt(); newLesson.Class = Class.SelectedItem.Value; newLesson.Day = Day.SelectedItem.Value.ToInt(); newLesson.Time = Time.SelectedItem.Value.ToInt(); newLesson.LessonID = LessonDrpDList.SelectedItem.Value.ToInt(); newLesson.TeacherCode = Teacher.SelectedItem.Value; newLesson.Year = tbxYear.Text; //SchoolDBEntities db = new SchoolDBEntities(); vLessonGroupRepository vv = new vLessonGroupRepository(); //db.LessonGroups.Attach(newLesson); if (vv.SaveLessonGroups(newLesson)) { //Response.Write("<script>alert('ثبت با موفقیت انجام شد');</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ویرایش با موفقیت انجام شد! ');window.location ='http://localhost:4911/Dashboard/Admin/LessonGroups.aspx'", true); //Response.Redirect("http://localhost:4911/Dashboard/Admin/LessonGroups.aspx"); } else { // Response.Write("<script>alert('ثبت با خطا مواجه شد');</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ویرایش با خطا مواجه شد! ')", true); } } else { // Response.Write("<script>alert('لطفا مقدار همه فیلد ها را معین کنید');</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('لطفا تمام فیلد ها را انتخاب کنید! ')", true); } } }
protected void btnEditLessonGroup_ServerClick(object sender, EventArgs e) { if (Session["LGIDForEditLessonGroup"] != null) { string id = Session["LGIDForEditLessonGroup"].ToString(); LessonGroup vlg = rep.FindFromLgByLGID(id.ToInt()); LessonGroup lg = new LessonGroup(); if (ddGrade.SelectedIndex != 0 && Class.SelectedIndex != 0 && Day.SelectedIndex != 0 && Time.SelectedIndex != 0 && LessonDrpDList.SelectedIndex != 0 && Teacher.SelectedIndex != 0) { LessonGroup newLesson = new LessonGroup(); newLesson.LGID = id.ToInt(); if (Field.SelectedIndex > 0) { newLesson.FieldID = Field.SelectedItem.Value.ToInt(); } else { newLesson.FieldID = 0; } newLesson.GradeID = ddGrade.SelectedItem.Value.ToInt(); newLesson.Class = Class.SelectedItem.Value; newLesson.Day = Day.SelectedItem.Value.ToInt(); newLesson.Time = Time.SelectedItem.Value.ToInt(); newLesson.LessonID = LessonDrpDList.SelectedItem.Value.ToInt(); newLesson.TeacherCode = Teacher.SelectedItem.Value; newLesson.Year = tbxYear.Text; vLessonGroupRepository vv = new vLessonGroupRepository(); if (vv.SaveLessonGroups(newLesson)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ویرایش با موفقیت انجام شد! ');window.location ='http://localhost:4911/Dashboard/Admin/LessonGroups.aspx'", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ویرایش با خطا مواجه شد! ')", true); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('لطفا تمام فیلد ها را انتخاب کنید! ')", true); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Admin/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 btnSearch_Click(object sender, EventArgs e) { vLessonGroupRepository sr = new vLessonGroupRepository(); gvLessonGroups.DataSource = sr.searchLessonsGroups(tbxSearch.Value); gvLessonGroups.DataBind(); foreach (GridViewRow row in gvLessonGroups.Rows) { switch (row.Cells[7].Text) { case "1": row.Cells[7].Text = "شنبه"; break; case "2": row.Cells[7].Text = "یک شنبه"; break; case "3": row.Cells[7].Text = "دوشنبه"; break; case "4": row.Cells[7].Text = "سه شنبه"; break; case "5": row.Cells[7].Text = "چهارشنبه"; break; case "6": row.Cells[7].Text = "پنج شنبه"; break; case "7": row.Cells[7].Text = "جمعه"; break; } } tbxSearch.Value = ""; }
public void LoadLessonGroups() { vLessonGroupRepository sr = new vLessonGroupRepository(); gvLessonGroups.DataSource = sr.GetAllLessonGroups(); gvLessonGroups.DataBind(); foreach (GridViewRow row in gvLessonGroups.Rows) { switch (row.Cells[7].Text) { case "1": row.Cells[7].Text = "شنبه"; break; case "2": row.Cells[7].Text = "یک شنبه"; break; case "3": row.Cells[7].Text = "دوشنبه"; break; case "4": row.Cells[7].Text = "سه شنبه"; break; case "5": row.Cells[7].Text = "چهارشنبه"; break; case "6": row.Cells[7].Text = "پنج شنبه"; break; case "7": row.Cells[7].Text = "جمعه"; break; } } tbxSearch.Value = ""; }
public void gvLoad() { vLessonGroupRepository vRep = new vLessonGroupRepository(); List <int> ClassesOfTeacherList = vRep.GetClassesOfTeacherInYear("11111", "93-94"); gvClasses.DataSource = vRep.GetLessonGroupsByLGIDList(ClassesOfTeacherList); gvClasses.DataBind(); foreach (GridViewRow row in gvClasses.Rows) { switch (row.Cells[3].Text) { case "1": row.Cells[3].Text = "شنبه"; break; case "2": row.Cells[3].Text = "یک شنبه"; break; case "3": row.Cells[3].Text = "دوشنبه"; break; case "4": row.Cells[3].Text = "سه شنبه"; break; case "5": row.Cells[3].Text = "چهارشنبه"; break; case "6": row.Cells[3].Text = "پنج شنبه"; break; case "7": row.Cells[3].Text = "جمعه"; break; } } }
protected void gvEmployees_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Students") { // 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 = gvLessonGroups.Rows[index]; Session.Add("LGIDForClassMembers", row.Cells[0].Text); 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 = gvLessonGroups.Rows[index]; vLessonGroupRepository rep = new vLessonGroupRepository(); rep.DeleteLessonGroup(row.Cells[0].Text.ToInt()); //SchoolDBEntities db = new SchoolDBEntities(); //LessonGroup k = new LessonGroup(); //int a = row.Cells[0].Text; //k = db.LessonGroups.Where(p => p.LGID == a).Single(); //db.Karmands.Remove(k); //db.SaveChanges(); LoadLessonGroups(); } }
public void LoadDrpDList() { LessonsRepository LR = new LessonsRepository(); KarmandRepository KR = new KarmandRepository(); vLessonGroupRepository vLR = new vLessonGroupRepository(); ddGrade.Items.Add("مقطع"); ddGrade.Items[0].Value = "0"; ddGrade.Items.Add("اول"); ddGrade.Items[1].Value = "1"; ddGrade.Items.Add("دوم"); ddGrade.Items[2].Value = "2"; ddGrade.Items.Add("سوم"); ddGrade.Items[3].Value = "3"; ddGrade.Items.Add("چهارم"); ddGrade.Items[4].Value = "4"; ddGrade.Items.Add("پنجم"); ddGrade.Items[5].Value = "5"; ddGrade.Items.Add("ششم"); ddGrade.Items[6].Value = "6"; ddGrade.Items.Add("هفتم"); ddGrade.Items[7].Value = "7"; ddGrade.Items.Add("هشتم"); ddGrade.Items[8].Value = "8"; ddGrade.Items.Add("نهم"); ddGrade.Items[9].Value = "9"; ddGrade.Items.Add("دهم"); ddGrade.Items[10].Value = "10"; ddGrade.Items.Add("یازدهم"); ddGrade.Items[11].Value = "11"; ddGrade.Items.Add("دوازدهم"); ddGrade.Items[12].Value = "12"; ///////////// Field.Items.Add("رشته تحصیلی"); Field.Items[0].Value = "0"; Field.Items.Add("ریاضی"); Field.Items[1].Value = "1"; Field.Items.Add("تجربی"); Field.Items[2].Value = "2"; Field.Items.Add("انسانی"); Field.Items[3].Value = "3"; /////////////// Day.Items.Add("روز"); Day.Items[0].Value = "0"; Day.Items.Add("شنبه"); Day.Items[1].Value = "1"; Day.Items.Add("یکشنبه"); Day.Items[2].Value = "2"; Day.Items.Add("دوشنبه"); Day.Items[3].Value = "3"; Day.Items.Add("سه شنبه"); Day.Items[4].Value = "4"; Day.Items.Add("چهار شنبه"); Day.Items[5].Value = "5"; Day.Items.Add("پنج شنبه"); Day.Items[6].Value = "6"; //////////////////////// Class.Items.Add("شماره کلاس"); Class.Items[0].Value = "0"; Class.Items.Add("101"); Class.Items[1].Value = "101"; Class.Items.Add("102"); Class.Items[2].Value = "102"; Class.Items.Add("103"); Class.Items[3].Value = "103"; Class.Items.Add("201"); Class.Items[4].Value = "201"; Class.Items.Add("202"); Class.Items[5].Value = "202"; Class.Items.Add("203"); Class.Items[6].Value = "203"; ///////////////////////////////// Time.Items.Add("ساعت"); Time.Items[0].Value = "0"; Time.Items.Add("ساعت اول"); Time.Items[1].Value = "1"; Time.Items.Add("ساعت دوم"); Time.Items[2].Value = "2"; Time.Items.Add("ساعت سوم"); Time.Items[3].Value = "3"; Time.Items.Add("ساعت چهارم"); Time.Items[4].Value = "4"; //////////////////////// List <Lesson> lessonList = LR.GetListOfAllLessons(); LessonDrpDList.Items.Add("نام درس"); LessonDrpDList.Items[0].Value = "0"; for (int i = 1; i <= lessonList.Count; i++) { LessonDrpDList.Items.Add(lessonList[i - 1].LessonTitle); LessonDrpDList.Items[i].Value = lessonList[i - 1].LessonID.ToString(); } //////////////////////////// List <Karmand> teacherList = KR.GetListOfAllEmployees(); Teacher.Items.Add("نام مدرس"); Teacher.Items[0].Value = "0"; for (int i = 1; i <= teacherList.Count; i++) { Teacher.Items.Add(teacherList[i - 1].FirstName + " " + teacherList[i - 1].LastName); Teacher.Items[i].Value = teacherList[i - 1].PersonalCode.ToString(); } ////////////////////// List <string> yearsList = vLR.GetlistOfAllYears(); Year.Items.Add("سال تحصیلی"); Year.Items[0].Value = "0"; }
protected void Page_Load(object sender, EventArgs e) { vReportExamsRepository rep = new vReportExamsRepository(); vLessonGroupRepository lgr = new vLessonGroupRepository(); List <List <decimal?> > datalist = new List <List <decimal?> >(); List <decimal?> ll; List <string> studentsList = new List <string>(); List <string> studentsNames = new List <string>(); // string year = lgr.GetLastestYear(); studentsList = lgr.GetStudentCodeOfLessonGroup(lgid); studentsNames = lgr.GetStudentNameOfLessonGroup(lgid); int studentCount = studentsList.Count; List <string> s = new List <string>() { "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "فروردین", "اردیبهشت", "خرداد" }; //.ConvertAll(new Converter<decimal?, decimal>()) for (int i = 0; i < studentCount; i++) { ll = new List <decimal?>(); ll = rep.GetAvgOfStudentPerMonth(studentsList[i]); datalist.Add(ll); } List <decimal?> l; List <List <LineSeriesData> > liststudentdata = new List <List <LineSeriesData> >(); List <LineSeriesData> studentData; for (int i = 0; i < datalist.Count; i++) { l = new List <decimal?>(); l = datalist[i]; studentData = new List <LineSeriesData>(); l.ForEach(p => studentData.Add(new LineSeriesData { Y = (double)p })); liststudentdata.Add(studentData); } LineSeries ss; List <Series> ser = new List <Series>(); for (int i = 0; i < datalist.Count; i++) { ss = new LineSeries(); ss.Name = studentsNames[i]; ss.Data = liststudentdata[i]; ser.Add(ss); } Highcharts higcharts = new Highcharts { Title = new Title { Text = "نمودار پیشرفت", X = -20 }, Subtitle = new Subtitle { Text = "میانگین نمرات ماهانه کلاس", X = -20 }, XAxis = new List <XAxis> { new XAxis { Categories = s } }, YAxis = new List <YAxis> { new YAxis { Title = new YAxisTitle { Text = "نمره" }, PlotLines = new List <YAxisPlotLines> { new YAxisPlotLines { Value = 0, Width = 1, Color = "#808080" } } } }, Tooltip = new Tooltip { ValueSuffix = "" }, Legend = new Legend { Layout = LegendLayout.Vertical, Align = LegendAlign.Right, VerticalAlign = LegendVerticalAlign.Middle, BorderWidth = 0 }, Series = ser }; //Title t = new Title(); //t.Text = "Monthly Average Temperature"; //t.X = -20; //higcharts.Title = t; //Subtitle sub = new Subtitle(); //sub.Text = "Source: WorldClimate.com"; //sub.X = -20; HighsoftNamespace Highsoft = new HighsoftNamespace(); //string result = Highsoft.Highcharts(higcharts, "chart").ToHtmlString(); //For version 5.0.6326 or older string result = Highsoft.GetHighcharts(higcharts, "chart").ToHtmlString(); //For version 5.0.6327 or newer Response.Write(result); }