Ejemplo n.º 1
0
        public ActionResult Allocate(string seat_id)
        {
            ExamInfoViewModel model = new ExamInfoViewModel()
            {
                seat_id = seat_id
            };

            return(View("_Allocation", model));
        }
        public ActionResult AddorEdit(int id = 0)
        {
            ExamInfoViewModel evm = new ExamInfoViewModel();

            if (id > 0)
            {
                evm = repo.ExamById(id);
            }
            return(View(evm));
        }
        public int Insert(ExamInfoViewModel repo)
        {
            seat_exam_info exam_Info = new seat_exam_info()
            {
                exam_date     = repo.exam_date,
                faculty       = repo.faculty,
                semester      = repo.semester,
                subject_name  = repo.subject_name,
                exam_duration = repo.exam_duration,
                programme     = repo.programme
            };

            db.seat_exam_info.Add(exam_Info);
            return(db.SaveChanges());
        }
Ejemplo n.º 4
0
 public ActionResult Allocate(ExamInfoViewModel model)
 {
     try
     {
         if (model.Room.room_id > 0)
         {
             seat.Insert(model);
         }
     }
     catch (Exception)
     {
         throw;
     }
     return(View("Index"));
 }
        public int Update(ExamInfoViewModel repo, int id)
        {
            var room = db.seat_exam_info.Where(x => x.exam_id == id).FirstOrDefault();

            if (room != null)
            {
                room.exam_id       = repo.exam_id;
                room.exam_date     = repo.exam_date;
                room.faculty       = repo.faculty;
                room.semester      = repo.semester;
                room.subject_name  = repo.subject_name;
                room.exam_duration = repo.exam_duration;
                room.programme     = repo.programme;
            }
            return(db.SaveChanges());
        }
        public int Insert(ExamInfoViewModel evm)
        {
            seat_allocation allocation = new seat_allocation()
            {
                college_name   = evm.college_name,
                exam_detail_id = 1,
                faculty        = evm.faculty,
                programme      = evm.programme,
                roll_no        = evm.roll_no,
                room_id        = evm.Room.room_id,
                seat_id        = evm.seat_id
            };

            db.seat_allocation.Add(allocation);
            db.SaveChanges();
            return(Convert.ToInt32(allocation.roll_no));
        }
Ejemplo n.º 7
0
        public ActionResult SaveSeatAllocation(int classroom, string programme, int roll_no_from, int roll_no_to, string Semester, string seat_no)
        {
            if (!string.IsNullOrEmpty(seat_no))
            {
                string[] arrayIds = seat_no.Split(',');
                //int roll = roll_no_to - roll_no_from;
                foreach (string item in arrayIds)
                {
                    var id = item.ToString();
                    if (roll == 0)
                    {
                        roll = roll_no_from;
                    }
                    else
                    {
                        roll = roll + 1;
                    }

                    if (!string.IsNullOrEmpty(id))
                    {
                        ExamInfoViewModel model = new ExamInfoViewModel();

                        model.programme    = programme;
                        model.semester     = Semester;
                        model.college_name = "";
                        model.exam_id      = 2;
                        model.roll_no      = Convert.ToString(roll);
                        model.seat_id      = id;
                        model.Room         = new RoomViewModel()
                        {
                            room_id = classroom
                        };


                        roll = seat.Insert(model);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
 public ActionResult AddorEdit(ExamInfoViewModel evm)
 {
     try
     {
         if (evm.exam_id == 0)
         {
             repo.Insert(evm);
             return(Json(new { success = true, html = GlobalClass.RenderRazorViewToString(this, "ViewAll", repo.GetExamInfo()), message = "Exam Info Added Successfully" }, JsonRequestBehavior.AllowGet));
         }
         else if (evm.exam_id > 0)
         {
             repo.Update(evm, evm.exam_id);
             return(Json(new { success = true, html = GlobalClass.RenderRazorViewToString(this, "ViewAll", repo.GetExamInfo()), message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = false, message = "Item Already Exists" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = ex.Message.ToString() }, JsonRequestBehavior.AllowGet));
     }
 }