Example #1
0
        public void BookAppointmentTest()
        {
            List <string>   actual      = new List <string>();
            BookAppointment book        = new BookAppointment("DoctorA", "patient", "12/10/2015", "09:00:00");
            IDBConnect      dbConnector = new dbCommTEST();

            book.setDBConnectInstance(dbConnector);
            actual = book.execute();
            List <string> expected = new List <string>();

            expected.Add("07");
            expected.Add("1");
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
        }
 public void CreateAppointment(BookAppointment objAppointment)
 {
     try
     {
         using (var conn = OpenConnection())
         {
             conn.Execute("CALL public.usp_createappointment(@PatientId,@DoctorId,@AppointmentTime,@Status)",
                          new { PatientId = objAppointment.PatientId, DoctorId = objAppointment.DoctorId, AppointmentTime = objAppointment.AppointmentTime, Status = "Booked" }, null, null);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            BookAppointment = await _context.BookAppointments.FirstOrDefaultAsync(m => m.BookAppointmentID == id);

            if (BookAppointment == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public IActionResult UpdateBookAppointmentForBarber(int id, [FromBody] BookAppointmentForUpdateData data)
        {
            var             claimsPrincipal = User as ClaimsPrincipal;
            int             barberId        = int.Parse(claimsPrincipal.FindFirst("userId").Value);
            BookAppointment bookAppointment = BookAppointmentDataStore.Current.Appointments.FirstOrDefault(ba => ba.Id == id && ba.BarberId == barberId);

            if (bookAppointment == null)
            {
                return(NotFound());
            }

            bookAppointment.Cancel = data.Cancel;
            bookAppointment.Hour   = data.Hour;
            return(NoContent());
        }
        public BookAppointment Create(CreateBookAppointment inputBookApointment)
        {
            BookAppointment newBookAppointment = new BookAppointment()
            {
                Id       = 99,
                BarberId = inputBookApointment.BarberId,
                Cancel   = 0,
                ClientId = 1,
                Date     = inputBookApointment.Date,
                Hour     = inputBookApointment.Hour
            };

            _bookappointments.Add(newBookAppointment);
            return(newBookAppointment);
        }
 public ActionResult AppointmentForm(BookAppointment bookAppointment, FormCollection formData)
 {
     if (!ModelState.IsValid)
     {
         ViewBag.ValidationMessage = "Please update the highlighted mandatory field(s)";
         return(View());
     }
     else
     {
         DBContext bookappointment = new DBContext();
         bookappointment.BookAppointments.Add(bookAppointment);
         bookappointment.SaveChanges();
         ViewBag.ValidationMessage = "Your details are submitted succesfully.";
         return(View());
     }
 }
        public IActionResult DeleteBookAppointment(int id)
        {
            var claimsPrincipal = User as ClaimsPrincipal;
            var role            = claimsPrincipal.FindFirst("role").Value;

            if (!role.Equals("client"))
            {
                BookAppointment bookAppointment = BookAppointmentDataStore.Current.Appointments.FirstOrDefault(ba => ba.Id == id);
                if (bookAppointment == null)
                {
                    return(NotFound());
                }
                BookAppointmentDataStore.Current.Appointments.Remove(bookAppointment);
                return(NoContent());
            }
            return(Unauthorized());
        }
Example #8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            BookAppointment = await _context.BookAppointments.FindAsync(id);

            if (BookAppointment != null)
            {
                _context.BookAppointments.Remove(BookAppointment);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> Update([FromBody] BookAppointment model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var data = await I_BookAppointment.Update(model);

                    return(Ok(data));
                }
                catch (Exception)
                {
                    return(BadRequest());
                }
            }
            return(BadRequest("ModelState is Invalid"));
        }
        public async Task<IActionResult> OnGetAsync(int? id)
        {
            if (id == null)
            {
                return NotFound();
            }

            BookAppointment = await _context.BookAppointments
                .Include(s => s.Patient)
                .AsNoTracking()
                .FirstOrDefaultAsync(m => m.BookAppointmentID == id);

            if (BookAppointment == null)
            {
                return NotFound();
            }
            return Page();
        }
        public string AddAppointment(BookAppointment appointment)
        {
            try
            {
                DateTime obj = DateTime.Parse(appointment.Start);
                appointment.Start = obj.ToString("yyyy-MM-dd T HH:mm:ss");
                appointment.End   = obj.AddMinutes(appointment.EndMinute).ToString("yyyy-MM-dd T HH:mm:ss");

                var StartTime = DateTime.Parse(appointment.StartHour, CultureInfo.InvariantCulture);
                var Time      = StartTime.ToString("HH:mm").Split(':');

                appointment.StartHour   = Time[0];
                appointment.StartMinute = Time[1];

                string apiURL         = ConfigurationManager.AppSettings["DomainUrl"].ToString() + "/api/booking/BookAppointment";
                string result         = "";
                var    httpWebRequest = (HttpWebRequest)WebRequest.Create(apiURL);
                httpWebRequest.ContentType     = "application/json";
                httpWebRequest.Method          = "POST";
                httpWebRequest.ProtocolVersion = HttpVersion.Version10;
                httpWebRequest.Headers.Add("Token", Request.Headers["Token"]);

                using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
                {
                    var jsonString = new JavaScriptSerializer().Serialize(appointment);
                    streamWriter.Write(jsonString);
                    streamWriter.Flush();
                    streamWriter.Close();
                }

                var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    result = streamReader.ReadToEnd();
                }

                return(result);
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
        public IActionResult CreateBookAppointment([FromBody] BookAppointmentClientForCreateData data)
        {
            var claimsPrincipal      = User as ClaimsPrincipal;
            int clientId             = int.Parse(claimsPrincipal.FindFirst("userId").Value);
            var role                 = claimsPrincipal.FindFirst("role").Value;
            var maxBookAppointmentId = BookAppointmentDataStore.Current.Appointments.Max(ba => ba.Id);
            var newBookAppointment   = new BookAppointment()
            {
                Id       = ++maxBookAppointmentId,
                Cancel   = 0,
                Hour     = data.Hour,
                Date     = data.Date,
                ClientId = clientId,
                BarberId = data.BarberId // TODO: this should be fetched from database
            };

            BookAppointmentDataStore.Current.Appointments.Add(newBookAppointment);
            return(CreatedAtRoute("GetBookAppointmentsById", new { newBookAppointment.Id }, newBookAppointment));
        }
        public IActionResult CreateBookAppointmentForBarber(int clientId, [FromBody] BookAppointmentBarberForCreateData data)
        {
            var claimsPrincipal      = User as ClaimsPrincipal;
            int barberId             = int.Parse(claimsPrincipal.FindFirst("userId").Value);
            var role                 = claimsPrincipal.FindFirst("role").Value;
            var maxBookAppointmentId = BookAppointmentDataStore.Current.Appointments.Max(ba => ba.Id);
            var newBookAppointment   = new BookAppointment()
            {
                Id       = ++maxBookAppointmentId,
                Cancel   = 0,
                Hour     = data.Hour,
                Date     = data.Date,
                ClientId = data.ClientId, // check uitvoeren van barber clients list
                BarberId = barberId
            };

            BookAppointmentDataStore.Current.Appointments.Add(newBookAppointment);
            return(Ok(newBookAppointment));
        }
        public void BookAsync(BookVisitViewModel viewModel)
        {
            AsyncManager.Parameters["viewModel"] = viewModel;

            var calendarValidationMessages = _appointmentService.ValidateBook(new ValidateBookRequest
            {
                EmployeeId   = viewModel.ConsultantId.Value,
                DepartmentId =
                    Constants.SalesDepartmentId,
                Start = viewModel.Start,
                End   = viewModel.End
            }).ToList();

            if (calendarValidationMessages.Any())
            {
                calendarValidationMessages.ForEach(message => ModelState.AddModelError("", message.Text));
                return;
            }

            var bookVisitCommand = new BookVisit
            {
                Id            = viewModel.Id,
                AppointmentId = viewModel.AppointmentId,
                LeadId        = viewModel.LeadId,
                Start         = viewModel.Start,
                End           = viewModel.End,
                ConsultantId  = viewModel.ConsultantId
            };

            var bookAppointmentCommand = new BookAppointment
            {
                Id           = viewModel.AppointmentId,
                EmployeeId   = viewModel.ConsultantId.Value,
                DepartmentId = Constants.SalesDepartmentId,
                Start        = viewModel.Start,
                End          = viewModel.End,
            };

            _bus.Send(bookVisitCommand).Register <SalesReplies.ReturnCode>(returnCode => AsyncManager.Parameters["salesReturnCode"]             = returnCode);
            _bus.Send(bookAppointmentCommand).Register <CalendarReplies.ReturnCode>(returnCode => AsyncManager.Parameters["calendarReturnCode"] = returnCode);
        }
Example #15
0
        public ActionResult Create(PatientViewModel model)
        {
            try
            {
                //model.Status = "Booked";

                BookAppointment objAppoint = new BookAppointment();

                //var claims1 = ClaimsPrincipal.Current.Identities.First();
                objAppoint.PatientId = Int32.Parse(User.Claims.FirstOrDefault(x => x.Type == CLAIM_TYPE_NAME).Value);
                //objAppoint.PatientId = Int32.Parse(User.Claims.);
                objAppoint.DoctorId        = model.SelectedDoctor;
                objAppoint.AppointmentTime = model.AppointmentDate;
                objAppoint.Status          = "Booked";


                _logger.LogInformation(objAppoint.PatientId.ToString());
                _logger.LogInformation(objAppoint.DoctorId.ToString());
                _logger.LogInformation(objAppoint.AppointmentTime.ToString());
                _logger.LogInformation(objAppoint.Status);

                apiProxy.PostAsync("patient/CreateAppointment", objAppoint);

                //if (ModelState.IsValid)
                //{
                //var repo = new CustomersRepository();
                //bool saved = repo.SaveCustomer(model);
                //if (saved)
                //{
                //    return RedirectToAction("Index");
                //}
                //}
                return(RedirectToAction("Index", "Home"));
            }
            catch (ApplicationException ex)
            {
                throw ex;
            }
        }
        public BookAppointment GetDoctorChamberForAppoint(int doctorId, int?doctorChmaberId)
        {
            Query   = "SELECT * FROM ViewDoctorChamber WHERE DoctorId = @doctorId AND Id = @doctorChmaberId";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("doctorId", doctorId);
            Command.Parameters.AddWithValue("doctorChmaberId", doctorChmaberId);
            Connection.Open();
            Reader = Command.ExecuteReader();
            BookAppointment bookAppointment = null;

            while (Reader.Read())
            {
                bookAppointment             = new BookAppointment();
                bookAppointment.DoctorId    = Convert.ToInt32(Reader["DoctorId"]);
                bookAppointment.DoctorName  = Reader["Name"].ToString();
                bookAppointment.ChamberId   = Convert.ToInt32(Reader["Id"]);
                bookAppointment.ChamberName = Reader["ChamberName"].ToString();
            }
            Reader.Close();
            Connection.Close();
            return(bookAppointment);
        }
Example #17
0
 public ActionResult BookAppointment(BookAppointment bookAppointment)
 {
     if (User.IsInRole("User"))
     {
         bookAppointment.SerialNo = GetUserData().UserId;
         bookAppointment.UserId   = GetUserData().UserId;
         bookAppointment.UserName = GetUserData().Name;
         bookAppointment.MobileNo = System.Web.HttpContext.Current.User.Identity.Name;
         bookAppointment.Status   = "Pending";
         string message = aUserManager.ConfirmBookAppointment(bookAppointment);
         if (message == "Success")
         {
             ViewBag.Message = "We have recieved your booking confirmation. If your payment process successful you will get confirmation message and Serial number.";
         }
         else
         {
             ViewBag.ErrorMessage = message;
         }
     }
     ViewBag.GetName = GetUserData().Name;
     ViewBag.GetDoctorDataForAppoint = Session["BookAppoint"] as BookAppointment;
     return(View());
 }
 public ActionResult BookAppointment(BookAppointmentModel ba)
 {
     if (ModelState.IsValid)
     {
         DAL             obj = new DAL();
         BookAppointment b   = new BookAppointment();
         b.AccepterId = (int)Session["aid"];
         b.CaseId     = ba.CaseId;
         b.Date       = ba.Date;
         b.Slot       = ba.Slot;
         b.Status     = ba.Status;
         bool res = obj.BookAppointment(b);
         if (res == true)
         {
             ViewBag.msg = "Appointment Registered successfully";
         }
         else
         {
             ViewBag.msg = "errror";
         }
     }
     return(View(ba));
 }
        public List <BookAppointment> GetUserAllAppointments(int userId)
        {
            Query   = "SELECT * FROM BookAppointment WHERE UserId = @userId AND NOT Status = 'Pending' ORDER BY AppointDate DESC";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("userId", userId);
            Connection.Open();
            Reader = Command.ExecuteReader();
            List <BookAppointment> bookAppointments = new List <BookAppointment>();

            while (Reader.Read())
            {
                BookAppointment bookAppointment = new BookAppointment();
                bookAppointment.DoctorName  = Reader["DoctorName"].ToString();
                bookAppointment.ChamberName = Reader["ChamberName"].ToString();
                bookAppointment.Schedule    = Reader["Schedule"].ToString();
                bookAppointment.AppointDate = Reader["AppointDate"].ToString();
                bookAppointment.SerialNo    = Convert.ToInt32(Reader["SerialNo"]);
                bookAppointments.Add(bookAppointment);
            }
            Reader.Close();
            Connection.Close();
            return(bookAppointments);
        }
Example #20
0
        public BookAppointment GetBookAppointInfo(BookAppointment bookAppointment)
        {
            Query   = "SELECT * FROM BookAppointment WHERE Id = @id AND DoctorId = @doctorId AND ChamberId = @chamberId AND UserId = @userId";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("id", bookAppointment.BookAppointId);
            Command.Parameters.AddWithValue("doctorId", bookAppointment.DoctorId);
            Command.Parameters.AddWithValue("chamberId", bookAppointment.ChamberId);
            Command.Parameters.AddWithValue("userId", bookAppointment.UserId);
            Connection.Open();
            Reader = Command.ExecuteReader();
            BookAppointment bookAppointInfo = null;

            if (Reader.Read())
            {
                bookAppointInfo             = new BookAppointment();
                bookAppointInfo.DoctorName  = Reader["DoctorName"].ToString();
                bookAppointInfo.AppointDate = Reader["AppointDate"].ToString();
                bookAppointInfo.Schedule    = Reader["Schedule"].ToString();
                bookAppointInfo.SerialNo    = Convert.ToInt32(Reader["SerialNo"]);
            }
            Reader.Close();
            Connection.Close();
            return(bookAppointInfo);
        }
Example #21
0
 public int ConfirmAppointment(BookAppointment bookAppoint)
 {
     try
     {
         Query   = "UPDATE BookAppointment SET Status = @status, SerialNo = @serialNo WHERE Id = @id AND UserId = @userdId AND DoctorId = @doctorId AND ChamberId = @chamberId";
         Command = new SqlCommand(Query, Connection);
         Command.Parameters.AddWithValue("status", bookAppoint.Status);
         Command.Parameters.AddWithValue("serialNo", bookAppoint.SerialNo);
         Command.Parameters.AddWithValue("id", bookAppoint.BookAppointId);
         Command.Parameters.AddWithValue("userdId", bookAppoint.UserId);
         Command.Parameters.AddWithValue("doctorId", bookAppoint.DoctorId);
         Command.Parameters.AddWithValue("chamberId", bookAppoint.ChamberId);
         Connection.Open();
         int rowAffected = Command.ExecuteNonQuery();
         Connection.Close();
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Connection.Close();
         int rowAffected = 0;
         return(rowAffected);
     }
 }
        public IActionResult PatchWorkDay(int id, [FromBody] JsonPatchDocument <BookAppointmentForUpdateData> patchDoc)
        {
            BookAppointment bookAppointment = BookAppointmentDataStore.Current.Appointments.FirstOrDefault(ba => ba.Id == id);

            if (bookAppointment == null)
            {
                return(NotFound());
            }
            BookAppointmentForUpdateData patchWorkDay = new BookAppointmentForUpdateData()
            {
                Hour   = bookAppointment.Hour,
                Cancel = bookAppointment.Cancel
            };

            patchDoc.ApplyTo(patchWorkDay);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            bookAppointment.Cancel = patchWorkDay.Cancel;
            bookAppointment.Hour   = patchWorkDay.Hour;
            return(NoContent());
        }
Example #23
0
 public BookAppointment GetBookAppointInfo(BookAppointment bookAppointment)
 {
     return(aMainAdminGateway.GetBookAppointInfo(bookAppointment));
 }
 public Profile GetClient(BookAppointment bookAppointment, IResolverContext ctx)
 {
     return(_profileService.GetAll().Where(p => p.Id == bookAppointment.ClientId).FirstOrDefault());
 }
        public void CreateAppointment()
        {
            try
            {
                DependencyService.Get <IProgressInterface>().Show();

                //InitializeComponent();
                BookAppointment objbookAppointment = new BookAppointment();
                objbookAppointment.CompanyId  = CompanyId;
                objbookAppointment.ServiceId  = ServiceID;
                objbookAppointment.EmployeeId = EmpID;
                objbookAppointment.CustomerIdsCommaSeperated = CustID.ToString();

                var      sH           = TimePeriods;
                var      tf           = sH.Split(' ', '-');
                var      jj           = tf[0] + ' ' + tf[1];
                DateTime timejone     = Convert.ToDateTime(jj);
                var      StartHour    = timejone.ToString("HH");
                var      StartMinutes = timejone.ToString("mm");

                objbookAppointment.StartHour   = StartHour;
                objbookAppointment.StartMinute = StartMinutes;


                objbookAppointment.EndHour   = EndHour;
                objbookAppointment.EndMinute = EndMinute;

                objbookAppointment.IsAdded = true;
                objbookAppointment.Message = "";
                var        GetAllCustomerData = GetAllCustomer();
                List <int> custIDs            = GetAllCustomerData.Select(x => x.Id).ToList();
                custIDs = custIDs.Where(x => x == CustID).ToList();
                objbookAppointment.CustomerIds = custIDs;
                var sDate = dateOfBooking.ToString("yyyy-MM-dd T HH:mm:ss");
                objbookAppointment.Start = sDate;
                var eeDate = dateOfBooking.ToString("yyyy-MM-dd T HH:mm:ss");
                objbookAppointment.End = eeDate;
                if (newAppointmentsPicker.SelectedItem != null)
                {
                    string selectedValue = (newAppointmentsPicker.SelectedItem).ToString();
                    Data.TryGetValue(selectedValue, out StatusId);
                }
                objbookAppointment.Status = StatusId;
                objbookAppointment.Notes  = "";
                var Url            = Application.Current.Properties["DomainUrl"] + "/api/booking/BookAppointment";
                var SerializedData = JsonConvert.SerializeObject(objbookAppointment);
                var result         = PostData("POST", SerializedData, Url);

                dynamic data = JObject.Parse(result);
                var     msg  = Convert.ToString(data.Message);
                DisplayAlert("Success", msg, "ok");

                var      date = book.Split(',');
                DateTime d    = Convert.ToDateTime(date[1]);

                System.DateTime today            = d;
                int             currentDayOfWeek = (int)today.DayOfWeek;
                System.DateTime sunday           = today.AddDays(-currentDayOfWeek);
                System.DateTime monday           = sunday.AddDays(1);
                if (currentDayOfWeek == 0)
                {
                    monday = monday.AddDays(-7);
                }
                var dates    = Enumerable.Range(0, 7).Select(days => monday.AddDays(days)).ToList();
                var eee      = dates[0];
                var fullDate = eee.ToString("ddd dd-MMM-yyyy");
                Navigation.PushAsync(new SetAppointmentPage("", "", fullDate));
            }
            catch (Exception ex)
            {
                var msgs = ex.Message;
                DisplayAlert("success", msgs, "ok");
                ex.ToString();
            }
        }
        public void UpdateAppointments()
        {
            try
            {
                //string[] AppointmentDate = { };
                //string[] TimeAppointment = { };
                //string[] hours = { };
                //string[] Endmins = { };
                //string[] Endmin = { };
                //string Time = UpdateAppointmentTime.Text;
                //if (Time != null)
                //{
                //    TimeAppointment = Time.Split('-');
                //    hours = TimeAppointment[0].Split(':');
                //    Endmins = TimeAppointment[1].Split(':');
                //    Endmin = Endmins[1].Split(' ');
                //}
                //if (AppointmentsPicker.SelectedItem != null)
                //{
                //    string selectedValue = (AppointmentsPicker.SelectedItem).ToString();
                //    Data.TryGetValue(selectedValue, out StatusId);
                //}
                //var GetAllCustomerData = GetAllCustomer();
                //List<int> custIDs = GetAllCustomerData.Select(z => z.Id).ToList();
                //UpdatebookAppointment = new UpdateBookAppointment();
                //UpdatebookAppointment.Id = Application.Current.Properties["BookingID"].ToString();
                //UpdatebookAppointment.CompanyId = Convert.ToInt32(Application.Current.Properties["CompanyId"]);
                //UpdatebookAppointment.EmployeeId = EmpID;
                //UpdatebookAppointment.ServiceId = ServiceID;
                //UpdatebookAppointment.CustomerIdsCommaSeperated = CustID.ToString();
                //UpdatebookAppointment.StartHour = Convert.ToInt32(hours[0]);
                //UpdatebookAppointment.StartMinute = 0;
                //UpdatebookAppointment.EndHour = 0;
                //UpdatebookAppointment.EndMinute = Convert.ToInt32(Endmin[0]);
                //UpdatebookAppointment.IsAdded = true;
                //UpdatebookAppointment.Message = UpdateComment.Text;
                //UpdatebookAppointment.Notes = UpdateComment.Text;
                //UpdatebookAppointment.CustomerIds = custIDs;
                //UpdatebookAppointment.Start = dateOfBooking;
                //UpdatebookAppointment.End = dateOfBooking;
                //UpdatebookAppointment.Status = StatusId;

                UpdatebookAppointment            = new UpdateBookAppointment();
                UpdatebookAppointment.Id         = BookingID;
                UpdatebookAppointment.CompanyId  = CompanyId;
                UpdatebookAppointment.ServiceId  = ServiceID;
                UpdatebookAppointment.EmployeeId = EmpID;
                UpdatebookAppointment.CustomerIdsCommaSeperated = CustID.ToString();
                UpdatebookAppointment.StartHour   = StartHour;
                UpdatebookAppointment.StartMinute = StartMinutes;
                UpdatebookAppointment.EndHour     = EndHour;
                UpdatebookAppointment.EndMinute   = EndMinute;
                UpdatebookAppointment.IsAdded     = true;
                UpdatebookAppointment.Message     = "";

                var        GetAllCustomerData = GetAllCustomer();
                List <int> custIDs            = GetAllCustomerData.Select(x => x.Id).ToList();
                custIDs = custIDs.Where(x => x == CustID).ToList();
                UpdatebookAppointment.CustomerIds = custIDs;
                var sDate = dateOfBooking.ToString("yyyy-MM-dd T HH:mm:ss");
                UpdatebookAppointment.Start = sDate;
                var eeDate = dateOfBooking.ToString("yyyy-MM-dd T HH:mm:ss");
                UpdatebookAppointment.End = eeDate;
                if (AppointmentsPicker.SelectedItem != null)
                {
                    string selectedValue = (AppointmentsPicker.SelectedItem).ToString();
                    Data.TryGetValue(selectedValue, out StatusId);
                }
                UpdatebookAppointment.Status = StatusId;
                UpdatebookAppointment.Notes  = "";



                var             SerializedData      = JsonConvert.SerializeObject(UpdatebookAppointment);
                var             apiUrl              = Application.Current.Properties["DomainUrl"] + "api/booking/UpdateBooking";
                var             result              = PostData("POST", SerializedData, apiUrl);
                BookAppointment objBookappointments = new BookAppointment();
                objBookappointments.CompanyId = UpdatebookAppointment.CompanyId;
                objBookappointments.CustomerIdsCommaSeperated = UpdatebookAppointment.CustomerIdsCommaSeperated;
                objBookappointments.EmployeeId  = UpdatebookAppointment.EmployeeId;
                objBookappointments.ServiceId   = UpdatebookAppointment.ServiceId;
                objBookappointments.StartHour   = UpdatebookAppointment.StartHour;
                objBookappointments.StartMinute = UpdatebookAppointment.StartMinute;
                objBookappointments.EndHour     = UpdatebookAppointment.EndHour;
                objBookappointments.EndMinute   = UpdatebookAppointment.EndMinute;
                objBookappointments.IsAdded     = UpdatebookAppointment.IsAdded;
                objBookappointments.Message     = UpdatebookAppointment.Message;
                objBookappointments.Notes       = UpdatebookAppointment.Notes;
                objBookappointments.CustomerIds = UpdatebookAppointment.CustomerIds;
                objBookappointments.Start       = UpdatebookAppointment.Start.ToString();
                objBookappointments.End         = UpdatebookAppointment.End.ToString();
                objBookappointments.Status      = UpdatebookAppointment.Status;

                dynamic data = JObject.Parse(result);
                var     msg  = Convert.ToString(data.Message);
                DisplayAlert("Success", msg, "ok");

                for (int PageIndex = Navigation.NavigationStack.Count - 1; PageIndex >= 4; PageIndex--)
                {
                    Navigation.RemovePage(Navigation.NavigationStack[PageIndex]);
                }

                // Navigation.PopAsync(true);

                Navigation.PushAsync(new AddAppointmentsPage(objBookappointments));
            }
            catch (Exception e)
            {
                e.ToString();
            }
        }
Example #27
0
        public ManageAppointment GetDoctorAppointInfo(BookAppointment bookAppoint)
        {
            Query   = "SELECT * FROM ManageAppointVM WHERE DoctorId = @doctorId AND MedicalId = @chamberId AND Expired = 'False'";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("doctorId", bookAppoint.DoctorId);
            Command.Parameters.AddWithValue("chamberId", bookAppoint.ChamberId);
            Connection.Open();
            Reader = Command.ExecuteReader();
            ManageAppointment manageAppointment = null;

            while (Reader.Read())
            {
                manageAppointment    = new ManageAppointment();
                manageAppointment.Id = Convert.ToInt32(Reader["Id"]);
                manageAppointment.SatAvailableAppoint   = Convert.ToInt32(Reader["SatAvailableAppoint"]);
                manageAppointment.SunAvailableAppoint   = Convert.ToInt32(Reader["SunAvailableAppoint"]);
                manageAppointment.MonAvailableAppoint   = Convert.ToInt32(Reader["MonAvailableAppoint"]);
                manageAppointment.TueAvailableAppoint   = Convert.ToInt32(Reader["TueAvailableAppoint"]);
                manageAppointment.WedAvailableAppoint   = Convert.ToInt32(Reader["WedAvailableAppoint"]);
                manageAppointment.ThuAvailableAppoint   = Convert.ToInt32(Reader["ThuAvailableAppoint"]);
                manageAppointment.FriAvailableAppoint   = Convert.ToInt32(Reader["FriAvailableAppoint"]);
                manageAppointment.TotalAvailableAppoint = Convert.ToInt32(Reader["TotalAvailableAppoint"]);
                manageAppointment.RemainingAppoint      = Convert.ToInt32(Reader["RemainingAppoint"]);
                manageAppointment.TotalAppoint          = Convert.ToInt32(Reader["TotalAppoint"]);
                manageAppointment.OrderedAppoint        = Convert.ToInt32(Reader["AppointAmount"]);
                manageAppointment.DoctorId  = Convert.ToInt32(Reader["DoctorId"]);
                manageAppointment.MedicalId = Convert.ToInt32(Reader["MedicalId"]);
            }
            Reader.Close();
            Connection.Close();
            if (manageAppointment == null)
            {
                Query   = "SELECT * FROM ManageAppointVM WHERE DoctorId = @doctorId AND DoctorChamberId = @chamberId AND Expired = 'False'";
                Command = new SqlCommand(Query, Connection);
                Command.Parameters.AddWithValue("doctorId", bookAppoint.DoctorId);
                Command.Parameters.AddWithValue("chamberId", bookAppoint.ChamberId);
                Connection.Open();
                Reader = Command.ExecuteReader();
                while (Reader.Read())
                {
                    manageAppointment    = new ManageAppointment();
                    manageAppointment.Id = Convert.ToInt32(Reader["Id"]);
                    manageAppointment.SatAvailableAppoint   = Convert.ToInt32(Reader["SatAvailableAppoint"]);
                    manageAppointment.SunAvailableAppoint   = Convert.ToInt32(Reader["SunAvailableAppoint"]);
                    manageAppointment.MonAvailableAppoint   = Convert.ToInt32(Reader["MonAvailableAppoint"]);
                    manageAppointment.TueAvailableAppoint   = Convert.ToInt32(Reader["TueAvailableAppoint"]);
                    manageAppointment.WedAvailableAppoint   = Convert.ToInt32(Reader["WedAvailableAppoint"]);
                    manageAppointment.ThuAvailableAppoint   = Convert.ToInt32(Reader["ThuAvailableAppoint"]);
                    manageAppointment.FriAvailableAppoint   = Convert.ToInt32(Reader["FriAvailableAppoint"]);
                    manageAppointment.TotalAvailableAppoint = Convert.ToInt32(Reader["TotalAvailableAppoint"]);
                    manageAppointment.RemainingAppoint      = Convert.ToInt32(Reader["RemainingAppoint"]);
                    manageAppointment.TotalAppoint          = Convert.ToInt32(Reader["TotalAppoint"]);
                    manageAppointment.OrderedAppoint        = Convert.ToInt32(Reader["AppointAmount"]);
                    manageAppointment.DoctorId        = Convert.ToInt32(Reader["DoctorId"]);
                    manageAppointment.DoctorChamberId = Convert.ToInt32(Reader["DoctorChamberId"]);
                }
                Reader.Close();
                Connection.Close();
            }
            return(manageAppointment);
        }
        public void BookAsync(BookVisitViewModel viewModel)
        {
            AsyncManager.Parameters["viewModel"] = viewModel;

            var calendarValidationMessages = _appointmentService.ValidateBook(new ValidateBookRequest
            {
                EmployeeId = viewModel.ConsultantId.Value,
                DepartmentId =
                    Constants.SalesDepartmentId,
                Start = viewModel.Start,
                End = viewModel.End
            }).ToList();

            if (calendarValidationMessages.Any())
            {
                calendarValidationMessages.ForEach(message => ModelState.AddModelError("", message.Text));
                return;
            }

            var bookVisitCommand = new BookVisit
                              {
                                  Id = viewModel.Id,
                                  AppointmentId = viewModel.AppointmentId,
                                  LeadId = viewModel.LeadId,
                                  Start = viewModel.Start,
                                  End = viewModel.End,
                                  ConsultantId = viewModel.ConsultantId
                              };

            var bookAppointmentCommand = new BookAppointment
                                             {
                                                 Id = viewModel.AppointmentId,
                                                 EmployeeId = viewModel.ConsultantId.Value,
                                                 DepartmentId = Constants.SalesDepartmentId,
                                                 Start = viewModel.Start,
                                                 End = viewModel.End,
                                             };

            _bus.Send(bookVisitCommand).Register<SalesReplies.ReturnCode>(returnCode => AsyncManager.Parameters["salesReturnCode"] = returnCode);
            _bus.Send(bookAppointmentCommand).Register<CalendarReplies.ReturnCode>(returnCode => AsyncManager.Parameters["calendarReturnCode"] = returnCode);
        }
        public void CreateAppointment()
        {
            try
            {
                BookAppointment objbookAppointment = new BookAppointment();
                objbookAppointment.CompanyId  = CompanyId;
                objbookAppointment.ServiceId  = ServiceID;
                objbookAppointment.EmployeeId = EmpID;
                objbookAppointment.CustomerIdsCommaSeperated = CustID.ToString();

                var      sH           = TimePeriods;
                var      tf           = sH.Split(' ', '-');
                var      jj           = tf[0] + ' ' + tf[1];
                DateTime timejone     = Convert.ToDateTime(jj);
                var      StartHour    = timejone.ToString("HH");
                var      StartMinutes = timejone.ToString("mm");

                objbookAppointment.StartHour   = StartHour;
                objbookAppointment.StartMinute = StartMinutes;
                objbookAppointment.EndHour     = EndHour;
                objbookAppointment.EndMinute   = EndMinute;
                objbookAppointment.IsAdded     = true;
                objbookAppointment.Message     = "";

                var        GetAllCustomerData = GetAllCustomer();
                List <int> custIDs            = GetAllCustomerData.Select(x => x.Id).ToList();
                custIDs = custIDs.Where(x => x == CustID).ToList();
                objbookAppointment.CustomerIds = custIDs;
                var sDate = dateOfBooking.ToString("yyyy-MM-dd T HH:mm:ss");
                objbookAppointment.Start = sDate;
                var eeDate = dateOfBooking.ToString("yyyy-MM-dd T HH:mm:ss");
                objbookAppointment.End = eeDate;
                if (newAppointmentsPicker.SelectedItem != null)
                {
                    string selectedValue = (newAppointmentsPicker.SelectedItem).ToString();
                    Data.TryGetValue(selectedValue, out StatusId);
                }
                objbookAppointment.Status = StatusId;
                objbookAppointment.Notes  = "";

                var Url            = Application.Current.Properties["DomainUrl"] + "/api/booking/BookAppointment";
                var SerializedData = JsonConvert.SerializeObject(objbookAppointment);
                var result         = PostData("POST", SerializedData, Url);

                dynamic data = JObject.Parse(result);
                var     msg  = Convert.ToString(data.Message);
                DisplayAlert("Success", msg, "ok");

                for (int PageIndex = Navigation.NavigationStack.Count - 1; PageIndex >= 5; PageIndex--)
                {
                    Navigation.RemovePage(Navigation.NavigationStack[PageIndex]);
                }

                // Navigation.PopAsync(true);

                Navigation.PushAsync(new AddAppointmentsPage(objbookAppointment));
            }
            catch (Exception e)
            {
                e.ToString();
            }
        }
Example #30
0
 public ManageAppointment GetDoctorAppointInfo(BookAppointment bookAppoint)
 {
     return(aMainAdminGateway.GetDoctorAppointInfo(bookAppoint));
 }
Example #31
0
 public BookAppointment SaveAppointment(BookAppointment bApp)
 {
     return(_bookAppService.SaveAppointment(bApp));
 }