Ejemplo n.º 1
0
        public async void GetClassRooms()
        {
            //PreferenceHandler prefHandler = new PreferenceHandler();
            UserDetails userDetail = PreferenceHandler.GetUserDetails();
            var         response   = await InvokeApi.Invoke(Constants.API_GET_CLASS_ROOMS + "/" + userDetail.UserId, string.Empty, HttpMethod.Get);

            if (response.StatusCode != 0)
            {
                InvokeOnMainThread(() =>
                {
                    CheckClassRoomsResponse(response);
                    loadingOverlay.Hide();
                });
            }
            //RestClient client = new RestClient(Constants.SERVER_BASE_URL);


            //var request = new RestRequest(Constants.API_GET_CLASS_ROOMS + "/" + userDetail.User_Id, Method.GET);
            //request.RequestFormat = DataFormat.Json;
            //client.ExecuteAsync(request, response =>
            //{
            //    Console.WriteLine(response);

            //});
        }
        public async void GetConsumptionDetails(ConsumptionFor currentConsumption, int Id)
        {
            InvokeOnMainThread(() =>
            {
                // Added for showing loading screen
                var bounds = UIScreen.MainScreen.Bounds;
                // show the loading overlay on the UI thread using the correct orientation sizing
                loadingOverlay = new LoadingOverlay(bounds);
                View.Add(loadingOverlay);
            });

            string url = GetConsumptionURL(currentConsumption);

            if (Id != 0)
            {
                url = url + "/" + Convert.ToString(Id);
            }
            var responseConsumption = await InvokeApi.Invoke(url, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken(), IOSUtil.CurrentStage);

            if (responseConsumption.StatusCode == HttpStatusCode.OK)
            {
                GetConsumptionResponse(responseConsumption);
            }
            else if (responseConsumption.StatusCode == HttpStatusCode.BadRequest || responseConsumption.StatusCode == HttpStatusCode.Unauthorized)
            {
                await IOSUtil.RefreshToken(this, loadingOverlay);
            }
        }
        public async Task GetUserDetails(WebView view)
        {
            var responseUser = await InvokeApi.Invoke(Constants.API_GET_CURRENTUSER, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken());

            if (responseUser.StatusCode == HttpStatusCode.OK)
            {
                GetCurrentUserResponse(responseUser, view);
            }
        }
        private async Task GetQuestionList()
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_QUESTION_ANSWERS, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken());

            if (response.StatusCode != 0)
            {
                getQuestionListResponse(response);
            }
        }
Ejemplo n.º 5
0
        private async void GetInsights()
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_INSIGHT_DATA, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken(), IOSUtil.CurrentStage);

            if (response.StatusCode != 0)
            {
                InvokeOnMainThread(() =>
                {
                    GetInsightDataResponse(response);
                });
            }
        }
Ejemplo n.º 6
0
        private async void getRecommendationsList()
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_RECOMMENDATIONS, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken(), IOSUtil.CurrentStage);

            if (response.StatusCode != 0)
            {
                InvokeOnMainThread(() =>
                {
                    getRecommendationsListResponse(response);
                });
            }
        }
        public async void Login(LoginModel loginModel)
        {
            var response = await InvokeApi.Invoke(Constants.API_SIGN_IN, JsonConvert.SerializeObject(loginModel), HttpMethod.Post);

            if (response.StatusCode != 0)
            {
                InvokeOnMainThread(() =>
                {
                    LoginResponse(response);
                });
            }
        }
        private async void getReports(int userId)
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_GLOBAL_REPORTS + "/" + userId, string.Empty, HttpMethod.Get);

            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                RunOnUiThread(() =>
                {
                    GetReportsResponse(response);
                });
            }
        }
Ejemplo n.º 9
0
        private async void GetAccessToken()
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_TOKEN, string.Empty, HttpMethod.Get);

            if (response.StatusCode != 0)
            {
                Console.WriteLine("async Response : " + response.ToString());
                InvokeOnMainThread(() =>
                {
                    GetAccessTokenResponse(response);
                });
            }
        }
