Exemple #1
0
        public void SendAppointmentDetails(ClientMotherModel motherRequest, ScanCenterProfileModel profile, string referid,
                                           string baseUrl = "", bool includeLink = false, bool isMotherAppointment = true)
        {
            string link = string.Empty;

            //string googleCalC2M = string.Empty;
            if (!string.IsNullOrEmpty(referid))
            {
                referid = HttpUtility.UrlEncode(referid);
            }
            if (!motherRequest.IsCompleted)
            {
                link = $@"<a href='{baseUrl}/mother/{profile.UniqueName}?refer={referid}'>Registration Link</a>";
            }


            this.To      = motherRequest.Email;
            this.ReplyTo = new MailAddress(profile.Email, profile.Name);
            this.Subject = "Appointment - Verify and Confirm";
            this.Body    = $@"Hi {motherRequest.FirstName},
                                        <br>
                                        Thank you for scheduling your Ultrasound appointment with us. Prior to your appointment, please complete your registration by clicking the link below. We look forward to seeing you and your baby soon.<br><br>
                                         {link}<br><br>
                                        Thank you and have a great day!<br>
                                        {profile.Name}
                                        ";
            this.Send();
        }
        public async Task <IActionResult> IndexPost(int id, [FromBody] ClientMotherModel motherRequest)
        {
            if (motherRequest == null)
            {
                return(BadRequest());
            }

            try
            {
                motherRequest.AppointmentDate = DateTime.Now;
            }
            catch
            {
            }
            motherRequest.IsCompleted = false;
            var profile = await _scanCenterProfileQuery.GetById(id);

            if (profile != null)
            {
                motherRequest.Id = await _clientMotherQuery.CreateMotherProfile(profile.Id, motherRequest);

                string baseUrl = $"{Request.Scheme}://{Request.Host}";
                _emailManager.SMTPSettings = _appSettings.SMTPSettings;
                string referid = await _cryptography.Encrypt(motherRequest.Id.ToString(), _appSettings);

                _emailManager.SendAppointmentDetails(motherRequest, profile, referid, baseUrl, true);
                _emailManager.SendNotification(motherRequest, profile, baseUrl);

                return(Ok(new { id = motherRequest.Id }));
            }
            return(BadRequest());
        }
Exemple #3
0
        public async Task <IActionResult> UpdateAppointment(int id, [FromBody] ClientMotherModel motherRequest)
        {
            if (motherRequest == null)
            {
                return(BadRequest());
            }

            try
            {
                motherRequest.AppointmentDate = Utilities.Utilities.ConvertStringToDateTime(motherRequest.Date, motherRequest.Time);
            }
            catch
            {
            }

            motherRequest.IsCompleted = true;
            var profile = await _scanCenterProfileQuery.GetById(id);

            if (profile != null)
            {
                await _scanCenterAppointmentQuery.UpdateAppointment(motherRequest);

                _emailManager.SMTPSettings = _appSettings.SMTPSettings;
                string referid = await _cryptography.Encrypt(motherRequest.Id.ToString(), _appSettings);

                return(Ok(new { id = motherRequest.Id }));
            }

            return(BadRequest());
        }
        public async Task <IActionResult> UpdateAppointment(int id, [FromBody] ClientMotherModel motherRequest)
        {
            if (motherRequest == null)
            {
                return(BadRequest());
            }

            var profile = await _scanCenterProfileQuery.GetById(motherRequest.ScanCenterProfileId);

            var appointment = await _scanCenterAppointmentQuery.GetById(motherRequest.Id);

            appointment.FirstName        = motherRequest.FirstName;
            appointment.LastName         = motherRequest.LastName;
            appointment.Email            = motherRequest.Email;
            appointment.Phone            = motherRequest.Phone;
            appointment.Purpose          = motherRequest.Purpose;
            appointment.InsuranceNumber  = motherRequest.InsuranceNumber;
            appointment.InsuranceCompany = motherRequest.InsuranceCompany;
            appointment.InsuranceGroup   = motherRequest.InsuranceGroup;
            appointment.SelectedProducts = motherRequest.SelectedProducts;
            appointment.AppointmentDate  = DateTime.Now;
            appointment.OtherDetails     = motherRequest.OtherDetails;
            appointment.DueDate          = motherRequest.DueDate;
            appointment.DOB = motherRequest.DOB;
            appointment.IsInsuranceRequired = motherRequest.IsInsuranceRequired;
            appointment.IsBreastPumpNeeded  = motherRequest.IsBreastPumpNeeded;


            appointment.Address  = motherRequest.Address;
            appointment.Address2 = motherRequest.Address2;
            appointment.Apt      = motherRequest.Apt;
            appointment.City     = motherRequest.City;
            appointment.State    = motherRequest.State;
            appointment.Zip      = motherRequest.Zip;

            appointment.DoctorName  = motherRequest.DoctorName;
            appointment.DoctorPhone = motherRequest.DoctorPhone;

            if (!await CheckAuth(motherRequest.ScanCenterProfileId))
            {
                return(BadRequest());
            }

            if (profile != null)
            {
                await _scanCenterAppointmentQuery.UpdateAppointment(appointment);

                _emailManager.SMTPSettings = _appSettings.SMTPSettings;
                string referid = await _cryptography.Encrypt(appointment.Id.ToString(), _appSettings);

                return(Ok(new { success = "success" }));
            }
            return(BadRequest());
        }
Exemple #5
0
        public void SendNotification(ClientMotherModel motherRequest, ScanCenterProfileModel profile, string baseUrl)
        {
            string emailSubject = "A new customer signed";

            if (motherRequest.IsInsuranceRequired)
            {
                emailSubject = "A new customer signed - Mommy Care Kit";
            }
            this.To      = this.SMTPSettings.DefaultTo;
            this.Subject = emailSubject;
            string mck = (!motherRequest.IsInsuranceRequired) ? "No" : "Yes";
            string bp  = (motherRequest.IsBreastPumpNeeded ? "Yes" : "No");

            this.Body = @$ "Hi,<br>
                                        A new customer signed. Please check your dashboard for details.<br>
                                        Client Name: {motherRequest.FirstName} {motherRequest.LastName}<br>
Exemple #6
0
        public async Task <IActionResult> Index(string name, [FromQuery] string refer)
        {
            var profile = await _scanCenterProfileQuery.GetByUniqueName(name);

            ViewData["ProfileId"] = 0;
            if (profile != null)
            {
                var fields = await _scanCenterCustomFieldQuery.GetAllFields(profile.Id);

                ViewData["UniqueName"] = profile.UniqueName;
                ViewData["ProfileId"]  = profile.Id;

                int appid = 0;
                if (!string.IsNullOrEmpty(refer))
                {
                    try
                    {
                        refer = HttpUtility.UrlDecode(refer).Replace(" ", "+");
                        appid = int.Parse(await _cryptography.Decrypt(refer, _appSettings));
                    }
                    catch
                    {
                    }
                }
                ClientMotherModel appointment = await _scanCenterAppointmentQuery.GetById(appid);

                var list = await _scanCenterProductQuery.GetByScanCenterId(profile.Id);

                string[] allCat     = list.Select(s => s.Category).Distinct().ToArray();
                var      tupleModel = new Tuple <ScanCenterProfileModel, IList <ScanCenterCustomFieldModel>,
                                                 string[], ClientMotherModel>(profile, fields, allCat, appointment);
                return(View(tupleModel));
            }
            var tupleModel1 = new Tuple <ScanCenterProfileModel, IList <ScanCenterCustomFieldModel>,
                                         string[], ClientMotherModel>(profile, null, null, null);

            return(View(tupleModel1));
        }