Exemplo n.º 1
0
 public CustomerInfo GetCustomerInfo(String email)
 {
     using (ISession session = SessionFactory.Create())
     {
         UserPersonalInfoModel userPersonalInfoModel = RepositoriyFactory.GetRepo <IUserPersonalInfoRepositoriy>(session).GetUserPersonalInfo(email);
         CustomerUserModel     customerUser          = RepositoriyFactory.GetRepo <ICustomerUserRepository>(session).GetCustomerUser(userPersonalInfoModel.UserPersonalInfoId);
         CustomerModel         customer = RepositoriyFactory.GetRepo <ICustomerRepository>(session).GetCustomer(customerUser.CustomerId);
         return(CustomerMapper.MapToCustomerInfo(customer));
     }
 }
        public UserPersonalInfoModel GetUserPersonalInfo(String email)
        {
            UserPersonalInfoModel user = new UserPersonalInfoModel();

            String query = $"SELECT * FROM UserPersonalInfo WHERE Email ='{email}'";

            using (IDbConnection db = new SqlConnection(connectionString))
            {
                user = db.QueryFirstOrDefault <UserPersonalInfoModel>(query);
            }
            return(user);
        }
Exemplo n.º 3
0
        public Address GetBillingAddress(String email)
        {
            using (ISession session = SessionFactory.Create())
            {
                UserPersonalInfoModel userPersonalInfoModel = RepositoriyFactory.GetRepo <IUserPersonalInfoRepositoriy>(session).GetUserPersonalInfo(email);
                CustomerUserModel     customerUser          = RepositoriyFactory.GetRepo <ICustomerUserRepository>(session).GetCustomerUser(userPersonalInfoModel.UserPersonalInfoId);
                CustomerModel         customer         = RepositoriyFactory.GetRepo <ICustomerRepository>(session).GetCustomer(customerUser.CustomerId);
                AddressModel          billingAddress   = RepositoriyFactory.GetRepo <IAddressRepositoriy>(session).GetBilllingAddress("CustomerId", customerUser.CustomerId);
                AddressModel          dedicatedAddress = RepositoriyFactory.GetRepo <IAddressRepositoriy>(session).GetDedicatedAddress(customerUser.CustomerId);

                AddressModel address = (customer.IsThirdPartyBillingEnabled == true) ? dedicatedAddress : billingAddress;

                LocationModel       location = RepositoriyFactory.GetRepo <ILocationRepository>(session).GetLocation(address.AddressId);
                AddressContactModel contact  = RepositoriyFactory.GetRepo <IAddressContactRepositoriy>(session).GetContactPerson(address.AddressId);
                return(BillingAddressMapper.GetBillingAddress(location, contact, address));
            }
        }