Ejemplo n.º 10
0
        private async void getMeterReports(int userId, string serialNumber)
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_METER_REPORTS + "/" + userId + "/" + serialNumber, string.Empty, HttpMethod.Get);

            if (response.StatusCode != 0)
            {
                Console.WriteLine("async Response : " + response.ToString());
                InvokeOnMainThread(() =>
                {
                    GetMeterReportsResponse(response);
                });
            }
        }
Ejemplo n.º 11
0
        public async Task GetUserDetails()
        {
            var responseUser = await InvokeApi.Invoke(Constants.API_GET_CURRENTUSER, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken());

            if (responseUser.StatusCode == HttpStatusCode.OK)
            {
                GetCurrentUserResponse(responseUser);
            }
            else if (responseUser.StatusCode == HttpStatusCode.Unauthorized)
            {
                await Utils.Utils.RefreshToken(this);
            }
        }
        private async void GetAlertList(int userId)
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_ALL_ALERTS, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken(), Utils.Utils.CurrentStage);

            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                RunOnUiThread(() =>
                {
                    GetAlertListResponse(response);
                });
            }
        }
        private async void getReports()
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_GLOBAL_REPORTS, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken());

            if (response.StatusCode != 0)
            {
                Console.WriteLine("async Response : " + response.ToString());
                InvokeOnMainThread(() =>
                {
                    GetReportsResponse(response);
                });
            }
        }
Ejemplo n.º 14
0
        private async void getMeterReports(int userId, string serialNumber)
        {
            Log.Debug(TAG, "getMeterDetails()");
            var response = await InvokeApi.Invoke(Constants.API_GET_METER_REPORTS + "/" + userId + "/" + serialNumber, string.Empty, HttpMethod.Get);

            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                RunOnUiThread(() =>
                {
                    GetMeterReportsResponse(response);
                });
            }
        }
Ejemplo n.º 15
0
        private async void GetInsights(int userId)
        {
            Log.Debug(TAG, "GetInsights()");
            var response = await InvokeApi.Invoke(Constants.API_GET_INSIGHT_DATA, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken(), Utils.Utils.CurrentStage);

            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                RunOnUiThread(() =>
                {
                    GetInsightDataResponse(response);
                });
            }
        }
Ejemplo n.º 16
0
        private async void getQuestionList()
        {
            Log.Debug(TAG, "getQuestionList()");
            var response = await InvokeApi.Invoke(Constants.API_GET_QUESTION_ANSWERS, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken());

            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                this.Activity.RunOnUiThread(() =>
                {
                    getQuestionListResponse(response);
                });
            }
        }
Ejemplo n.º 17
0
        private async void GetMonthlyConsumptionDetails(int userId)
        {
            Log.Debug(TAG, "getMeterDetails()");
            var response = await InvokeApi.Invoke(Constants.API_GET_MONTHLY_CONSUMPTION + "/" + userId, string.Empty, HttpMethod.Get);

            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                RunOnUiThread(() =>
                {
                    GetMonthlyConsumptionResponse(response);
                });
            }
        }
Ejemplo n.º 18
0
        private async void GetAccessToken()
        {
            Log.Debug(TAG, "GetAccessToken()");
            var response = await InvokeApi.Invoke(Constants.API_GET_TOKEN, string.Empty, HttpMethod.Get);

            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                RunOnUiThread(() =>
                {
                    GetAccessTokenResponse(response);
                });
            }
        }
Ejemplo n.º 19
0
        private async void GetRecommendationsList(int userId)
        {
            Log.Debug(TAG, "getAlertList()");
            var response = await InvokeApi.Invoke(Constants.API_GET_RECOMMENDATIONS, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken(), Utils.Utils.CurrentStage);

            Console.WriteLine(response);
            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                RunOnUiThread(() =>
                {
                    GetRecommendationsListResponse(response);
                });
            }
        }
