Beispiel #1
0
        public void Insert(PassengerParam passengerParam)
        {
            try
            {
                new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(
                    HttpUrlHelper.Post(AppConstant.RestUrl, "Passenger", "Insert"), passengerParam);



                MapToUserInfo(passengerParam);

                var user = new User()
                {
                    Id = passengerParam.UserParam.Id,
                    IsAuthenticated = true,
                    Password        = passengerParam.UserParam.Password,
                    Language        = passengerParam.UserParam.Language,
                    Mobile          = passengerParam.UserParam.Mobile
                };
                _userRepository.Insert(user);
            }
            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);
            }
        }
Beispiel #3
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);
            }
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public void InsertTripPassengerScore(Guid tripId, double passengerScore)
        {
            var tripParam = new TripParam()
            {
                Id             = tripId,
                PassengerScore = passengerScore
            };

            new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(HttpUrlHelper.Post(AppConstant.RestUrl, "Trip", "InsertTripPassengerScore"), tripParam);
        }
Beispiel #6
0
 public void Insert(TripParam tripParam)
 {
     try
     {
         new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(HttpUrlHelper.Post(AppConstant.RestUrl, "Trip", "Insert"), tripParam);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #7
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);
     }
 }
Beispiel #8
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);
     }
 }
 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);
     }
 }
 public void AddOrUpdate(UserTurnoverParam turnoverParam)
 {
     try
     {
         new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(
             HttpUrlHelper.Post(AppConstant.RestUrl, "PassengerTurnover", "AddOrUpdate"), turnoverParam);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #11
0
        public void DriverAccept(Guid tripId, Guid driverId)
        {
            var tripParam = new TripParam()
            {
                Id          = tripId,
                DriverParam = new DriverParam()
                {
                    Id = driverId
                }
            };

            new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(HttpUrlHelper.Post(AppConstant.RestUrl, "Trip", "DriverAccept"), tripParam);
        }
 public void Insert(PassengerMessageParam message)
 {
     try
     {
         //new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(HttpUrlHelper.Post(AppConstant.RestUrl,"Message","Create"),message);
         new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(
             HttpUrlHelper.Post(AppConstant.RestUrl, "Message", "Create"), message);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public void Insert(SelectedAddressParam model)
 {
     try
     {
         var user = _userService.GetPassengerByMobile(UserInfo.Instance.Mobile);
         model.User = user.UserParam;
         new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(
             HttpUrlHelper.Post(AppConstant.RestUrl, "SelectedAddress", "Insert"), model);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #14
0
        public void AddTripState(Guid tripId, TripStatusType tripStatusType)
        {
            var tripParam = new TripParam()
            {
                Id = tripId,
                TripActionParams = new List <TripActionParam>()
                {
                    new TripActionParam()
                    {
                        Status = tripStatusType
                    }
                }
            };

            new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(HttpUrlHelper.Post(AppConstant.RestUrl, "Trip", "AddTripState"), tripParam);
        }
        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);
            }
        }
Beispiel #16
0
        public void InitUserData()
        {
            var userViewModels = _userRepository.GetAll();
            var userViewModel  = userViewModels.FirstOrDefault(c => c.IsAuthenticated);

            if (userViewModel != null && userViewModel.IsAuthenticated)
            {
                LogIn(new UserParam
                {
                    Id              = userViewModel.Id,
                    Password        = userViewModel.Password,
                    IsAuthenticated = userViewModel.IsAuthenticated,
                    Language        = userViewModel.Language,
                    Mobile          = userViewModel.Mobile,
                });
            }
            else
            {
                UserInfoMapping.ClearUserInfo();
            }
        }
        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);
            }
        }
Beispiel #18
0
 public PassengerParam GetPassengerByMobile(string mobile)
 {
     return(new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <PassengerParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "Passenger", "GetByMobile", mobile)));
 }
Beispiel #19
0
 public void Edit(PassengerParam passengerParam)
 {
     new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(HttpUrlHelper.Post(AppConstant.RestUrl, "Passenger", "Update"), passengerParam);
     //var userInfo =  GetPassengerByMobile(passengerParam.UserParam.Mobile);
     MapToUserInfo(passengerParam);
 }
Beispiel #20
0
        public List <TripParam> GetNewRequest()
        {
            var tripParam = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <List <TripParam> >(HttpUrlHelper.Get(AppConstant.RestUrl, "Trip", "GetNewRequest"));

            return(tripParam);
        }
        public List <PassengerMessageParam> GetList()
        {
            var result = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <List <PassengerMessageParam> >(HttpUrlHelper.Get(AppConstant.RestUrl, "Driver", "GetNearByDrivers"), null);

            return(result);
        }
Beispiel #22
0
        public TripParam GetById(Guid id)
        {
            var userParam = new HttpClientHelper(UserInfoMapping.MapToUserInfo()).Get <TripParam>(HttpUrlHelper.Get(AppConstant.RestUrl, "Trip", "GetById", id.ToString()));

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

            return(result);
        }
Beispiel #24
0
 public void UpdateUserCode(UserParam userParam)
 {
     new  HttpClientHelper(UserInfoMapping.MapToUserInfo()).Post(HttpUrlHelper.Post(AppConstant.RestUrl, "Account", "UpdateUserCode"), userParam);
 }