protected void AssignTest(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('UpcomingTest')", true);
            if (Page.IsValid)
            {
                DBHandler.DBHandler db = new DBHandler.DBHandler(con);
                Entities.Notes      n1 = new Entities.Notes()
                {
                    teacher     = Session["School"].ToString(),
                    date        = DateTime.Now.ToShortDateString(),
                    description = TextArea2.Value,
                    noteType    = "Quiz",
                };
                Entities.Section s1 = new Entities.Section()
                {
                    sectionName = DropDownList5.SelectedValue,
                };
                Entities.Class c1 = new Entities.Class()
                {
                    className = DropDownList4.SelectedValue,
                };
                Entities.Subjects s2 = new Entities.Subjects()
                {
                    subjectName = DropDownList6.SelectedValue,
                };

                db.AddNotes(n1, s2, s1, c1);
                TextArea2.Value = " ";
            }
        }
        protected void AssignHomeWork(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignHomeWork')", true);
            if (Page.IsValid)
            {
                Stream              str  = FileUpload1.PostedFile.InputStream;
                BinaryReader        br   = new BinaryReader(str);
                Byte[]              size = br.ReadBytes((int)str.Length);
                DBHandler.DBHandler db   = new DBHandler.DBHandler(con);
                Entities.Notes      n1   = new Entities.Notes()
                {
                    teacher     = Session["School"].ToString(),
                    date        = DateTime.Now.ToShortDateString(),
                    fileName    = Path.GetFileName(FileUpload1.PostedFile.FileName),
                    dataFile    = size,
                    description = TextArea1.Value,
                    noteType    = "Assignment",
                };
                Entities.Section s1 = new Entities.Section()
                {
                    sectionName = DropDownList2.SelectedValue,
                };
                Entities.Class c1 = new Entities.Class()
                {
                    className = DropDownList1.SelectedValue,
                };
                Entities.Subjects s2 = new Entities.Subjects()
                {
                    subjectName = DropDownList3.SelectedValue,
                };

                db.AddNotes(n1, s2, s1, c1);
                TextArea1.Value = " ";
            }
        }
 protected void AssignStudent(object sender, EventArgs e)
 {
     Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignStudentClass')", true);
     if (Page.IsValid)
     {
         DBHandler.DBHandler   db = new DBHandler.DBHandler(con);
         Entities.personalInfo t1 = new Entities.personalInfo()
         {
             pKId = Session["School"].ToString(),
         };
         Entities.StudentSubject t2 = new Entities.StudentSubject()
         {
             pKId = SchoolID.Value,
             year = Year.Text,
         };
         Entities.Class c1 = new Entities.Class()
         {
             className = DropDownList1.SelectedValue,
         };
         Entities.Section s1 = new Entities.Section()
         {
             sectionName = DropDownList2.SelectedValue,
         };
         db.AssignStudentClass(t1, t2, c1, s1);
         SqlDataSource6.DataBind();
         GridView1.DataBind();
     }
 }
        protected void AssignTeacher(object sender, EventArgs e)
        {
            DBHandler.DBHandler db = new DBHandler.DBHandler(con);
            Entities.Section    s3 = new Entities.Section()
            {
                sectionName = SectionDropDown.SelectedValue,
            };
            Entities.personalInfo p1 = new Entities.personalInfo()
            {
                pKId = Session["School"].ToString(),
            };
            Entities.personalInfo p2 = new Entities.personalInfo()
            {
                pKId = TeacherDropDown.SelectedValue,
            };
            Entities.Class c1 = new Entities.Class()
            {
                className = ClassDropDown.SelectedValue,
            };
            Entities.Subjects s2 = new Entities.Subjects()
            {
                subjectName = SubjectDropDown.SelectedValue,
            };


            db.AssignCourses(s3, p1, p2, c1, s2);

            GridView2.DataBind();
            UpdatePanel1.Update();
            Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignCourses')", true);
        }
        protected void UpdateCoursePlan(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('CourseProgress')", true);
            if (Page.IsValid)
            {
                DBHandler.DBHandler db  = new DBHandler.DBHandler(con);
                Entities.CoursePlan cc1 = new Entities.CoursePlan()
                {
                    year       = DateTime.Now.Year.ToString(),
                    Goal       = Goal.Value,
                    progressId = DropDownList7.SelectedIndex + 1,
                };
                Entities.Section s1 = new Entities.Section()
                {
                    sectionName = DropDownList10.SelectedValue,
                };
                Entities.Class c1 = new Entities.Class()
                {
                    className = DropDownList8.SelectedValue,
                };
                Entities.Subjects s2 = new Entities.Subjects()
                {
                    subjectName = DropDownList9.SelectedValue,
                };
                Entities.personalInfo p1 = new Entities.personalInfo()
                {
                    pKId = Session["School"].ToString(),
                };

                db.CoursePlan(cc1, s2, s1, c1, p1);
            }
        }
