Esempio n. 1
0
        public ActionResult FileUpload(Note notes)
        {
            // object v = (TempData["TID"]);
            //string Tid = v.ToString();
            if (ModelState.IsValid)
            {
                using (NMSEntities db = new NMSEntities())
                {
                    String FileExt = Path.GetExtension(notes.files.FileName).ToUpper();
                    if (FileExt == ".PDF")
                    {
                        Stream       str     = notes.files.InputStream;
                        BinaryReader Br      = new BinaryReader(str);
                        Byte[]       FileDet = Br.ReadBytes((Int32)str.Length);

                        Note n = new NMS.Models.Note();


                        n.PDFFile = FileDet;

                        //SaveFileDetails(n);
                        db.AddNotes(notes.TID, notes.ModuleID, notes.SubID, notes.ClassID, n.PDFFile);
                        return(RedirectToAction("FileUpload"));
                    }
                    else
                    {
                        ViewBag.FileStatus = "Invalid file format.";
                        return(View());
                    }
                }
            }
            return(View());
        }
Esempio n. 2
0
        public ActionResult WriteMessage(NGroupMessageTeacher1 nGroupMessageTeacher1)
        {
            if (ModelState.IsValid)
            {
                using (NMSEntities db = new NMSEntities())
                {
                    String FileExt = Path.GetExtension(nGroupMessageTeacher1.files.FileName).ToUpper();
                    if (FileExt == ".PDF")
                    {
                        Stream       str     = nGroupMessageTeacher1.files.InputStream;
                        BinaryReader Br      = new BinaryReader(str);
                        Byte[]       FileDet = Br.ReadBytes((Int32)str.Length);

                        NGroupMessageTeacher1 n = new NMS.Models.NGroupMessageTeacher1();

                        //TimeSpan.FromTicks(DateTime.Now.Ticks)
                        n.Media = FileDet;
                        string id  = Session["id"].ToString();
                        int    ids = Convert.ToInt32(id);
                        //SaveFileDetails(n);
                        db.InsertMessageIntoGroup(ids, Session["TID"].ToString(), nGroupMessageTeacher1.message, DateTime.Now.TimeOfDay, n.Media);
                        //db.AddNotes(notes.TID, notes.ModuleID, notes.SubID, notes.ClassID, n.PDFFile);
                        return(RedirectToAction("chat", new { id = ids }));
                    }
                    else
                    {
                        ViewBag.FileStatus = "Invalid file format.";
                        return(View());
                    }
                }
            }
            return(View());
        }
Esempio n. 3
0
        public ActionResult JoinGroupButton(int id)
        {
            NMSEntities db = new NMSEntities();

            db.NEInsertGroupMemberTeachers(id, Session["TID"].ToString(), Session["Name"].ToString());

            return(RedirectToAction("GroupMessage", new { id = id }));
        }
Esempio n. 4
0
        public ActionResult CreateGroup()
        {
            if (Session["TID"] == null)
            {
                return(RedirectToAction("Index", "Main"));
            }
            NMSEntities db = new NMSEntities();

            ViewBag.SubID   = new SelectList(db.Subjects, "SubID", "SubName");
            ViewBag.ClassID = new SelectList(db.Classes, "classID", "ClassName");

            return(View());
        }
Esempio n. 5
0
 public ActionResult Index(Teacher objUser)
 {
     if (ModelState.IsValid)
     {
         using (NMSEntities db = new NMSEntities())
         {
             var obj = db.Teachers.Where(a => a.TID.Equals(objUser.TID) && a.Password.Equals(objUser.Password)).FirstOrDefault();
             if (obj != null)
             {
                 Session["TID"]  = obj.TID.ToString();
                 Session["Name"] = obj.Name.ToString();
                 return(RedirectToAction("Index", "TeacherPortal"));
             }
         }
     }
     return(View(objUser));
 }
        private List <Note> GetFileList()
        {
            NMSEntities db      = new NMSEntities();
            List <Note> DetList = new List <Note>();

            // DbConnection();
            //con.Open();
            //object v = (TempData["TID"]) as string;
            //string Tid = v.ToString();
            //string Tid= (TempData["TID"]) as string;
            //string Tid = Session["TID"].ToString();
            // Note n = new Models.Note();
            DetList = db.GetTeachersPdfNotes().ToList();
            //con.Close();

            return(DetList);
        }
 public ActionResult Index(Student objUser)
 {
     if (ModelState.IsValid)
     {
         using (NMSEntities db = new NMSEntities())
         {
             var obj = db.Students.Where(a => a.USN.Equals(objUser.USN) && a.Password.Equals(objUser.Password)).FirstOrDefault();
             if (obj != null)
             {
                 Session["USN"]  = obj.USN.ToString();
                 Session["Name"] = obj.Name.ToString();
                 return(RedirectToAction("Index", "StudentPortal"));
             }
         }
     }
     return(View(objUser));
 }
Esempio n. 8
0
        public ActionResult CreateGroup(NGroup group)
        {
            if (ModelState.IsValid)
            {
                using (NMSEntities db = new NMSEntities())
                {
                    String FileExt = Path.GetExtension(group.files.FileName).ToUpper();
                    if (FileExt == ".PDF")
                    {
                        Stream       str     = group.files.InputStream;
                        BinaryReader Br      = new BinaryReader(str);
                        Byte[]       FileDet = Br.ReadBytes((Int32)str.Length);

                        NGroup n = new NMS.Models.NGroup();


                        n.GroupIcon = FileDet;

                        //SaveFileDetails(n);
                        db.NMakeGroups(group.GroupName, n.GroupIcon, group.classID, group.subID);

                        var a       = db.NGetGroupIDsss(group.GroupName).FirstOrDefault();
                        int groupid = a.GroupID;

                        db.NEInsertGroupMemberTeachers(groupid, Session["TID"].ToString(), Session["Name"].ToString());

                        return(RedirectToAction("FileUpload"));
                    }
                    else
                    {
                        ViewBag.FileStatus = "Invalid file format.";
                        return(View());
                    }
                }
            }
            return(View());
        }