async Task <List <Notification> > GetNotificationList()
        {
            List <Notification> result = null;

            if (AppUtils.IsNetwork())
            {
                var request = new NotificationRequest
                {
                    PageNo = 1
                };
                _objProgress = new CustomProgress(this);
                var Authkey = StorageUtils <String> .GetPreferencesValue(DroidConstant.CurrentUser);

                var response = await _INotificationService.GetEventList(request, ServiceType.NotificationService, Authkey);

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

                        if (result.Count == 0 && request.PageNo == 1)
                        {
                            AppUtils.ShowToast(this, response.Message);
                        }
                        else
                        {
                            notificatonAdatper.UpdateList(result);
                        }
                    }

                    else
                    {
                        AppUtils.ShowToast(this, response.Message);
                    }
                }
                else
                {
                    AppUtils.ShowToast(this, response.Message);
                }
            }
            else
            {
                AppUtils.ShowToast(this, Resources.GetString(Resource.String.network_error));
                _objProgress.DismissDialog();
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Fetch Event
        /// </summary>
        /// <returns>List</returns>
        async Task <EventDetail> GetEventDetail()
        {
            EventDetail result = null;

            if (AppUtils.IsNetwork())
            {
                var request = new EventDetailRequest
                {
                    EventId = eventId
                };
                _objProgress = new CustomProgress(this);
                var Authkey = StorageUtils <String> .GetPreferencesValue(DroidConstant.CurrentUser);

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

                _objProgress.DismissDialog();
                if (response != null)
                {
                    if (response.IsSuccess && response.Result != null)
                    {
                        result = response.Result;
                    }
                    else
                    {
                        AppUtils.ShowToast(this, response.Message);
                    }
                }
                else
                {
                    AppUtils.ShowToast(this, Resources.GetString(Resource.String.network_error));
                }
            }
            else
            {
                AppUtils.ShowToast(this, Resources.GetString(Resource.String.network_error));
                _objProgress.DismissDialog();
            }

            return(result);
        }
Esempio n. 3
0
        protected async Task <bool> UserLogin(String authToken)
        {
            LoginRequest model = new LoginRequest
            {
                EmailId     = edttxtEmail.Text.Trim(),
                Password    = edttxtPswd.Text.Trim(),
                DeviceType  = ((int)EnumDeviceType.Android).ToString(),
                DeviceToken = StorageUtils <String> .GetPreferencesValue(DroidConstant.DeviceToken)
            };

            if (AppUtils.IsNetwork())
            {
                var response = await _ILoginService.LoginUser(model, ServiceType.UserService, authToken);

                if (response != null)
                {
                    if (response.IsSuccess)
                    {
                        //StorageUtils<String>.GetPreferences(DroidConstant.CurrentUser)
                        string token = response.Result.Token;
                        StorageUtils <String> .SavePreferences(DroidConstant.CurrentUser, token);

                        _objProgress.DismissDialog();
                        StartActivity(typeof(MainActivity));
                        Finish();
                        return(true);
                    }
                    else
                    {
                        AppUtils.ShowToast(this, response.Message);
                        _objProgress.DismissDialog();
                        return(true);
                    }
                }
                else
                {
                    _objProgress.DismissDialog();
                    AppUtils.ShowToast(this, Resources.GetString(Resource.String.network_error));
                    return(true);
                }
            }
            else
            {
                _objProgress.DismissDialog();
                AppUtils.ShowToast(this, Resources.GetString(Resource.String.network_error));
                return(true);
            }
        }