Пример #1
0
        public virtual MailMessage Appointment(string UserEmail, string DoctorName, Appointment Appointment)
        {
            var AppointmentmailMessage = new MailMessage { Subject = "Remind for Appointment" };

            AppointmentmailMessage.To.Add(UserEmail);
            //Admin Email
            //   AppointmentmailMessage.CC.Add("*****@*****.**");
            ViewBag.ID = Appointment.APPID;

            ViewBag.StartDate = Appointment.startDate;
            ViewBag.EndDate = Appointment.endDate;
            ViewBag.VisitMileage = Appointment.VisitMileage;
            ViewBag.Expences = Appointment.expences;
            ViewBag.DoctorName = DoctorName;

            PopulateBody(AppointmentmailMessage, viewName: "Appointment");

            return AppointmentmailMessage;
        }
Пример #2
0
        //
        // GET: /Appointment/Create
        public ActionResult Create(DateTime startDate, DateTime endDate)
        {
            Person per = Session["person"] as Person;
            ViewBag.PracID = new SelectList(db.Practices.Where(a => a.PersonID == per.ID), "ID", "Name");
            ViewBag.SessID = new SelectList(db.Sessions, "ID", "Name");

            var User = Session["Person"] as Person;
            double value = 0.0;
            double asdouble = (double)(float)value;
            Appointment objNew = new Appointment();

            objNew.PersonID = User.ID;
            objNew.Notes = asdouble;
            objNew.expences = asdouble;
            objNew.VisitMileage = asdouble;
            objNew.IsCharged = true;
            objNew.startDate = startDate.ToString();
            objNew.endDate = endDate.ToString();
            return View(objNew);
        }
