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 = " ";
            }
        }
Ejemplo n.º 3
0
        public DataSet ShowSubNotes(Entities.Notes q1, Entities.personalInfo p1, Entities.Class c1)
        {
            DataSet ds;

            using (WSqlCommand dbCom = new WSqlCommand(dbconstring, "[dbo].[spShowSubNotes]"))
            {
                dbCom.AddParameter("@iam", System.Data.SqlDbType.NVarChar, p1.pKId);
                dbCom.AddParameter("@className", System.Data.SqlDbType.NVarChar, c1.className);
                dbCom.AddParameter("@noteType", System.Data.SqlDbType.NVarChar, q1.noteType);
                dbCom.AddParameter("@minDate", System.Data.SqlDbType.Date, q1.date);
                dbCom.AddParameter("@maxDate", System.Data.SqlDbType.Date, q1.date);
                ds = new DataSet();
                ds = dbCom.Execute();
            }
            return(ds);
        }
Ejemplo n.º 4
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();
     }
 }
Ejemplo n.º 5
0
        public void Quiz()
        {
            DBHandler.DBHandler db = new DBHandler.DBHandler(con);
            Entities.Notes      t1 = new Entities.Notes()
            {
                noteType = "Quiz",
            };

            Entities.personalInfo p1 = new Entities.personalInfo()
            {
                pKId = Session["School"].ToString(),
            };
            Entities.Class c1 = new Entities.Class()
            {
                className = "Class 5",
            };
            DataSet ds = new DataSet();

            ds = db.ShowSubNotes(t1, p1, c1);
            GridView3.DataSource = ds;
            GridView3.DataBind();
        }