private Party ProcessProvider() { Party party = new Party(); party.PopulateFrom(_provider); party.party_type_cd_id.Value = GSC(SystemCodeType.PARTY_TYPE, "business"); party.Variable = new SqlVariable("buid_" + _provider.Code); _sqlEntities.Add(party); Business_unit bu = new Business_unit(); bu.PopulateFrom(_provider); bu.party_id.Value = party.Variable; _sqlEntities.Add(bu); if (_provider.Extra != null) { Business_unit_property bup = new Business_unit_property(); bup.PopulateFrom(_provider.Extra); _sqlEntities.Add(bup); } foreach (var id in _provider.AuthMethods) { Business_unit_product_id_auth_method bupiam = new Business_unit_product_id_auth_method(); bupiam.PopulateFrom(id); bupiam.business_unit_party_id.Value = party.Variable; _sqlEntities.Add(bupiam); } if (_provider.ExpediteFees.Count > 0) { Business_unit_product expediteFeeBUP = new Business_unit_product(); expediteFeeBUP.GenVariable(); expediteFeeBUP.end_date.Value = _provider.DisableDate; expediteFeeBUP.is_expedited.Value = false; expediteFeeBUP.party_id.Value = party.Variable; expediteFeeBUP.product_display_name.Value = Constants.EXPEDITE_FEE_DISPLAY_NAME; expediteFeeBUP.product_id.Value = GetBaseProduct(Constants.EXPEDITE_FEE_BASE_PRODUCT); expediteFeeBUP.product_internal_name.Value = Constants.EXPEDITE_FEE_INTERNAL_NAME; expediteFeeBUP.product_rule_cd_id.Value = null; expediteFeeBUP.settlement_action_cd_id.Value = null; expediteFeeBUP.start_date.Value = _provider.EnableDate; _sqlEntities.Add(expediteFeeBUP); AttachFeeCollection(_provider.ExpediteFees, expediteFeeBUP, "agency expedite"); } // // Set up the vc fee "product". // Business_unit_product vcFeeBUP = new Business_unit_product(); Service vcfeeService = new Service(null); vcFeeBUP.PopulateFrom(vcfeeService); vcFeeBUP.GenVariable(); vcFeeBUP.end_date.Value = _provider.DisableDate; vcFeeBUP.is_expedited.Value = false; vcFeeBUP.party_id.Value = party.Variable; vcFeeBUP.product_display_name.Value = Constants.VCFEE_DISPLAY_NAME; vcFeeBUP.product_id.Value = GetBaseProduct(Constants.VCFEE_BASE_PRODUCT); vcFeeBUP.product_internal_name.Value = Constants.VCFEE_INTERNAL_NAME; vcFeeBUP.product_rule_cd_id.Value = null; vcFeeBUP.settlement_action_cd_id.Value = null; vcFeeBUP.start_date.Value = _provider.EnableDate; _sqlEntities.Add(vcFeeBUP); AttachFeeCollection(_provider.AgencyFees, vcFeeBUP, "vitalchek processing"); foreach (var pc in _provider.PcpidConfigs) { Procheck_config config = new Procheck_config(); config.PopulateFrom(pc); config.business_unit_party_id.Value = party.Variable; _sqlEntities.Add(config); } foreach (var a in _provider.Addresses) { SqlRendering.Entities.Address address = new SqlRendering.Entities.Address(); address.PopulateFrom(a); address.party_id.Value = party.Variable; _sqlEntities.Add(address); } foreach (var x in _provider.Phones) { Phone_number phone = new Phone_number(); phone.PopulateFrom(x); phone.party_id.Value = party.Variable; _sqlEntities.Add(phone); } // // Say it with me: shipping is not a product. It is a service. // foreach (var x in _provider.ShippingServices) { Business_unit_product bup = new Business_unit_product(); bup.PopulateFrom(x); bup.party_id.Value = party.Variable; bup.product_id.Value = GetBaseProduct(x.BaseProduct); bup.Variable = new SqlVariable(x.BaseProduct + "_BUPID"); _services.Add(x, bup.Variable); _sqlEntities.Add(bup); AttachFeeCollection(x.Fees, bup, "delivery"); } foreach (var term in _provider.Terminals) { Business_unit_merchant_number bumn = new Business_unit_merchant_number(); bumn.PopulateFrom(term); bumn.business_unit_party_id.Value = party.Variable; bumn.provider_id.Value = _provider.Code; bumn.GenVariable(); _sqlEntities.Add(bumn); Terminal_id ti = new Terminal_id(); ti.PopulateFrom(term); ti.business_unit_merchant_number_id.Value = bumn.Variable; ti.GenVariable(); _sqlEntities.Add(ti); } foreach (var c in _provider.Contents) { Template t = new Template(); t.PopulateFrom(c); t.template_text.Value = _contentTexts[c.Text]; SqlVariable templateVariable = AddUniqueSqlEntity(t); Content_assignment ca = new Content_assignment(); ca.PopulateFrom(c); ca.attached_to_type_cd_id.Value = GSC(SystemCodeType.SYSTEM_OBJECT_TYPE, "business unit"); ca.template_id.Value = templateVariable; ca.attached_to_id.Value = party.Variable; _sqlEntities.Add(ca); } return party; }
public void PopulateFrom(Service s) { this.product_display_name.Value = s.DisplayName; this.end_date.Value = s.DisableDate; this.product_internal_name.Value = s.InternalName; this.start_date.Value = s.EnableDate; }