Пример #6
0
 public void InsertSection(Entities.Section c1)
 {
     using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spInsertSectionName]"))
     {
         s1.AddParameter("@sectionName ", System.Data.SqlDbType.NVarChar, c1.sectionName);
         s1.Execute();
     }
 }
Пример #7
0
        public void Delete(Section.Contract.Section section)
        {
            Entities.Section dbSection = dbSet.Find(section.ID);

            if (dbSection != null)
            {
                dbSet.Remove(dbSection);
            }
        }
Пример #8
0
 public void AssignCourses(Entities.Section s3, Entities.personalInfo p1, Entities.personalInfo p2, Entities.Class c1, Entities.Subjects s2)
 {
     using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spAssignTeacher]"))
     {
         s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName);
         s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName);
         s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c1.className);
         s1.AddParameter("@iAm ", System.Data.SqlDbType.NVarChar, p1.pKId);
         s1.AddParameter("@pKId", System.Data.SqlDbType.NVarChar, p2.pKId);
         s1.Execute();
     }
 }
Пример #9
0
        public void Upsert(Section.Contract.Section section)
        {
            Entities.Section existingSection = dbSet.Find(section.ID);

            if (existingSection == null)
            {
                dbSet.Add(section.DeepCopyTo <Entities.Section>());
            }
            else
            {
                Mapper.Map(section, existingSection);
            }
        }
Пример #10
0
 public void CoursePlan(Entities.CoursePlan c1, Entities.Subjects s2, Entities.Section s3, Entities.Class c2, Entities.personalInfo p1)
 {
     using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spInsertCourseProgress]"))
     {
         s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName);
         s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName);
         s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c2.className);
         s1.AddParameter("@pKId", System.Data.SqlDbType.NVarChar, p1.pKId);
         s1.AddParameter("@progressId", System.Data.SqlDbType.Int, c1.progressId);
         s1.AddParameter("@year", System.Data.SqlDbType.NVarChar, c1.year);
         s1.AddParameter("@goal", System.Data.SqlDbType.NVarChar, c1.Goal);
         s1.Execute();
     }
 }
Пример #11
0
 public void AddExamDate(Entities.ExamDate c1, Entities.Subjects s2, Entities.Section s3, Entities.Class c2, Entities.personalInfo p1, Entities.ExamType e1)
 {
     using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spInsertExamDate]"))
     {
         s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName);
         s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName);
         s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c2.className);
         s1.AddParameter("@examTypeId", System.Data.SqlDbType.NVarChar, e1.examTypeId);
         s1.AddParameter("@iAm", System.Data.SqlDbType.NVarChar, p1.pKId);
         s1.AddParameter("@examDate", System.Data.SqlDbType.Date, c1.examDate);
         s1.AddParameter("@totalMarks", System.Data.SqlDbType.Int, c1.totalMarks);
         s1.Execute();
     }
 }