Ejemplo n.º 20
0
        private async void Acknowledge_TouchUpInside(object sender, EventArgs e)
        {
            var selectedRow = Acknowledge.Tag;
            var subView     = (UILabel)ContentView.Subviews[0];
            var superView   = Acknowledge.Superview;
            //var preferenceHandler = new PreferenceHandler();
            UserDetails           userDetails = PreferenceHandler.GetUserDetails();
            int                   userId      = userDetails.UserId;
            AlertAcknowledgeModel ackModel    = new AlertAcknowledgeModel();

            ackModel.Alert_Id        = Convert.ToInt32(subView.Text);
            ackModel.Acknowledged_By = userDetails.FirstName + " " + userDetails.LastName;

            var response = await InvokeApi.Invoke(Constants.API_ACKNOWLWDGE_ALERTS, JsonConvert.SerializeObject(ackModel), HttpMethod.Put, PreferenceHandler.GetToken());
        }
Ejemplo n.º 21
0
        private async void GetConsumptionDetails(ConsumptionFor currentConsumption, int Id)
        {
            string url = GetConsumptionURL(currentConsumption);

            if (Id != 0)
            {
                url = url + "/" + Convert.ToString(Id);
            }
            var responseConsumption = await InvokeApi.Invoke(url, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken(), Utils.Utils.CurrentStage);

            if (responseConsumption.StatusCode == HttpStatusCode.OK)
            {
                GetConsumptionResponse(responseConsumption);
                layoutProgress.Visibility = ViewStates.Gone;
            }
        }
Ejemplo n.º 22
0
        private async void SubmitButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textConfigURL.Text))
            {
                Utils.Utils.ShowToast(this, "Enter Server Url.");
            }
            else
            {
                string domain = textConfigURL.Text;
                PreferenceHandler.SetDomainKey(domain);
                InvokeApi.SetDomainUrl(domain);
                ProgressDialog dialog = new ProgressDialog(this);
                dialog.SetTitle("Loading...");
                dialog.Show();
                var response = await InvokeApi.Invoke(Constants.API_GET_MOBILE_CONFIGURATION, string.Empty, HttpMethod.Get);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    string strContent = await response.Content.ReadAsStringAsync();

                    var config = JsonConvert.DeserializeObject <B2CConfiguration>(strContent);
                    dialog.Dismiss();
                    if (string.IsNullOrEmpty(config.B2cAuthorizeURL) || string.IsNullOrEmpty(config.B2cChangePasswordPolicy) || string.IsNullOrEmpty(config.B2cChangePasswordURL) || string.IsNullOrEmpty(config.B2cClientId) ||
                        string.IsNullOrEmpty(config.B2cClientSecret) || string.IsNullOrEmpty(config.B2cRedirectUrl) || string.IsNullOrEmpty(config.B2cSignInPolicy) || string.IsNullOrEmpty(config.B2cSignUpPolicy) ||
                        string.IsNullOrEmpty(config.B2cTenant) || string.IsNullOrEmpty(config.B2cTokenURL) || string.IsNullOrEmpty(config.B2cTokenURLIOS))
                    {
                        Utils.Utils.ShowToast(this, "Invalid Configuration details");
                    }
                    else
                    {
                        B2CConfigManager.GetInstance().Initialize(config);
                        PreferenceHandler.SetConfig(strContent);
                        Intent intent = new Intent(Application.Context, typeof(LoginActivity));
                        StartActivity(intent);
                        Finish();
                    }
                }
                else
                {
                    Utils.Utils.ShowToast(this, response.ReasonPhrase);
                    dialog.Dismiss();
                }
            }
        }
        public async Task GetRooms()
        {
            var bounds = UIScreen.MainScreen.Bounds;

            // show the loading overlay on the UI thread using the correct orientation sizing
            loadingOverlay = new LoadingOverlay(bounds);
            View.Add(loadingOverlay);
            UserDetails userDetail = PreferenceHandler.GetUserDetails();
            var         response   = await InvokeApi.Invoke(Constants.API_GET_ALL_ROOMS, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken());

            if (response.StatusCode != 0)
            {
                InvokeOnMainThread(() =>
                {
                    CheckClassRoomsResponse(response);
                    loadingOverlay.Hide();
                });
            }
        }
