Esempio n. 1
0
        /// <summary>
        /// Binds the alerts.
        /// </summary>
        async Task BindAlertNewsFeed()
        {
            try
            {
                string strAppliedEntityDisplayName = pckHospital.Items[pckHospital.SelectedIndex];
                var    objAppliedEntityHospital    = ApplicationObject.CurrentUser.Entities.Where(itm => itm.DisplayName == strAppliedEntityDisplayName).SingleOrDefault();

                //Load the Alerts
                UserDialogs.Instance.ShowLoading("Fetching alerts..");
                objClassListAlertNewsFeed = await AlertAccessLayer.GetAlerts(new AlertNewsRequest { AppliedEntityId = objAppliedEntityHospital.AppliedEntityId });

                UserDialogs.Instance.HideLoading();
                //var jsonStringNewsFeed = "[{    \"Id\": 10,    \"AppliedEntityId\": 234,    \"TypeId\": 1,    \"Type\": \"Loaner Inventory Checked-In Late\",    \"CategoryId\": 2,    \"Category\": \"Loaner\",    \"AlertDateTime\": \"2016-12-28T16:23:36.177\",    \"Data\": [        {            \"Id\": 53,            \"AlertId\": 10,            \"SortOrder\": 1,            \"FieldName\": \"Processed Date\",            \"Value\": [                \"12/28/2016 04:23 PM\"            ]        },        {            \"Id\": 54,            \"AlertId\": 10,            \"SortOrder\": 2,            \"FieldName\": \"Manufacturer\",            \"Value\": [                \"\"            ]        }    ],    \"Specialties\": [        {            \"AlertId\": 10,            \"SpecialtyId\": 155,            \"EntitySpecialtyId\": 81,            \"Description\": \"BAM\"        }    ]},{    \"Id\": 9,    \"AppliedEntityId\": 234,    \"TypeId\": 1,    \"Type\": \"Loaner Inventory Checked-In Late\",    \"CategoryId\": 2,    \"Category\": \"Loaner\",    \"AlertDateTime\": \"2016-12-28T16:12:03.363\",    \"Data\": [        {            \"Id\": 43,            \"AlertId\": 9,            \"SortOrder\": 1,            \"FieldName\": \"Processed Date\",            \"Value\": [                \"12/28/2016 04:12 PM\"            ]        },        {            \"Id\": 44,            \"AlertId\": 9,            \"SortOrder\": 2,            \"FieldName\": \"Manufacturer\",            \"Value\": [                \"Prezio Health\"            ]        }    ],    \"Specialties\": [        {            \"AlertId\": 9,            \"SpecialtyId\": 114,            \"EntitySpecialtyId\": 1,            \"Description\": \"LOANER\"        }    ]},{    \"Id\": 8,    \"AppliedEntityId\": 234,    \"TypeId\": 1,    \"Type\": \"Loaner Inventory Checked-In Late\",    \"CategoryId\": 2,    \"Category\": \"Loaner\",    \"AlertDateTime\": \"2016-12-28T15:20:11.16\",    \"Data\": [        {            \"Id\": 31,            \"AlertId\": 8,            \"SortOrder\": 1,            \"FieldName\": \"Processed Date\",            \"Value\": [                \"12/28/2016 03:20 PM\"            ]        },        {            \"Id\": 32,            \"AlertId\": 8,            \"SortOrder\": 2,            \"FieldName\": \"Manufacturer\",            \"Value\": [                \"\"            ]        }    ],    \"Specialties\": [        {            \"AlertId\": 8,            \"SpecialtyId\": 98,            \"EntitySpecialtyId\": 63,            \"Description\": \"EXACTECH\"        },        {            \"AlertId\": 8,            \"SpecialtyId\": 126,            \"EntitySpecialtyId\": 10,            \"Description\": \"ORTHOPEDIC\"        }    ]},{    \"Id\": 10,    \"AppliedEntityId\": 234,    \"TypeId\": 1,    \"Type\": \"Loaner Inventory Checked-In Late\",    \"CategoryId\": 2,    \"Category\": \"Loaner\",    \"AlertDateTime\": \"2016-12-28T16:23:36.177\",    \"Data\": [        {            \"Id\": 53,            \"AlertId\": 10,            \"SortOrder\": 1,            \"FieldName\": \"Processed Date\",            \"Value\": [                \"12/28/2016 04:23 PM\"            ]        },        {            \"Id\": 54,            \"AlertId\": 10,            \"SortOrder\": 2,            \"FieldName\": \"Manufacturer\",            \"Value\": [                \"\"            ]        }    ],    \"Specialties\": [        {            \"AlertId\": 10,            \"SpecialtyId\": 155,            \"EntitySpecialtyId\": 81,            \"Description\": \"BAM\"        }    ]},{    \"Id\": 9,    \"AppliedEntityId\": 234,    \"TypeId\": 1,    \"Type\": \"Loaner Inventory Checked-In Late\",    \"CategoryId\": 2,    \"Category\": \"Loaner\",    \"AlertDateTime\": \"2016-12-28T16:12:03.363\",    \"Data\": [        {            \"Id\": 43,            \"AlertId\": 9,            \"SortOrder\": 1,            \"FieldName\": \"Processed Date\",            \"Value\": [                \"12/28/2016 04:12 PM\"            ]        },        {            \"Id\": 44,            \"AlertId\": 9,            \"SortOrder\": 2,            \"FieldName\": \"Manufacturer\",            \"Value\": [                \"Prezio Health\"            ]        }    ],    \"Specialties\": [        {            \"AlertId\": 9,            \"SpecialtyId\": 114,            \"EntitySpecialtyId\": 1,            \"Description\": \"LOANER\"        }    ]},{    \"Id\": 8,    \"AppliedEntityId\": 234,    \"TypeId\": 1,    \"Type\": \"Loaner Inventory Checked-In Late\",    \"CategoryId\": 2,    \"Category\": \"Loaner\",    \"AlertDateTime\": \"2016-12-28T15:20:11.16\",    \"Data\": [        {            \"Id\": 31,            \"AlertId\": 8,            \"SortOrder\": 1,            \"FieldName\": \"Processed Date\",            \"Value\": [                \"12/28/2016 03:20 PM\"            ]        },        {            \"Id\": 32,            \"AlertId\": 8,            \"SortOrder\": 2,            \"FieldName\": \"Manufacturer\",            \"Value\": [                \"\"            ]        }    ],    \"Specialties\": [        {            \"AlertId\": 8,            \"SpecialtyId\": 98,            \"EntitySpecialtyId\": 63,            \"Description\": \"EXACTECH\"        },        {            \"AlertId\": 8,            \"SpecialtyId\": 126,            \"EntitySpecialtyId\": 10,            \"Description\": \"ORTHOPEDIC\"        }    ]}]";
                //objClassListAlertNewsFeed = JsonConvert.DeserializeObject<List<AlertNewsFeed>>(jsonStringNewsFeed);

                BindAlertNewsFeedByCatergory();
            }
            catch (UnauthorizedAccessException ex)
            {
                await DisplayAlert("UnAuthorized", ex.Message, "Cancel");

                await Navigation.PushAsync(new LoginPage());
            }
            catch (Exception ex)
            {
                await DisplayAlert("Some error has occured", ex.Message, "Cancel");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Menu item Save alert.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        async void mnItmSave(object sender, EventArgs e)
        {
            var mnItemSelected        = ((Xamarin.Forms.MenuItem)sender);
            var objAlertNewFeed       = mnItemSelected.CommandParameter as AlertNewsFeed;
            var DetailedAlertNewsFeed = await AlertAccessLayer.GetAlertById(objAlertNewFeed.AppliedEntityId, objAlertNewFeed.Id);

            if (DetailedAlertNewsFeed != null && DetailedAlertNewsFeed.Id > 0)
            {
                if (DetailedAlertNewsFeed.Saved)
                {
                    ApplicationObject.SaveAlerts = await App.Database.DeleteItemAsync(DetailedAlertNewsFeed);
                    await DisplayAlert("Alert", "Removed Successfully", "OK");
                }
                else
                {
                    DetailedAlertNewsFeed.IsSaved = true;
                    ApplicationObject.SaveAlerts  = await App.Database.SaveItemAsync(DetailedAlertNewsFeed);

                    //objClassListAlertNewsFeed.First(obj => obj.Id.Equals(DetailedAlertNewsFeed.Id));
                    await DisplayAlert("Alert", "Saved Successfully", "OK");

                    BindAlertNewsFeedByCatergory();
                }
            }
            //TODO Change the Color of the Selected List View Item
        }
Esempio n. 3
0
        /// <summary>
        /// Authenticatings the first load.
        /// </summary>
        async void AuthenticatingFirstLoad()
        {
            try
            {
                var loginObject = new LoginRequest
                {
                    grant_type = "password",
                    username   = "******",
                    password   = "******"
                };


                ApplicationObject.LoginToken = await LoginAccessLayer.AuthenticateUser(loginObject);


                if (ApplicationObject.LoginToken != null)
                {
                    //Calling the Get Current Loggined In User Details
                    //UserDialogs.Instance.ShowLoading("Fetching user info.. ");
                    UserDialogs.Instance.ShowLoading();
                    ApplicationObject.CurrentUser = await ProfileAccessLayer.GetLoggedInUserInfo();

                    UserDialogs.Instance.HideLoading();

                    //Get the Application Default Category of Alerts
                    if (!ApplicationObject.AlertCategories.Any())
                    {
                        //UserDialogs.Instance.ShowLoading("Getting categories, almost there.. ");
                        UserDialogs.Instance.ShowLoading();
                        ApplicationObject.AlertCategories = await AlertAccessLayer.GetAlertCategories();

                        UserDialogs.Instance.HideLoading();

                        ApplicationObject.AlertCategories.Insert(0, new AlertCategory {
                            Id = 0, Description = ApplicationObject.DefaultCategoryText, HexColor = "#543669"
                        });
                        ApplicationObject.SelectedAlertCategory = ApplicationObject.AlertCategories.FirstOrDefault();
                    }

                    if (ApplicationObject.CurrentUser != null && ApplicationObject.AlertCategories.Any())
                    {
                        //Binding the Hosptial Picker Control
                        BindPickerControl();
                    }
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Authentication Issue", ex.Message, "Cancel");
            }
        }