public bool Create(BillingAccount b)
        {
            bool result = false;

            if (b != null)
            {
                bvb_BillingAccount x = new bvb_BillingAccount();
                CopyModelToData(x, b);
               
                try
                {
                    if (context != null)
                    {
                        context.bvb_BillingAccounts.InsertOnSubmit(x);
                        context.SubmitChanges();
                        result = true;
                        // Copy back to model so we get new ID number
                        CopyDataToModel(x, b);
                    }
                }
                catch
                {
                    result = false;                    
                }
            }

            return result;
        }
        public bool Create(BillingAccount b)
        {
            bool result = false;

            if (b != null)
            {
                bvb_BillingAccount x = new bvb_BillingAccount();
                CopyModelToData(x, b);

                try
                {
                    if (context != null)
                    {
                        context.bvb_BillingAccounts.InsertOnSubmit(x);
                        context.SubmitChanges();
                        result = true;
                        // Copy back to model so we get new ID number
                        CopyDataToModel(x, b);
                    }
                }
                catch
                {
                    result = false;
                }
            }

            return result;
        }
 private static void CopyModelToData(bvb_BillingAccount data, BillingAccount model)
 {
     data.Email = model.Email;
     data.Id = model.Id;
     data.BillingZipCode = model.BillingZipCode;
     string json = MerchantTribe.Web.Json.ObjectToJson(model.CreditCard);
     string key = MerchantTribe.Web.Cryptography.KeyManager.GetKey(0);
     data.CreditCard = MerchantTribe.Web.Cryptography.AesEncryption.Encode(json, key);
 }
 private static void CopyModelToData(bvb_BillingAccount data, BillingAccount model)
 {
     data.Email = model.Email;
     data.Id = model.Id;
     data.BillingZipCode = model.BillingZipCode;
     string json = MerchantTribe.Web.Json.ObjectToJson(model.CreditCard);
     string key = MerchantTribe.Web.Cryptography.KeyManager.GetKey(0);
     data.CreditCard = MerchantTribe.Web.Cryptography.AesEncryption.Encode(json, key);
 }
 private static void CopyDataToModel(bvb_BillingAccount data, BillingAccount model)
 {
     model.Email = data.Email;
     model.Id = data.Id;
     model.BillingZipCode = data.BillingZipCode;
     string key = MerchantTribe.Web.Cryptography.KeyManager.GetKey(0);
     if (data.CreditCard.Trim().Length > 2)
     {
         string json = MerchantTribe.Web.Cryptography.AesEncryption.Decode(data.CreditCard, key);
         model.CreditCard = MerchantTribe.Web.Json.ObjectFromJson<MerchantTribe.Payment.CardData>(json);
     }
 }
 private static void CopyDataToModel(bvb_BillingAccount data, BillingAccount model)
 {
     model.Email = data.Email;
     model.Id = data.Id;
     model.BillingZipCode = data.BillingZipCode;
     string key = MerchantTribe.Web.Cryptography.KeyManager.GetKey(0);
     if (data.CreditCard.Trim().Length > 2)
     {
         string json = MerchantTribe.Web.Cryptography.AesEncryption.Decode(data.CreditCard, key);
         model.CreditCard = MerchantTribe.Web.Json.ObjectFromJson<MerchantTribe.Payment.CardData>(json);
     }
 }
Example #7
0
 partial void Deletebvb_BillingAccount(bvb_BillingAccount instance);
Example #8
0
 partial void Updatebvb_BillingAccount(bvb_BillingAccount instance);
Example #9
0
 partial void Insertbvb_BillingAccount(bvb_BillingAccount instance);
Example #10
0
 partial void Deletebvb_BillingAccount(bvb_BillingAccount instance);
Example #11
0
 partial void Updatebvb_BillingAccount(bvb_BillingAccount instance);
Example #12
0
 partial void Insertbvb_BillingAccount(bvb_BillingAccount instance);