Ejemplo n.º 24
0
        private async void submitFeedback(int userId)
        {
            FeedbackModel feedbackModel = new FeedbackModel();

            feedbackModel.QuestionId   = questionList[0].QuestionId;
            feedbackModel.RoomId       = selectedClassRoom;
            feedbackModel.AnswerId     = SelectedAnswer;
            feedbackModel.FeedbackDesc = SelectedAnswerDesc;

            var response = await InvokeApi.Invoke(Constants.API_GIVE_FEEDBACK, JsonConvert.SerializeObject(feedbackModel), HttpMethod.Post, PreferenceHandler.GetToken());

            if (response.StatusCode != 0)
            {
                InvokeOnMainThread(() =>
                {
                    var result = client.Publish("EMstate/feedback", Encoding.UTF8.GetBytes("{ \"feedbackMessage\":\"Feedback '" + feedbackModel.FeedbackDesc + "' recieved from room " + selectedClassRoomDesc + "\"}"));
                    submitFeedbackResponse(response);
                });
            }
        }
        public async void GetAlerts()
        {
            var response = await InvokeApi.Invoke(Constants.API_GET_ALL_ALERTS, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken(), IOSUtil.CurrentStage);

            if (response.StatusCode != 0)
            {
                InvokeOnMainThread(() =>
                {
                    CheckAlertsResponse(response);
                    loadingOverlay.Hide();
                });
            }
            //RestClient client = new RestClient(Constants.SERVER_BASE_URL);
            //var request = new RestRequest(Constants.API_GET_ALL_ALERTS + "/" + User.User_Id, Method.GET);
            //request.RequestFormat = DataFormat.Json;
            //client.ExecuteAsync(request, response =>
            //{
            //    Console.WriteLine(response);

            //});
        }
Ejemplo n.º 26
0
        private async void WebView_LoadError(object sender, UIWebErrorArgs e)
        {
            var URL = (NSObject)e.Error.UserInfo.Values[2];

            string req = URL.ToString();

            if (req.Contains("&code="))
            {
                string code = Common.FunGetValuefromQueryString(req, "code");
                PreferenceHandler.SetAccessCode(code);
                string tokenURL = string.Format(B2CConfig.TokenURLIOS, B2CConfig.Tenant, B2CPolicy.SignInPolicyId, B2CConfig.Grant_type, B2CConfig.ClientId, code);
                var    response = await InvokeApi.Authenticate(tokenURL, string.Empty, HttpMethod.Post);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    string strContent = await response.Content.ReadAsStringAsync();

                    var token = JsonConvert.DeserializeObject <AccessToken>(strContent);
                    PreferenceHandler.SetToken(token.id_token);
                    PreferenceHandler.SetRefreshToken(token.refresh_token);
                }
            }

            if (req.Contains("id_token="))
            {
                string token = Common.FunGetValuefromQueryString(req, "id_token");
                PreferenceHandler.SetToken(token);
                //PreferenceHandler.SetRefreshToken(token.refresh_token);
            }

            var responseUser = await InvokeApi.Invoke(Constants.API_GET_CURRENTUSER, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken());

            if (responseUser.StatusCode != 0)
            {
                InvokeOnMainThread(() =>
                {
                    GetCurrentUserResponse(responseUser);
                });
            }
        }
