public static async Task <Dictionary <String, String> > GetSettings(int ID)
        {
            Dictionary <String, String> MyData = new Dictionary <string, string>();

            String ResultJson = await GeneralModel.GetAsync("user/profile/settings/" + ID);

            var DecodedJson = JObject.Parse(ResultJson);

            MyData.Add("name", DecodedJson["info"]["name"].ToString());
            MyData.Add("email", DecodedJson["info"]["email"].ToString());
            MyData.Add("phone", DecodedJson["info"]["phone"].ToString());
            MyData.Add("dob", DecodedJson["info"]["date_of_birth"].ToString());
            MyData.Add("gender", DecodedJson["info"]["gender"].ToString());
            MyData.Add("BloodGroup", DecodedJson["info"]["blood_group"].ToString());
            MyData.Add("address", DecodedJson["info"]["address"].ToString());
            MyData.Add("IsMedic", DecodedJson["info"]["is_medic"].ToString());

            if ((bool)DecodedJson["info"]["is_medic"])
            {
                MyData.Add("MedicCategory", DecodedJson["info"]["category"].ToString());
                MyData.Add("MedicId", DecodedJson["info"]["medic_id"].ToString());
            }

            return(MyData);
        }
Example #2
0
        /// <summary>
        /// GetProfileDetails gets the users [account number,hourly charge, bank name, account name, working hours]
        /// </summary>
        /// <returns>
        /// Dictionary<String,String> holding the data with keys [AccountNumber, Charge, BankName, AccountName, WorkingHours]
        /// </returns>
        public static async Task <Dictionary <String, String> > GetProfileDetails()
        {
            Dictionary <String, String> ResultData = new Dictionary <String, String>();

            try
            {
                String ResultJson = await GeneralModel.GetAsync("user/profile/medic/" + Utilities.MedicID);

                var DecodedJson = JObject.Parse(ResultJson);
                if ((bool)DecodedJson["status"])
                {
                    var info = DecodedJson["info"];

                    ResultData.Add("AccountNumber", info["account_number"].ToString());
                    ResultData.Add("Charge", info["hourly_charge"].ToString());
                    ResultData.Add("BankName", info["bank_name"].ToString());
                    ResultData.Add("AccountName", info["account_name"].ToString());
                    ResultData.Add("WorkingHours", info["working_hours"].ToString());
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert("Alert", "Unknown Medic ID", "Ok");
                }
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Alert", ex.Message, "Ok");
            }
            return(ResultData);
        }
Example #3
0
        public static async Task <String> GetBioDetails(int MedicID)
        {
            String ResultJson = await GeneralModel.GetAsync("user/profile/bio/" + MedicID);

            var DecodedJson = JObject.Parse(ResultJson);

            return((DecodedJson["bio"].ToString() == String.Empty) ? "" : DecodedJson["bio"].ToString());
        }
        public static async Task <Dictionary <String, String> > GetSettings()
        {
            Dictionary <String, String> MyData = new Dictionary <string, string>();

            String ResultJson = await GeneralModel.GetAsync("user/profile/settings/" + Utilities.ID);

            var DecodedJson = JObject.Parse(ResultJson);

            MyData.Add("name", DecodedJson["info"]["name"].ToString());
            MyData.Add("email", DecodedJson["info"]["email"].ToString());
            MyData.Add("phone", DecodedJson["info"]["phone"].ToString());
            MyData.Add("dob", DecodedJson["info"]["date_of_birth"].ToString());
            MyData.Add("gender", DecodedJson["info"]["gender"].ToString());
            MyData.Add("BloodGroup", DecodedJson["info"]["blood_group"].ToString());
            MyData.Add("address", DecodedJson["info"]["address"].ToString());

            return(MyData);
        }
Example #5
0
        public static async Task <Dictionary <String, String> > GetReview(int UserID)
        {
            Dictionary <String, String> ReturnedData = new Dictionary <String, String>();

            try
            {
                String ResultJson = await GeneralModel.GetAsync("user/rate?user_id=" + UserID + "&medic_id=" + Utilities.MedicID);

                var DecodedJson = JObject.Parse(ResultJson);

                if ((bool)DecodedJson["status"])
                {
                    String StoredContent = DecodedJson["info"]["review"].ToString();

                    String Title = StoredContent.Substring(StoredContent.IndexOf('{') + 1, ((StoredContent.IndexOf('}') - 1)));

                    int TitleLength = Convert.ToInt32(Title.Substring(Title.IndexOf('[') + 1, ((Title.IndexOf(']')) - (Title.IndexOf('[') + 1))).Replace("length=", ""));

                    Title = StoredContent.Substring((StoredContent.IndexOf(':') + 1), TitleLength);

                    ///strip out title
                    StoredContent = StoredContent.Replace("{Title [length=" + TitleLength + "]:" + Title + "}", "");

                    String Content = StoredContent.Substring(StoredContent.IndexOf('{') + 1, ((StoredContent.IndexOf('}') - 1)));

                    int ContentLength = Convert.ToInt32(Content.Substring(Content.IndexOf('[') + 1, ((Content.IndexOf(']')) - (Content.IndexOf('[') + 1))).Replace("length=", ""));

                    Content = StoredContent.Substring((StoredContent.IndexOf(':') + 1), ContentLength);

                    ReturnedData.Add("Title", Title);
                    ReturnedData.Add("Review", Content);
                    ReturnedData.Add("Stars", DecodedJson["info"]["star"].ToString());
                }
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Alert", ex.Message, "Ok");
            }

            return(ReturnedData);
        }