Ejemplo n.º 1
0
        public ActionResult Edit([Bind(Include = "App_Id,P_Details,App_Status,App_Date,Dep,App_Time,Reason,isFree,TimeId")] Booking booking)
        {
            var result       = DateTime.Compare(DateTime.Now, booking.AppDate);
            var errorMessage = "";

            var repository = new DefyClinicRepository();
            var contxet    = new DefyClinicContxet();

            //Appointment newTime = db.Appointments.Find(appointment.TimeId);
            //Appointment newDate = db.Appointments.Find(appointment.BookDate);
            var sTime  = db.GetBookings().Where(p => p.TimeId == booking.TimeId).Select(p => p.TimeId).FirstOrDefault();
            var sDate  = db.GetBookings().Where(p => p.AppDate == booking.AppDate).Select(p => p.AppDate).FirstOrDefault();
            var userId = "";

            //  ViewBag.App_Time = new SelectList(d.GetSlots().Where(X => X.Date.ToString() == id), "Id", "A_Slot");
            ViewBag.App_Time     = new SelectList(repository.GetSlots(), "BS_Id", "StartTime");
            ViewData["App_Date"] = new SelectList(repository.GetSlots(), "Id", "Date");
            var pNo      = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpNo;
            var pTitle   = contxet.Staffs.Single(x => x.EmpEmail == userId).Title;
            var pName    = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpName;
            var pSurname = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpSurname;
            var pGender  = contxet.Staffs.Single(x => x.EmpEmail == userId).Gender;
            var pMobile  = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpTel;
            var pId      = contxet.Staffs.Single(x => x.EmpEmail == userId).ID_Pass;
            var dep      = contxet.Staffs.Single(x => x.EmpEmail == userId).Department.D_Name;

            ViewBag.P_Name   = $"{pTitle} {pName} {pSurname}";
            ViewBag.P_Gender = pGender;
            ViewBag.P_No     = pNo;
            ViewBag.P_Mobiel = pMobile;
            ViewBag.P_ID     = pId;
            ViewBag.Dep      = dep;
            if (ModelState.IsValid)
            {
                var b = new Booking
                {
                    PatientDetails = HttpContext.User.Identity.Name,
                    AppDate        = booking.AppDate,
                    TimeId         = booking.TimeId,

                    AppStatus = "Not Yet Confirmed",

                    AppId   = booking.AppId,
                    AppTime = booking.AppTime,
                    Reason  = booking.Reason,

                    IsFree = true
                };
                db.Edit(booking);
                return(RedirectToAction("Index"));
            }
            return(View(booking));
        }
Ejemplo n.º 2
0
        public void NumberOfData()
        {
            var result = rep.GetSlots();

            Assert.IsNotNull(result);
            var Record = result.ToList().Count;

            Assert.AreEqual(1, Record);
        }
Ejemplo n.º 3
0
        // GET: Bookings/Create
        public ActionResult Create(string Emp)
        {
            var d       = new DefyClinicRepository();
            var contxet = new DefyClinicContxet();

            ViewData["App_Date"] = d.GetSlots().Where(w => w.Status)
                                   .AsEnumerable()
                                   .Select(i => new SelectListItem
            {
                Value = i.Date.ToShortDateString(),
                Text  = i.Date.ToShortDateString()
            });
            // ViewBag.App_Time = new SelectList(d.GetSlots().Where(X => X.Status == true), "Id", "A_Slot");
            ViewBag.App_Time = d.GetSlots().Where(w => w.Status)
                               .AsEnumerable()
                               .Select(i => new SelectListItem
            {
                Value = i.A_Slot.ToShortTimeString(),
                Text  = i.A_Slot.ToShortTimeString()
            });
            // ViewBag.App_Time = d.GetSlots().Where(X => X.Status == true).SingleOrDefault().A_Slot.ToShortTimeString();
            // ViewData["App_Date"] = new SelectList(d.GetSlots().Where(X => X.Status == true), "Id", "Date");
            // ViewData["App_Date"] = d.GetSlots().Where(X => X.Status == true).SingleOrDefault().Date.ToShortDateString();
            //  ViewBag.App_Time = new SelectList(db.BookingSlots.Where(X => X.Date.ToString() == id), "BS_Id", "StartTime");
            var userId = Emp ?? HttpContext.User.Identity.Name;


            var pNo      = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpNo;
            var pTitle   = contxet.Staffs.Single(x => x.EmpEmail == userId).Title;
            var pName    = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpName;
            var pSurname = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpSurname;
            var pGender  = contxet.Staffs.Single(x => x.EmpEmail == userId).Gender;
            var pMobile  = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpTel;
            var pId      = contxet.Staffs.Single(x => x.EmpEmail == userId).ID_Pass;
            var dep      = contxet.Staffs.Single(x => x.EmpEmail == userId).Department.D_Name;

            ViewBag.P_Name   = $"{pTitle} {pName} {pSurname}";
            ViewBag.P_Gender = pGender;
            ViewBag.P_No     = pNo;
            ViewBag.P_Mobiel = pMobile;
            ViewBag.P_ID     = pId;
            ViewBag.Dep      = dep;
            return(View());
        }
Ejemplo n.º 4
0
        // GET: Bookings/Edit/5
        public ActionResult Edit(int?id)
        {
            var book       = new Booking();
            var userId     = book.PatientDetails;
            var repository = new DefyClinicRepository();
            var contxet    = new DefyClinicContxet();

            var pNo      = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpNo;
            var pTitle   = contxet.Staffs.Single(x => x.EmpEmail == userId).Title;
            var pName    = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpName;
            var pSurname = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpSurname;
            var pGender  = contxet.Staffs.Single(x => x.EmpEmail == userId).Gender;
            var pMobile  = contxet.Staffs.Single(x => x.EmpEmail == userId).EmpTel;
            var pId      = contxet.Staffs.Single(x => x.EmpEmail == userId).ID_Pass;
            var dep      = contxet.Staffs.Single(x => x.EmpEmail == userId).Department.D_Name;

            ViewBag.P_Name       = $"{pTitle} {pName} {pSurname}";
            ViewBag.P_Gender     = pGender;
            ViewBag.P_No         = pNo;
            ViewBag.P_Mobiel     = pMobile;
            ViewBag.P_ID         = pId;
            ViewBag.Dep          = dep;
            ViewBag.App_Time     = new SelectList(repository.GetSlots(), "BS_Id", "StartTime");
            ViewData["App_Date"] = new SelectList(repository.GetSlots(), "Id", "Date");
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var booking = db.FindById(Convert.ToInt32(id));

            if (booking == null)
            {
                return(HttpNotFound());
            }
            return(View(booking));
        }
Ejemplo n.º 5
0
 // GET: PreSlots
 public ActionResult Index()
 {
     return(View(_db.GetSlots()));
 }