public UserTurnoverTotalParam UserTurnOvertotal(string mobile)
        {
            try
            {
                var result = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <UserTurnoverTotalParam>
                                 (HttpUrlHelper.Get(AppConstant.RestUrl, "UserTurnover", "GetUserTurnOverTotal",
                                                    mobile));


                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public List <UserTurnoverParam> ListPassengerTurnover(Guid id)
        {
            try
            {
                //if (id.ToString() == null) id = UserInfo.InstanceId;
                //var result = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get<PassengerTurnoverParam>
                //    (HttpUrlHelper.Get(AppConstant.RestUrl, "PassengerTurnover", "Test"), UserInfo.InstanceId);

                //return new List<PassengerTurnoverParam>();
                //var user = _userRepository.GetById(UserInfo.Instance.Id);
                var result = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <List <UserTurnoverParam> >
                                 (HttpUrlHelper.Get(AppConstant.RestUrl, "UserTurnover", "GetUserturnover",
                                                    UserInfo.Instance.Mobile));


                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public async Task <ICollection <Products> > GetOfferProduct()
        {
            try
            {
                var result = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <List <Products> >(HttpUrlHelper.Get(AppConstant.RestUrl, "Test", "Index"), null);


                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(AppConstant.SiteUrl);
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    //GET Method
                    HttpResponseMessage response = await client.GetAsync("/api/Test/Index");

                    if (response.IsSuccessStatusCode)
                    {
                        //return await response.Content.ReadAsAsync<List<Products>>();
                    }
                    return(null);
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message + " " + e.InnerException);
            }
        }
Exemple #4
0
 public PassengerParam GetPassengerByMobile(string mobile)
 {
     return(new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <PassengerParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "Passenger", "GetByMobile", mobile)));
 }
        public List <PassengerMessageParam> GetList()
        {
            var result = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <List <PassengerMessageParam> >(HttpUrlHelper.Get(AppConstant.RestUrl, "Driver", "GetNearByDrivers"), null);

            return(result);
        }
        TripCostParam ITripCostService.GetTripCost(TripLocationParam tripLocationParam)
        {
            var result = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <TripCostParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "TripCost", "GetTripCost"), tripLocationParam);

            return(result);
        }
Exemple #7
0
        public UserParam GetUserCode(string mobile)
        {
            if (mobile == null)
            {
                mobile = UserInfo.Instance.Mobile;
            }
            var userParam = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <UserParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "Account", "GetByMobile", mobile));

            return(userParam);
        }
Exemple #8
0
        public void LogIn(UserParam userParam)
        {
            try
            {
                var userInfo = UserInfo.Instance;
                userInfo.Mobile          = userParam.Mobile;
                userInfo.Password        = userParam.Password;
                userInfo.IsAuthenticated = true;
                var passengerParam = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <PassengerParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "Passenger", "GetByMobile", userParam.Mobile));

                userParam.Language = string.IsNullOrEmpty(userParam.Language) ? userInfo.Language : userParam.Language;

                passengerParam.UserParam.IsAuthenticated = true;
                passengerParam.UserParam.Language        = userParam.Language;
                passengerParam.UserParam.Password        = userParam.Password;
                userParam.Id = passengerParam.UserParam.Id;
                userParam.IsAuthenticated = true;


                var users = _userRepository.GetAll();
                foreach (var user in users)
                {
                    user.IsAuthenticated = false;
                    _userRepository.Update(user);
                }


                var currentUser = users.FirstOrDefault(c => c.Mobile == userParam.Mobile);
                if (currentUser == null)
                {
                    var userInsert = new User()
                    {
                        Id = userParam.Id,
                        IsAuthenticated = true,
                        Password        = userParam.Password,
                        Language        = userParam.Language,
                        Mobile          = userParam.Mobile
                    };
                    _userRepository.Insert(userInsert);
                }
                else
                {
                    currentUser.IsAuthenticated = true;
                    _userRepository.Update(currentUser);
                }



                MapToUserInfo(passengerParam);
            }
            catch (Exception e)
            {
                UserInfo.Instance.IsAuthenticated = false;
                throw new Exception(e.Message);
            }
        }
Exemple #9
0
        public TripParam GetById(Guid id)
        {
            var userParam = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <TripParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "Trip", "GetById", id.ToString()));

            return(userParam);
        }
Exemple #10
0
 public TripParam GetTripDetailsByTripId(Guid id)
 {
     try
     {
         return(new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <TripParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "Trip", "GetTripDetailsByTripId", id.ToString())));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemple #11
0
 public List <TripParam> GetTripByMobile(string mobile)
 {
     try
     {
         return(new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <List <TripParam> >(HttpUrlHelper.Get(AppConstant.RestUrl, "Trip", "GetTripUserByMobile", mobile)));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemple #12
0
        public List <TripParam> GetNewRequest()
        {
            var tripParam = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <List <TripParam> >(HttpUrlHelper.Get(AppConstant.RestUrl, "Trip", "GetNewRequest"));

            return(tripParam);
        }
 public void Delete(Guid id)
 {
     try
     {
         new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <SelectedAddressParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "SelectedAddress", "Delete", id.ToString()));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }