Exemple #1
0
        //private void lblHome_Click(object sender, EventArgs e)
        //{
        //    var detail = new NavigationPage(new HomePage());
        //    App.Navigation = detail.Navigation;
        //    Detail = detail;
        //    IsPresented = false;
        //    detail.BarBackgroundColor = Color.FromHex("#022d71");
        //}
        //private void lblPrescriptions_Click(object sender, EventArgs e)
        //{

        //    var detail = new NavigationPage(new PrescriptionPage());
        //    App.Navigation = detail.Navigation;
        //    Detail = detail;
        //    IsPresented = false;
        //    detail.BarBackgroundColor = Color.FromHex("#022d71");
        //}
        //private void lblAppointments_Click(object sender, EventArgs e)
        //{
        //    var detail =  new NavigationPage(new AppointmentPage());
        //    App.Navigation = detail.Navigation;
        //    Detail = detail;
        //    IsPresented = false;
        //    detail.BarBackgroundColor = Color.FromHex("#022d71");

        //}
        private async void Logout()
        {
            try
            {
                await Navigation.PushPopupAsync(new LoadingPopPage());

                _objLogoutResponseModel = await _apiServices.LogOutAsync(new Get_API_Url().LogOutApi(_baseUrl), true, _objHeaderModel, _objLogoutRequestModel);

                var Result = _objLogoutResponseModel.Response;
                if (Result.StatusCode == 200)
                {
                    Settings.IsLoggedIn = false;
                    Settings.TokenCode  = string.Empty;
                    DependencyService.Get <IToast>().ShowToast(Result.Message);
                    var otherPage = new MainPage();
                    var homePage  = App.NavigationPage.Navigation.NavigationStack.First();
                    App.NavigationPage.Navigation.InsertPageBefore(otherPage, homePage);
                    await App.NavigationPage.PopToRootAsync(false);

                    // await App.NavigationPage.Navigation.PushAsync(new MainPage());
                    await Navigation.PopAllPopupAsync();
                }
                else
                {
                    DependencyService.Get <IToast>().ShowToast(Result.Message);
                    await Navigation.PopAllPopupAsync();
                }
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
                await Navigation.PopAllPopupAsync();
            }
        }
Exemple #2
0
        public ActionResult DirtyLogout(LogoutRequestModel request)
        {
            var response = new LogoutResponseModel();

            if (request.User != null)
            {
                if (request.ChatroomId != -1 && request.ParentChatroomId != -1)
                {
                    ChatroomService.RemoveUserFromChatroom(request.ChatroomId, request.ParentChatroomId, request.User.Id);
                }

                UserService.Logout(request.User.Id);
            }

            return(Json(response));
        }
Exemple #3
0
 public MenuPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     MasterBehavior       = MasterBehavior.Popover;
     imgProfile.Source    = Settings.ProfilePicture;
     lblUserName.Text     = Settings.Name;
     lblUserLocation.Text = Settings.Address;
     //  lblUserPin.Text = "PIN: "+Settings.UserPin.ToString();
     _objNavigationServiceViewModel = new NavigationServiceViewModel();
     _apiServices               = new RestApi();
     _baseUrl                   = Settings.Url + Domain.LOgOutApiConstant;
     _objHeaderModel            = new HeaderModel();
     _objHeaderModel.OTPToken   = Settings.TokenCode;
     _objLogoutRequestModel     = new LogoutRequestModel();
     _objLogoutResponseModel    = new LogoutResponseModel();
     NavigationList.ItemsSource = _objNavigationServiceViewModel.NavigationMenuList;
 }
Exemple #4
0
        public ActionResult Logout(LogoutRequestModel request)
        {
            var response = new LogoutResponseModel();

            if (request.ChatroomId != -1 && request.ParentChatroomId != -1)
            {
                if (!ChatroomService.RemoveUserFromChatroom(request.ChatroomId, request.ParentChatroomId, request.User.Id))
                {
                    response.AddError("Could not remove user from chatroom.");
                }
            }

            if (!UserService.Logout(request.User.Id))
            {
                response.AddError("Could not logout user.");
            }

            return(Json(response));
        }