Пример #3
0
        public JsonResult GetAllAppointments(IEnumerable<Appointment> AP, Guid? Empid)
        {
            var count1 = 0;
            try
            {

                var data = new List<FullCalendarEvent>();
                var count = 0;
                var User = Session["Person"] as Person;
                var Appointment = new Appointment();
                Appointment.PersonID = User.ID;
                foreach (var item in db.Appointments.Include(p => p.sessionDetail).Include(p => p.Parctice).Where(A => A.PersonID == User.ID))
                {
                    DateTime start = Convert.ToDateTime(item.startDate);
                    DateTime stTime = Convert.ToDateTime(item.sessionDetail.startTime);
                    DateTime end = Convert.ToDateTime(item.endDate);
                    DateTime enTime = Convert.ToDateTime(item.sessionDetail.EndTime);
                    var color1 = "";
                    if (item.Invoiced == true)
                    {
                        if (item.Paid == true)
                        {
                            color1 = "#00a300";
                        }
                        else
                        {
                            color1 = "#EE4646";
                        }
                    }
                    else
                    {
                        color1 = "#2d89ef";
                    }

                    var sesstionStartTime = Convert.ToDateTime(item.sessionDetail.startTime);
                    var sesstionEndTime = Convert.ToDateTime(item.sessionDetail.EndTime);
                    var Cal = new FullCalendarEvent()
                    {

                        id = item.APPID,
                        //   Aid = item.APPID,
                        title = item.Parctice.Name,
                        Sessiontitle = item.sessionDetail.Name,
                        //SessionStart =item.sessionDetail.startTime,
                        //Sessionend = item.sessionDetail.EndTime,
                        SessionStart = sesstionStartTime.ToShortTimeString(),
                        Sessionend = sesstionEndTime.ToShortTimeString(),
                        color = color1,
                        start = new DateTime(start.Year, start.Month, start.Day, sesstionStartTime.Hour, sesstionStartTime.Minute, sesstionStartTime.Second).ToString("s"),
                        end = new DateTime(end.Year, end.Month, end.Day, sesstionEndTime.Hour, sesstionEndTime.Minute, sesstionEndTime.Second).ToString("s")
                    };
                    data.Add(Cal);
                }

                var returnData = data.ToArray();
                return Json(returnData, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("_Form", ex.Message);
            }
            return Json(count1, JsonRequestBehavior.AllowGet);
        }
Пример #4
0
        public ActionResult Create(Appointment appointment)
        {
            try
            {

                if (ModelState.IsValid)
                {
                    appointment.APPID = Guid.NewGuid();
                    var User = Session["Person"] as Person;
                    appointment.PersonID = User.ID;
                    appointment.Invoiced = false;
                    if (appointment.expences == null)
                    {
                        appointment.expences = 0;
                    }
                    if (appointment.VisitMileage == null)
                    {
                        appointment.VisitMileage = 0;
                    }
                    appointment.Total = appointment.Notes + appointment.expences + appointment.VisitMileage;
                    db.Appointments.Add(appointment);
                    try
                    {
                        db.SaveChanges();
                    }

                    catch (Exception ex)
                    {
                        ModelState.AddModelError("_Form", ex.Message);
                    }

                    //_userMailer.Appointment(User.Email, User.UserName, appointment).Send();
                    ////////////////change

                    var sessionDetail = db.Sessions.Where(ses => ses.ID == appointment.SessID).FirstOrDefault();
                    var practDetail = db.Practices.Where(p => p.ID == appointment.PracID).FirstOrDefault();
                    DateTime start = Convert.ToDateTime(appointment.startDate);
                    DateTime stTime = Convert.ToDateTime(sessionDetail.startTime);
                    DateTime end = Convert.ToDateTime(appointment.endDate);
                    DateTime enTime = Convert.ToDateTime(sessionDetail.EndTime);
                    var sesstionStartTime = Convert.ToDateTime(sessionDetail.startTime);
                    var sesstionEndTime = Convert.ToDateTime(sessionDetail.EndTime);
                    var Cal = new FullCalendarEvent();
                    Cal.id = appointment.APPID;
                    Cal.title = practDetail.Name;
                    Cal.Sessiontitle = sessionDetail.Name;
                    Cal.SessionStart = (sesstionStartTime).ToShortTimeString();
                    Cal.Sessionend = (sesstionEndTime).ToShortTimeString();
                    Cal.start = new DateTime(start.Year, start.Month, start.Day, stTime.Hour,stTime.Minute,stTime.Second).ToString("s");
                    Cal.end = new DateTime(end.Year, end.Month, end.Day, enTime.Hour, enTime.Minute, enTime.Second).ToString("s");
                    Cal.color = "#2d89ef";
                    return Json(Cal, JsonRequestBehavior.AllowGet);
                    ////////////////////////////////////////
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("_Form", ex.Message);
            }
                ViewBag.PracID = new SelectList(db.Practices, "ID", "Name", appointment.PracID);
                ViewBag.SessID = new SelectList(db.Sessions, "ID", "Name", appointment.SessID);
                return View(appointment);
        }
Пример #5
0
        public ActionResult Edit(Appointment appointment)
        {
            if (ModelState.IsValid)
            {

                // appointment.Locumname = db.Practices.Where(a => a.ID == appointment.PracID).FirstOrDefault() != null ? db.Practices.Where(a => a.ID == appointment.PracID).FirstOrDefault().Name : "";

                // appointment.Sessionname = db.Sessions.Where(a => a.ID == appointment.SessID).FirstOrDefault() != null ? db.Sessions.Where(a => a.ID == appointment.SessID).FirstOrDefault().Name : "";

                // appointment.sstarttime = db.Sessions.Where(a => a.ID == appointment.SessID).FirstOrDefault() != null ? db.Sessions.Where(a => a.ID == appointment.SessID).FirstOrDefault().startTime : "";

                // appointment.sendtime = db.Sessions.Where(a => a.ID == appointment.SessID).FirstOrDefault() != null ? db.Sessions.Where(a => a.ID == appointment.SessID).FirstOrDefault().EndTime : "";
                var User = Session["Person"] as Person;
                appointment.PersonID = User.ID;
                appointment.Total = appointment.Notes + appointment.expences + appointment.VisitMileage;
                db.Entry(appointment).State = EntityState.Modified;
                db.SaveChanges();
                // return Json(appointment, JsonRequestBehavior.AllowGet);
                //Update Scheduler
                var sessionDetail = db.Sessions.Where(ses => ses.ID == appointment.SessID).FirstOrDefault();
                var practDetail = db.Practices.Where(p => p.ID == appointment.PracID).FirstOrDefault();
                DateTime start = Convert.ToDateTime(appointment.startDate);
                DateTime stTime = Convert.ToDateTime(sessionDetail.startTime);
                DateTime end = Convert.ToDateTime(appointment.endDate);
                DateTime enTime = Convert.ToDateTime(sessionDetail.EndTime);
                var sesstionStartTime = Convert.ToDateTime(sessionDetail.startTime);
                var sesstionEndTime = Convert.ToDateTime(sessionDetail.EndTime);
                var Cal = new FullCalendarEvent();
                Cal.id = appointment.APPID;
                Cal.title = practDetail.Name;
                Cal.Sessiontitle = sessionDetail.Name;
                Cal.SessionStart = (sesstionStartTime).ToShortTimeString();
                Cal.Sessionend = (sesstionEndTime).ToShortTimeString();
                Cal.start = new DateTime(start.Year, start.Month, start.Day, stTime.Hour, stTime.Minute, stTime.Second).ToString("s");
                Cal.end = new DateTime(end.Year, end.Month, end.Day, enTime.Hour, enTime.Minute, enTime.Second).ToString("s");

                return Json(Cal, JsonRequestBehavior.AllowGet);
                ///////////////
            }
            ViewBag.PracID = new SelectList(db.Practices, "ID", "Name", appointment.PracID);
            ViewBag.SessID = new SelectList(db.Sessions, "ID", "Name", appointment.SessID);
            return View(appointment);
        }