Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public AccountDisabledViewModel()
 {
     if (App.ObjBrandingResponse != null)
     {
         GetPharmacyInformationResponse objbrandinfo = new GetPharmacyInformationResponse();
         objbrandinfo        = App.ObjBrandingResponse;
         PrimaryColour       = App.ObjBrandingResponse.payload.branding_data.appearance.primary_colour;
         AppBarPrimaryColour = App.ObjBrandingResponse.payload.branding_data.appearance.primary_colour;
         SecondaryColour     = Utilities.GetColorFromHexa(App.ObjBrandingResponse.payload.branding_data.appearance.secondary_colour);
         FontColor           = Utilities.GetColorFromHexa(App.ObjBrandingResponse.payload.branding_data.appearance.font_colour);
         PharmacyName        = App.ObjBrandingResponse.payload.branding_data.pharmacy_name;
         AddressLine1        = objbrandinfo.payload.branding_data.address1;
         AddressLine2        = objbrandinfo.payload.branding_data.address2;
         AddressLine3        = objbrandinfo.payload.branding_data.city;
         PinCode             = objbrandinfo.payload.branding_data.postcode;
         PhoneNumber         = objbrandinfo.payload.branding_data.phone;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Method to get the response
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pharmacyinfodynamicsplashwebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            GetPharmacyInformationResponse objPhBrandingInfoResponse = null;

            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objPhBrandingInfoResponse = Utils.JsonHelper.Deserialize <GetPharmacyInformationResponse>(response);
                    if ((objPhBrandingInfoResponse.payload != null) && (objPhBrandingInfoResponse.status == 0))
                    {
                        App.ObjBrandingResponse = objPhBrandingInfoResponse;
                        imgUrl = objPhBrandingInfoResponse.payload.branding_data.appearance.splash_url.Replace("https", "http");
                        objDynaViewModel.DynamicSplashImageUrl = new BitmapImage(new Uri(imgUrl, UriKind.Absolute));

                        App.AdImages = null;

                        foreach (var item in objPhBrandingInfoResponse.payload.advert_data)
                        {
                            if (App.AdImages == null)
                            {
                                App.AdImages = new List <string>();
                                App.AdImages.Add(item.image_url.Replace("https", "http"));
                            }
                            else
                            {
                                App.AdImages.Add(item.image_url.Replace("https", "http"));
                            }
                        }
                    }
                    if (!IsStaticSplash)
                    {
                        if (((App)Application.Current).RootVisual != null)
                        {
                            ((App)Application.Current).RootVisual.Dispatcher.BeginInvoke(View.DynamicSplashScreenControl.UpdationComplete);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Web service response for pharmacy information in signup screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void pharmacyinfowebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            GetPharmacyInformationResponse objLoginResponse = null;

            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objLoginResponse = Utils.JsonHelper.Deserialize <GetPharmacyInformationResponse>(response);
                    if ((objLoginResponse.payload != null) && (objLoginResponse.status == 0))
                    {
                        App.LoginPharmacyname                             = objLoginResponse.payload.branding_data.pharmacy_name;
                        App.BrandingHash                                  = objLoginResponse.payload.branding_hash;
                        App.AdvtHash                                      = objLoginResponse.payload.advert_hash;
                        App.DrugsData                                     = objLoginResponse.payload.drugs_data;
                        objSignUpViewModel.PharmacyName                   = objLoginResponse.payload.branding_data.pharmacy_name;
                        objSignUpViewModel.AddressLine1                   = objLoginResponse.payload.branding_data.address1;
                        objSignUpViewModel.AddressLine2                   = objLoginResponse.payload.branding_data.address2;
                        objSignUpViewModel.AddressLine3                   = objLoginResponse.payload.branding_data.city;
                        objSignUpViewModel.PinCode                        = objLoginResponse.payload.branding_data.postcode;
                        objSignUpViewModel.IsPharmacyDetailsVisible       = Visibility.Visible;
                        objSignUpViewModel.ProgressBarVisibiltyGetDetails = Visibility.Collapsed;
                        objSignUpViewModel.IsGetDetailsEnabled            = true;
                    }

                    else
                    {
                        objSignUpViewModel.ProgressBarVisibiltyGetDetails = Visibility.Collapsed;
                        objSignUpViewModel.IsPopupOpen   = true;
                        objSignUpViewModel.PopupText     = objLoginResponse.message;
                        objSignUpViewModel.HitVisibility = false;
                    }
                }
            }
            catch (Exception)
            {
                objSignUpViewModel.ProgressBarVisibiltyGetDetails = Visibility.Collapsed;
                objSignUpViewModel.HitVisibility = true;
                MessageBox.Show("Sorry, Unable to process your request.");
                objSignUpViewModel.IsGetDetailsEnabled = true;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Method to get the response for advertisement images
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pharmacyinfoadvtimageswebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            GetPharmacyInformationResponse objPhBrandingInfoResponse = null;

            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objPhBrandingInfoResponse = Utils.JsonHelper.Deserialize <GetPharmacyInformationResponse>(response);
                    if ((objPhBrandingInfoResponse.payload != null) && (objPhBrandingInfoResponse.status == 0))
                    {
                        App.ObjBrandingResponse = objPhBrandingInfoResponse;
                        App.DrugDBHash          = objPhBrandingInfoResponse.payload.drugs_hash;
                        App.AdImages            = null;
                        foreach (var item in objPhBrandingInfoResponse.payload.advert_data)
                        {
                            if (App.AdImages == null)
                            {
                                App.AdImages = new List <string>();
                                App.AdImages.Add(item.image_url.Replace("https", "http"));
                            }
                            else
                            {
                                App.AdImages.Add(item.image_url.Replace("https", "http"));
                            }
                        }

                        objYourDetlginViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                        objYourDetlginViewModel.IsSuccessPopupOpen   = true;
                        objYourDetlginViewModel.HitVisibility        = false;
                        objYourDetlginViewModel.SuccessPopupText     = "Patient has been created.";// "Patient created.";
                    }
                }
            }
            catch (Exception)
            {
                objYourDetlginViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                objYourDetlginViewModel.HitVisibility        = true;
                MessageBox.Show("Sorry, Unable to process your request.");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Web service response for pharmacy information in signup screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void checkpharmacyinfowebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            GetPharmacyInformationResponse objLoginResponse = null;

            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objLoginResponse = Utils.JsonHelper.Deserialize <GetPharmacyInformationResponse>(response);
                    if (objLoginResponse.status == 0)
                    {
                        App.SignUpPharId        = objSignUpViewModel.SignUpPharmacyID;
                        App.BrandingHash        = objLoginResponse.payload.branding_hash;
                        App.AdvtHash            = objLoginResponse.payload.advert_hash;
                        App.DrugsData           = objLoginResponse.payload.drugs_data;
                        App.DrugDBHash          = objLoginResponse.payload.drugs_hash;
                        App.ObjBrandingResponse = objLoginResponse;
                        objSignUpViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                        objSignUpViewModel.HitVisibility        = true;
                        PhoneApplicationFrame frame = (PhoneApplicationFrame)Application.Current.RootVisual;
                        frame.Navigate(new Uri(PageURL.navigateToYourDetailsLoginURL, UriKind.Relative));
                    }
                    else
                    {
                        objSignUpViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                        objSignUpViewModel.IsPopupOpen          = true;
                        objSignUpViewModel.HitVisibility        = false;
                        objSignUpViewModel.PopupText            = objLoginResponse.message;
                    }
                }
            }
            catch (Exception)
            {
                objSignUpViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                objSignUpViewModel.HitVisibility        = true;
                MessageBox.Show("Sorry, Unable to process your request.");
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Response for Branding Info
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pharmacyinfoforbrandingwebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            GetPharmacyInformationResponse objPhBrandingInfoResponse = null;

            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objPhBrandingInfoResponse = Utils.JsonHelper.Deserialize <GetPharmacyInformationResponse>(response);
                    if ((objPhBrandingInfoResponse.payload != null) && (objPhBrandingInfoResponse.status == 0))
                    {
                        App.ObjBrandingResponse = objPhBrandingInfoResponse;

                        App.BrandingHash = objPhBrandingInfoResponse.payload.branding_hash;
                        App.AdvtHash     = objPhBrandingInfoResponse.payload.advert_hash;
                        App.DrugsData    = objPhBrandingInfoResponse.payload.drugs_data;
                        App.DrugDBHash   = objPhBrandingInfoResponse.payload.drugs_hash;
                        App.AddImages    = null;
                        foreach (var item in objPhBrandingInfoResponse.payload.advert_data)
                        {
                            if (App.AddImages == null)
                            {
                                App.AddImages  = new List <BitmapImage>();
                                App.ImagesUrl  = new List <string>();
                                App.ImagesName = new List <string>();
                            }
                            if (item.image_url != null)
                            {
                                Uri         uri = new Uri(item.image_url.Replace("https", "http"));
                                BitmapImage bmi = new BitmapImage(uri);
                                App.ImagesUrl.Add(item.url);
                                App.ImagesName.Add(item.name);
                                App.AddImages.Add(bmi);
                            }
                            else
                            {
                                Color           backgroundColor = ConvertStringToColor(item.image_builder.background_color);
                                Color           foreroundColor2 = ConvertStringToColor(item.image_builder.font_color);
                                SolidColorBrush backgroundBrush = new SolidColorBrush(backgroundColor);
                                SolidColorBrush foregroundBrush = new SolidColorBrush(foreroundColor2);
                                string          text            = item.image_builder.line1 + Environment.NewLine + Environment.NewLine + item.image_builder.line2;
                                WriteableBitmap bmpSmall        = new WriteableBitmap(200, 120);

                                Grid grid = new Grid();
                                grid.Width  = bmpSmall.PixelWidth;
                                grid.Height = bmpSmall.PixelHeight;

                                var background = new Canvas();
                                background.Width      = bmpSmall.PixelWidth;
                                background.Height     = bmpSmall.PixelHeight;
                                background.Background = backgroundBrush;
                                var textBlock = new TextBlock();
                                textBlock.Width               = bmpSmall.PixelWidth;
                                textBlock.FontFamily          = new FontFamily("Segoe WP Light");
                                textBlock.Text                = text;
                                textBlock.HorizontalAlignment = HorizontalAlignment.Stretch;
                                textBlock.VerticalAlignment   = VerticalAlignment.Center;
                                textBlock.FontSize            = 12;
                                textBlock.TextWrapping        = TextWrapping.Wrap;
                                textBlock.Foreground          = foregroundBrush;
                                textBlock.TextAlignment       = TextAlignment.Center;
                                grid.Children.Add(background);
                                grid.Children.Add(textBlock);
                                grid.Measure(new Size(bmpSmall.PixelWidth, bmpSmall.PixelHeight));
                                grid.Arrange(new Rect(0, 0, bmpSmall.PixelWidth, bmpSmall.PixelHeight));
                                grid.UpdateLayout();
                                bmpSmall.Render(grid, null);
                                bmpSmall.Invalidate();

                                using (MemoryStream ms = new MemoryStream())
                                {
                                    bmpSmall.SaveJpeg(ms, 200, 120, 0, 100);
                                    BitmapImage bmp = new BitmapImage();
                                    bmp.SetSource(ms);
                                    App.ImagesUrl.Add(item.url);
                                    App.ImagesName.Add(item.name);
                                    App.AddImages.Add(bmp);
                                }
                            }
                        }
                    }
                    LoginUserDetailsWebService();
                }
            }
            catch (Exception ex)
            {
                objSignUpViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                objSignUpViewModel.HitVisibility        = true;
                MessageBox.Show("Sorry, Unable to process your request.");
            }
        }
        /// <summary>
        /// Response for Pharmacy Details
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pharmacydetailswebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            GetPharmacyInformationResponse objPhDetResponse = null;

            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objPhDetResponse = Utils.JsonHelper.Deserialize <GetPharmacyInformationResponse>(response);
                    if ((objPhDetResponse.payload != null) && (objPhDetResponse.status == 0))
                    {
                        App.ObjBrandingResponse = objPhDetResponse;


                        objHomePanoramaVM.AppBarPrimaryColour = App.ObjBrandingResponse.payload.branding_data.appearance.primary_colour;
                        objHomePanoramaVM.PrimaryColour       = Utilities.GetColorFromHexa(App.ObjBrandingResponse.payload.branding_data.appearance.primary_colour);
                        objHomePanoramaVM.SecondaryColour     = Utilities.GetColorFromHexa(App.ObjBrandingResponse.payload.branding_data.appearance.secondary_colour);
                        objHomePanoramaVM.FontColor           = Utilities.GetColorFromHexa(App.ObjBrandingResponse.payload.branding_data.appearance.font_colour);


                        objHomePanoramaVM.PharmacyName       = objPhDetResponse.payload.branding_data.pharmacy_name;
                        objHomePanoramaVM.PharmacyBranchName = objPhDetResponse.payload.branding_data.branch_name + @"               ";
                        App.PharmacyBranchName         = objHomePanoramaVM.PharmacyBranchName;
                        objHomePanoramaVM.AddressLine1 = objPhDetResponse.payload.branding_data.address1;
                        App.LoginPharmacyAddress1      = objPhDetResponse.payload.branding_data.address1;
                        objHomePanoramaVM.AddressLine2 = objPhDetResponse.payload.branding_data.address2;
                        App.LoginPharmacyAddress2      = objPhDetResponse.payload.branding_data.address2;
                        objHomePanoramaVM.AddressLine3 = objPhDetResponse.payload.branding_data.city;
                        objHomePanoramaVM.PinCode      = objPhDetResponse.payload.branding_data.postcode;
                        App.PostCode = objPhDetResponse.payload.branding_data.postcode;
                        objHomePanoramaVM.PharmacistName1 = objPhDetResponse.payload.branding_data.pharmacist1;
                        objHomePanoramaVM.PharmacistName2 = objPhDetResponse.payload.branding_data.pharmacist2;
                        objHomePanoramaVM.WebsiteLink     = objPhDetResponse.payload.branding_data.website;

                        App.PharmacyPhoneNo = objPhDetResponse.payload.branding_data.phone;
                        App.DrugsData       = objPhDetResponse.payload.drugs_data;
                        if (App.DrugDBHash != objPhDetResponse.payload.drugs_hash)
                        {
                            UpdateDBFile();
                        }

                        if (!string.IsNullOrEmpty(objPhDetResponse.payload.branding_data.twitter_link) && !string.IsNullOrWhiteSpace(objPhDetResponse.payload.branding_data.twitter_link))
                        {
                            objHomePanoramaVM.IsTwitterLinkVisible = Visibility.Visible;
                            objHomePanoramaVM.TwitterLink          = objPhDetResponse.payload.branding_data.twitter_link;
                        }
                        if (!string.IsNullOrEmpty(objPhDetResponse.payload.branding_data.facebook_link) && !string.IsNullOrWhiteSpace(objPhDetResponse.payload.branding_data.facebook_link))
                        {
                            objHomePanoramaVM.IsFacebookLinkVisible = Visibility.Visible;
                            objHomePanoramaVM.FacebookLink          = objPhDetResponse.payload.branding_data.facebook_link;
                        }

                        if (objPhDetResponse.payload.branding_data.opening_hours != null)
                        {
                            bool   isClosedToday = objPhDetResponse.payload.branding_data.opening_hours.SingleOrDefault(s => s.dayname == Convert.ToString(System.DateTime.Today.DayOfWeek)).is_closed;
                            string openingTime   = Convert.ToString(objPhDetResponse.payload.branding_data.opening_hours.SingleOrDefault(s => s.dayname == Convert.ToString(System.DateTime.Today.DayOfWeek)).open);
                            string closingTime   = Convert.ToString(objPhDetResponse.payload.branding_data.opening_hours.SingleOrDefault(s => s.dayname == Convert.ToString(System.DateTime.Today.DayOfWeek)).close);
                            string todayOpenTime = !isClosedToday ? openingTime + "-" + closingTime : "Closed";

                            objHomePanoramaVM.Opentodaytime = todayOpenTime;

                            List <OpenHours> lstOpenHours = new List <OpenHours>();
                            OpenHours        objOpenHours;
                            foreach (var item in objPhDetResponse.payload.branding_data.opening_hours)
                            {
                                objOpenHours = new OpenHours {
                                    DayName = item.dayname, Timings = !item.is_closed ? item.open + "-" + item.close : "Closed"
                                };
                                lstOpenHours.Add(objOpenHours);
                            }
                            objHomePanoramaVM.OpeningHours = lstOpenHours;
                        }

                        if (objPhDetResponse.payload.advert_data != null)
                        {
                            objHomePanoramaVM.AdvertisementData = new ObservableCollection <AdvertData>(objPhDetResponse.payload.advert_data);
                            App.AdImages = null;
                            foreach (var item in objPhDetResponse.payload.advert_data)
                            {
                                if (App.AdImages == null)
                                {
                                    App.AdImages = new List <string>();
                                    App.AdImages.Add(item.image_url.Replace("https", "http"));
                                }
                                else
                                {
                                    App.AdImages.Add(item.image_url.Replace("https", "http"));
                                }
                            }
                        }
                        objHomePanoramaVM.ProgressBarVisibilty = Visibility.Collapsed;
                    }
                }
            }
            catch (Exception)
            {
                objHomePanoramaVM.ProgressBarVisibilty = Visibility.Collapsed;
            }
        }