private void InsertData()
        {
            CityStateZip cityStateZip = new CityStateZip();
            cityStateZip.City = acctCity.Text;
            cityStateZip.State = acctState.Text;
            cityStateZip.ZipCode = acctZipCode.Text;
            CityStateZipLogic cszLogic = new CityStateZipLogic();
            cityStateZip = cszLogic.InsertCityStateZip(cityStateZip);

            PaymentInfo paymentInfo = new PaymentInfo();
            paymentInfo.AmazonToken = "test";
            PaymentInfoLogic piLogic = new PaymentInfoLogic();
            paymentInfo = piLogic.InsertPaymentInfo(paymentInfo);

            Client client = new Client();
            client.ClientName = acctCompanyName.Text;
            client.PhoneNumber = acctPhoneNumber.Text;
            client.Email = acctEmail.Text;
            client.Address = acctAddress.Text;
            client.CityStateZipGuid = cityStateZip.CityStateZipGuid;
            client.PaymentInfoGuid = paymentInfo.PaymentInfoGuid;
            ClientLogic clientLogic = new ClientLogic();
            client = clientLogic.InsertClient(client);

            Response.Redirect(string.Format("CreateListing.aspx?ClientGuid={0}", client.ClientGuid));
        }
        private void SaveAccount(ClientLogic clientLogic, AccountViewModel account, MembershipUser user, bool insert)
        {
            // Call business logic to insert the data.
            // todo: move to mapping
            CityStateZip cityStateZip = new CityStateZip
            {
                City = account.City,
                State = account.State,
                ZipCode = account.ZipCode
            };
            this.AddCityStateZipToAccount(account, cityStateZip);

            PaymentInfo paymentInfo = new PaymentInfo
            {
                AmazonToken = User.Identity.Name
            };
            this.AddPaymentInfoToAccount(account, paymentInfo);

            Client client = new Client();
            client.ClientName = account.ClientName;
            client.PhoneNumber = account.PhoneNumber;
            client.Email = user.UserName;
            client.Address = account.Address;
            client.CityStateZipGuid = account.CityStateZipGuid;
            client.PaymentInfoGuid = account.PaymentInfoGuid;
            // pause account - in create view is always false
            client.AccountPaused = account.PauseAccount;
            if (insert)
            {
                if (SessionHandler.Current.GitAssertion != null)
                {
                    GitAssertion assertion = SessionHandler.Current.GitAssertion;
                    client.FederatedIDProvider = assertion.Authority;
                    client.FederatedID = assertion.Identifier;
                    client.FederatedKey = user.ProviderUserKey.ToString();
                }

                client = clientLogic.InsertClient(client);
                account.ClientGuid = client.ClientGuid;
                account.ClientID = client.ClientID;
            }
            else
            {
                client.IsWaiverd = account.IsWaiverd;
                client.FreeDays = account.FreeDays;
                client.Credits = account.AccountBalance;
                client.IsSuspended = account.IsSuspended;
                client.IsActive = account.IsActive;
                client.ClientGuid = account.ClientGuid; // Had to add this......
                clientLogic.UpdateClient(client);
            }
        }
Exemple #3
0
        public void InsertClient(DC.Client request)
        {
            try
            {
                BL.ClientLogic clientLogic = new BL.ClientLogic();
                BE.Client entity = request.ToBusinessEntity();
                clientLogic.InsertClient(entity);
            }
            catch (BE.ClientAlreadyExistsException ex)
            {
                FC.DefaultFaultContract fault = new FC.DefaultFaultContract();
                fault.ErrorMessage = String.Format(
                    "Unable to insert Client data. Data: {0}",
                    request.ToBusinessEntity().ToString());

                throw new FaultException<FC.DefaultFaultContract>(fault,
                    new FaultReason(ex.Message));
            }
        }