Ejemplo n.º 27
0
        private async void ButtonSubmit_TouchUpInside(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TextFieldConfig.Text))
            {
                IOSUtil.ShowMessage("Enter Domain Url.", null, this);
            }
            else
            {
                string domain = TextFieldConfig.Text;
                PreferenceHandler.SetDomainKey(domain);
                InvokeApi.SetDomainUrl(domain);
                var response = await InvokeApi.Invoke(Constants.API_GET_MOBILE_CONFIGURATION, string.Empty, HttpMethod.Get);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    string strContent = await response.Content.ReadAsStringAsync();

                    var config = JsonConvert.DeserializeObject <B2CConfiguration>(strContent);
                    if (string.IsNullOrEmpty(config.B2cAuthorizeURL) || string.IsNullOrEmpty(config.B2cChangePasswordPolicy) || string.IsNullOrEmpty(config.B2cChangePasswordURL) || string.IsNullOrEmpty(config.B2cClientId) ||
                        string.IsNullOrEmpty(config.B2cClientSecret) || string.IsNullOrEmpty(config.B2cRedirectUrl) || string.IsNullOrEmpty(config.B2cSignInPolicy) || string.IsNullOrEmpty(config.B2cSignUpPolicy) ||
                        string.IsNullOrEmpty(config.B2cTenant) || string.IsNullOrEmpty(config.B2cTokenURL) || string.IsNullOrEmpty(config.B2cTokenURLIOS))
                    {
                        IOSUtil.ShowMessage("Invalid Configuration details", null, this);
                        PreferenceHandler.SetDomainKey(string.Empty);
                    }
                    else
                    {
                        B2CConfigManager.GetInstance().Initialize(config);
                        PreferenceHandler.SetConfig(strContent);
                        var ViewController = (ViewController)Storyboard.InstantiateViewController("ViewController");
                        NavController.PushViewController(ViewController, false);
                    }
                }
                else
                {
                    IOSUtil.ShowMessage(response.ReasonPhrase, null, this);
                    PreferenceHandler.SetDomainKey(string.Empty);
                }
            }
        }
Ejemplo n.º 28
0
        private async void submitFeedback(int userId)
        {
            FeedbackModel feedbackModel = new FeedbackModel();

            feedbackModel.QuestionId   = selectedQuestionId;
            feedbackModel.RoomId       = selectedRoomId;
            feedbackModel.AnswerId     = selectedAnswerId;
            feedbackModel.FeedbackDesc = selectedAnswer;

            Log.Debug(TAG, "Login() " + feedbackModel.ToString());
            showLayoutSubmittingFeedback("Submitting feedback...");
            var response = await InvokeApi.Invoke(Constants.API_GIVE_FEEDBACK, JsonConvert.SerializeObject(feedbackModel), HttpMethod.Post, PreferenceHandler.GetToken());

            if (response.StatusCode != 0)
            {
                Log.Debug(TAG, "async Response : " + response.ToString());
                this.Activity.RunOnUiThread(() =>
                {
                    var result = client.Publish("EMstate/feedback", Encoding.UTF8.GetBytes("{ \"feedbackMessage\":\"Feedback '" + feedbackModel.FeedbackDesc + "' recieved from room " + SelectedRoom + "\"}"));
                    submitFeedbackResponse(response);
                });
            }
        }
        private void Invoke()
        {
            var apiCall = Globals.ROTTEN_TOMATOES_API_MOVIES_INTHEATERS;

            _apiInvokeInTheaters.Invoke <RottenTomatoesMovies>(apiCall);
        }
