protected async Task <bool> UserLogin()
        {
            var token = await GetAuthKey();

            ILoginService _ILoginService = new LoginService();

            LoginRequest model = new LoginRequest
            {
                EmailId     = txtEmail.Text.Trim(),
                Password    = txtPassword.Text.Trim(),
                DeviceType  = EnumDeviceType.IOS.ToString(),
                DeviceToken = "ABC"                // DeviceToken
            };

            NetworkReachabilityFlags flag;
            bool network = Reachability.IsNetworkAvailable(out flag);

            if (network)
            {
                CommonUtils.ShowProgress(View);
                var response = await _ILoginService.LoginUser(model, ServiceType.UserService, token);

                if (response != null)
                {
                    if (response.IsSuccess)
                    {
                        StorageUtils <LoginResponse> .SavePreferences(AppConstant.CurrentUser, response);

                        var plist = NSUserDefaults.StandardUserDefaults;
                        plist.SetBool(true, "IsLogged");

                        CommonUtils.HideProgress();
                        CommonUtils.RedirectToController(AppConstant.HomeController);
                        return(true);
                    }
                    else
                    {
                        CommonUtils.AlertView(response.Message);
                        CommonUtils.HideProgress();
                        return(true);
                    }
                }
                else
                {
                    CommonUtils.HideProgress();
                    CommonUtils.AlertView(AppConstant.NetworkError);
                    return(true);
                }
            }
            else
            {
                CommonUtils.AlertView(AppConstant.NetworkError);
                return(true);
            }
        }
        //partial void btnLogout_UpInside(UIButton sender)
        //{

        //	//CommonUtils.AlertView(AppConstant.UnderDevelopment);

        //}


        protected async Task <bool> UserLogOut()
        {
            //LoginManager.Instance.LogOut();

            ILoginService _ILoginService = new LoginService();

            NetworkReachabilityFlags flag;
            bool network = Reachability.IsNetworkAvailable(out flag);

            if (network)
            {
                CommonUtils.ShowProgress(View);
                var Authkey = StorageUtils <LoginResponse> .GetPreferences(AppConstant.CurrentUser).Result.Token;

                var response = await _ILoginService.LogoutUser(ServiceType.UserService, Authkey);

                if (response != null)
                {
                    if (response.IsSuccess)
                    {
                        var plist = NSUserDefaults.StandardUserDefaults;
                        plist.SetBool(false, "IsLogged");
                        CommonUtils.HideProgress();
                        SidebarController.CloseMenu(true);
                        new LoginManager().LogOut();
                        CommonUtils.RedirectToController(AppConstant.LoginController);
                        return(true);
                    }
                    else
                    {
                        CommonUtils.AlertView(response.Message);
                        CommonUtils.HideProgress();
                        return(true);
                    }
                }
                else
                {
                    CommonUtils.HideProgress();
                    CommonUtils.AlertView(AppConstant.NetworkError);
                    return(true);
                }
            }
            else
            {
                CommonUtils.AlertView(AppConstant.NetworkError);
                return(true);
            }
        }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            tableView.DeselectRow(indexPath, true);
            var item = _listItem[indexPath.Row];

            if (item != null)
            {
                EventList model = new EventList()
                {
                    EventId = item.EventId
                };
                StorageUtils <EventList> .SavePreferences(AppConstant.EventDetail, model);

                CommonUtils.RedirectToController(AppConstant.EventDetailController);
            }
        }
Example #4
0
        /// <summary>
        /// Fetch Event
        /// </summary>
        /// <returns>List</returns>
        async Task <List <EventList> > GetEnrolledEventList()
        {
            List <EventList>         result = null;
            NetworkReachabilityFlags flag;
            bool network = Reachability.IsNetworkAvailable(out flag);

            if (network)
            {
                CommonUtils.ShowProgress(View);
                var request = new EventRequest
                {
                    PageNo = 1
                };
                var Authkey = StorageUtils <LoginResponse> .GetPreferences(AppConstant.CurrentUser).Result.Token;

                var response = await _IEventListService.GetEnrolledEventsList(request, ServiceType.EventService, Authkey);

                if (response != null)
                {
                    if (response.IsSuccess && response.Result != null)
                    {
                        result = response.Result;

                        if (result.Count == 0)
                        {
                            CommonUtils.AlertView(response.Message);
                        }
                    }
                    else
                    {
                        CommonUtils.AlertView(response.Message);
                    }
                    CommonUtils.HideProgress();
                }
                else
                {
                    CommonUtils.AlertView(AppConstant.NetworkError);
                }
                CommonUtils.HideProgress();
            }
            else
            {
                CommonUtils.AlertView(AppConstant.NetworkError);
            }
            CommonUtils.HideProgress();
            return(result);
        }
Example #5
0
        async Task <EventDetail> GetEventDetail()
        {
            EventDetail result = null;
            NetworkReachabilityFlags flag;
            bool network = Reachability.IsNetworkAvailable(out flag);

            if (network)
            {
                CommonUtils.ShowProgress(View);
                var eventID = StorageUtils <EventList> .GetPreferences(AppConstant.EventDetail).EventId;

                var request = new EventDetailRequest
                {
                    EventId = eventID
                };
                var Authkey = StorageUtils <LoginResponse> .GetPreferences(AppConstant.CurrentUser).Result.Token;

                var response = await _IEventListService.GetEventDetail(request, ServiceType.EventService, Authkey);

                if (response != null)
                {
                    if (response.IsSuccess && response.Result != null)
                    {
                        result = response.Result;
                    }
                    else
                    {
                        CommonUtils.AlertView(response.Message);
                    }
                }
                else
                {
                    CommonUtils.AlertView(AppConstant.NetworkError);
                }
                CommonUtils.HideProgress();
            }
            else
            {
                CommonUtils.AlertView(AppConstant.NetworkError);
            }
            return(result);
        }