Пример #12
0
 public void AddNotes(Entities.Notes c1, Entities.Subjects s2, Entities.Section s3, Entities.Class c2)
 {
     using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spAddNotes]"))
     {
         s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName);
         s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName);
         s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c2.className);
         s1.AddParameter("@teacher", System.Data.SqlDbType.NVarChar, c1.teacher);
         s1.AddParameter("@noteType", System.Data.SqlDbType.NVarChar, c1.noteType);
         s1.AddParameter("@assignDate", System.Data.SqlDbType.Date, c1.date);
         s1.AddParameter("@fileName", System.Data.SqlDbType.NVarChar, c1.fileName);
         s1.AddParameter("@dataFile", System.Data.SqlDbType.VarBinary, c1.dataFile);
         s1.AddParameter("@description", System.Data.SqlDbType.NVarChar, c1.description);
         s1.Execute();
     }
 }
        protected void AddExamDate(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('ExamDate')", true);
            if (Page.IsValid)
            {

                DBHandler.DBHandler db = new DBHandler.DBHandler(con);
                Entities.ExamDate cc1 = new Entities.ExamDate()
                {
                    examDate = EDate.Text,
                    totalMarks = Convert.ToInt32(TotalMarks.Value),

                };
                Entities.Section s1 = new Entities.Section()
                {
                    sectionName = DropDownList2.SelectedValue,

                };
                Entities.Class c1 = new Entities.Class()
                {
                    className = DropDownList1.SelectedValue,

                };
                Entities.Subjects s2 = new Entities.Subjects()
                {
                    subjectName = DropDownList3.SelectedValue,

                };
                Entities.personalInfo p1 = new Entities.personalInfo()
                {
                    pKId = Session["School"].ToString(),

                };

                Entities.ExamType e1 = new Entities.ExamType()
                {
                    examTypeId = DropDownList4.SelectedValue,
                };
                db.AddExamDate(cc1, s2, s1, c1, p1, e1);
                GridView1.DataBind();
                UpdatePanel1.Update();

            }
        }
Пример #14
0
 protected void AddSection(object sender, EventArgs e)
 {
     Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AddSections')", true);
     if (Page.IsValid)
     {
         DBHandler.DBHandler db = new DBHandler.DBHandler(con);
         Entities.Section    t1 = new Entities.Section()
         {
             sectionName = SectionName.Value,
         };
         db.InsertSection(t1);
         SSections.DataBind();
         GSections.DataBind();
         UpdatePanel3.Update();
         AddClassSection1.UpdateSection();
         TecherSection1.UpdateSection();
         StudentSection1.UpdateSection();
         ExamDate1.UpdateSection();
         SectionLabel.Text = "Section Added Successfully";
     }
 }
        public ActionResult SaveSection(Entities.Section obj)
        {
            using (ApplicationDbContext data = new ApplicationDbContext())
            {
                if (obj.Id == 0)
                {
                    data.Sections.Add(obj);
                }
                else
                {
                    Section sect = data.Sections.FirstOrDefault(f => f.Id == obj.Id);

                    sect.Description  = obj.Description;
                    sect.Name         = obj.Name;
                    sect.MinPassScore = obj.MinPassScore;
                    sect.MaximumScore = obj.MaximumScore;
                }

                data.SaveChanges();
            }

            return(null);
        }
        protected void AddExamDate(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('ExamDate')", true);
            if (Page.IsValid)
            {
                DBHandler.DBHandler db  = new DBHandler.DBHandler(con);
                Entities.ExamDate   cc1 = new Entities.ExamDate()
                {
                    examDate   = EDate.Text,
                    totalMarks = Convert.ToInt32(TotalMarks.Value),
                };
                Entities.Section s1 = new Entities.Section()
                {
                    sectionName = DropDownList2.SelectedValue,
                };
                Entities.Class c1 = new Entities.Class()
                {
                    className = DropDownList1.SelectedValue,
                };
                Entities.Subjects s2 = new Entities.Subjects()
                {
                    subjectName = DropDownList3.SelectedValue,
                };
                Entities.personalInfo p1 = new Entities.personalInfo()
                {
                    pKId = Session["School"].ToString(),
                };

                Entities.ExamType e1 = new Entities.ExamType()
                {
                    examTypeId = DropDownList4.SelectedValue,
                };
                db.AddExamDate(cc1, s2, s1, c1, p1, e1);
                GridView1.DataBind();
                UpdatePanel1.Update();
            }
        }