Ejemplo n.º 30
0
        public async void CreateDashboard()
        {
            //var preferenceHandler = new PreferenceHandler();
            //string code = preferenceHandler.GetAccessCode();
            //string tokenURL = string.Format(B2CConfig.TokenURL, B2CConfig.Tenant, B2CPolicy.SignInPolicyId, B2CConfig.Grant_type, B2CConfig.ClientSecret, B2CConfig.ClientId, code);
            //var response = await InvokeApi.Authenticate(tokenURL, string.Empty, HttpMethod.Post);
            //if (response.StatusCode == System.Net.HttpStatusCode.OK)
            //{
            //    string strContent = await response.Content.ReadAsStringAsync();
            //    var token = JsonConvert.DeserializeObject<AccessToken>(strContent);

            //    // string strRefreshToken = "access&refresh_token=AwABAAAAvPM1KaPlrEqdFSBzjqfTGBCmLdgfSTLEMPGYuNHSUYBrq...&redirect_uri=urn:ietf:wg:oauth:2.0:oob";
            //    string strRefreshToken = "https://login.microsoftonline.com/csub2c.onmicrosoft.com/oauth2/v2.0/token?p=b2c_1_b2csignin&grant_type=refresh_token&client_id=3bdf8223-746c-42a2-ba5e-0322bfd9ff76&scope=3bdf8223-746c-42a2-ba5e-0322bfd9ff76" + " " + "offline_access&refresh_token=" + token.id_token + "&redirect_uri=urn:ietf:wg:oauth:2.0:oob";
            //    var res = await InvokeApi.Authenticate(strRefreshToken, string.Empty, HttpMethod.Post);

            //    string strRefreshToken1 = "https://login.microsoftonline.com/csub2c.onmicrosoft.com/oauth2/v2.0/token?p=b2c_1_b2csignin&grant_type=refresh_token&client_id=3bdf8223-746c-42a2-ba5e-0322bfd9ff76&scope=3bdf8223-746c-42a2-ba5e-0322bfd9ff76" + " " + "offline_access&refresh_token=" + code + "&redirect_uri=urn:ietf:wg:oauth:2.0:oob";
            //    var res1 = await InvokeApi.Authenticate(strRefreshToken1, string.Empty, HttpMethod.Post);

            //    preferenceHandler.SetToken(token.id_token);
            var responseUser = await InvokeApi.Invoke(Constants.API_GET_CURRENTUSER, string.Empty, HttpMethod.Get, PreferenceHandler.GetToken());

            if (responseUser.StatusCode != 0)
            {
                GetCurrentUserResponse(responseUser);
            }
            UserDetails user = PreferenceHandler.GetUserDetails();

            if (user.RoleId == (int)Constants.USER_ROLE.ADMIN)
            {
                bool isNetworkEnabled = Utils.Utils.IsNetworkEnabled(this);

                LayoutInsightData = FindViewById <LinearLayout>(Resource.Id.layout_insight_data);
                textViewConsumed  = FindViewById <TextView>(Resource.Id.tv_top_consumed);
                textViewExpected  = FindViewById <TextView>(Resource.Id.tv_top_expected);
                textViewOverused  = FindViewById <TextView>(Resource.Id.tv_top_overused);
                textViewInsights  = FindViewById <TextView>(Resource.Id.tv_insights);

                textViewInsights.Click += delegate
                {
                    // Show insights(Recommendations) Activity
                    Intent intent = new Intent(Application.Context, typeof(InsightsActivity));
                    StartActivity(intent);
                };

                if (!isNetworkEnabled)
                {
                    Utils.Utils.ShowToast(this, "Please enable your internet connection !");
                    //ShowToast("Please enable your internet connection !");
                }
                ////Show Map Fragment
                //GoogleMapOptions mapOptions = new GoogleMapOptions()
                //.InvokeMapType(GoogleMap.MapTypeNormal)
                //.InvokeZoomControlsEnabled(false)
                //.InvokeCompassEnabled(true);

                //_myMapFragment = MapFragment.NewInstance(mapOptions);
                //FragmentTransaction tx = FragmentManager.BeginTransaction();
                //tx.Add(Resource.Id.fragment_container, _myMapFragment, "map");
                //tx.Commit();

                //_myMapFragment.GetMapAsync(this);

                //var preferenceHandler = new PreferenceHandler();
                int userId = PreferenceHandler.GetUserDetails().UserId;
                if (userId != -1)
                {
                    if (isNetworkEnabled)
                    {
                        GetMeterDetails(userId);
                        GetMonthlyConsumptionDetails(userId);
                        ShowInsights(null);
                        GetInsights(userId);
                    }
                    else
                    {
                        Utils.Utils.ShowToast(this, "Please enable your internet connection !");
                    }
                }
                else
                {
                    Utils.Utils.ShowToast(this, "Invalid User Id. Please Login Again !");
                }
            }
            else
            {
                //Show Student Fragment

                var newFragment = new StudentFragment();
                var ft          = FragmentManager.BeginTransaction();
                ft.Add(Resource.Id.fragment_container, newFragment);
                ft.Commit();
                HideInsights();
            }
            // }
        }