Пример #17
0
        public async Task <Section.Contract.Section> GetByIDAsync(Guid id)
        {
            Entities.Section section = await dbSet.FirstOrDefaultAsync(s => s.ID == id);

            return(section.DeepCopyTo <Section.Contract.Section>());;
        }
Пример #18
0
        public async Task <Section.Contract.Section> GetByNameAsync(string name)
        {
            Entities.Section section = await dbSet.FirstOrDefaultAsync(s => s.Name == name);

            return(section.DeepCopyTo <Section.Contract.Section>());;
        }
        protected void AddSection(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AddSections')", true);
            if (Page.IsValid)
            {

                DBHandler.DBHandler db = new DBHandler.DBHandler(con);
                Entities.Section t1 = new Entities.Section()
                {
                    sectionName = SectionName.Value,
                };
                db.InsertSection(t1);
                SSections.DataBind();
                GSections.DataBind();
                UpdatePanel3.Update();
                AddClassSection1.UpdateSection();
                TecherSection1.UpdateSection();
                StudentSection1.UpdateSection();
                ExamDate1.UpdateSection();
                SectionLabel.Text = "Section Added Successfully";

            }
        }
Пример #20
0
 public void AssignStudentClass(Entities.personalInfo p1, Entities.StudentSubject p2, Entities.Class c1, Entities.Section ss1)
 {
     using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spAssignClassSection]"))
     {
         s1.AddParameter("@iAm", System.Data.SqlDbType.NVarChar, p1.pKId);
         s1.AddParameter("@studentId", System.Data.SqlDbType.NVarChar, p2.pKId);
         s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c1.className);
         s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, ss1.sectionName);
         s1.AddParameter("@year", System.Data.SqlDbType.NVarChar, p2.year);
         s1.Execute();
     }
 }
        protected void AssignTeacher(object sender, EventArgs e)
        {
            DBHandler.DBHandler db = new DBHandler.DBHandler(con);
                Entities.Section s3 = new Entities.Section()
                {
                    sectionName = SectionDropDown.SelectedValue,

                };
                Entities.personalInfo p1 = new Entities.personalInfo()
                {
                    pKId = Session["School"].ToString(),

                };
                Entities.personalInfo p2 = new Entities.personalInfo()
                {
                    pKId = TeacherDropDown.SelectedValue,

                };
                Entities.Class c1 = new Entities.Class()
                {
                    className = ClassDropDown.SelectedValue,

                };
                Entities.Subjects s2 = new Entities.Subjects()
                {
                    subjectName = SubjectDropDown.SelectedValue,

                };

                db.AssignCourses(s3,p1,p2,c1,s2);

                GridView2.DataBind();
                UpdatePanel1.Update();
                Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignCourses')", true);
        }
 protected void AssignStudent(object sender, EventArgs e)
 {
     Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignStudentClass')", true);
     if (Page.IsValid)
     {
         DBHandler.DBHandler db = new DBHandler.DBHandler(con);
         Entities.personalInfo t1 = new Entities.personalInfo()
         {
             pKId = Session["School"].ToString(),
         };
         Entities.StudentSubject t2 = new Entities.StudentSubject()
         {
             pKId = SchoolID.Value,
             year=Year.Text,
         };
         Entities.Class c1 = new Entities.Class()
         {
             className = DropDownList1.SelectedValue,
         };
         Entities.Section s1 = new Entities.Section()
         {
             sectionName = DropDownList2.SelectedValue,
         };
         db.AssignStudentClass(t1, t2, c1, s1);
         SqlDataSource6.DataBind();
         GridView1.DataBind();
     }
 }