static CustomerSupportVendorRow mapToCustomerSupportVendorRow(CustomerSupportVendorDto pCustomerSupportVendor) { if (pCustomerSupportVendor == null) { return(null); } CustomerSupportVendorRow _customerSupportVendorRow = new CustomerSupportVendorRow(); _customerSupportVendorRow.Vendor_id = pCustomerSupportVendor.VendorId; _customerSupportVendorRow.Name = pCustomerSupportVendor.Name; _customerSupportVendorRow.Contact_info_id = pCustomerSupportVendor.ContactInfo.ContactInfoId; return(_customerSupportVendorRow); }
static CustomerSupportVendorDto mapToCustomerSupportVendor(CustomerSupportVendorRow pCustomerSupportVendorRow, ContactInfoDto pContactInfo) { if (pCustomerSupportVendorRow == null) { return(null); } CustomerSupportVendorDto _customerSupportVendor = new CustomerSupportVendorDto(); _customerSupportVendor.VendorId = pCustomerSupportVendorRow.Vendor_id; _customerSupportVendor.Name = pCustomerSupportVendorRow.Name; _customerSupportVendor.ContactInfo = pContactInfo; return(_customerSupportVendor); }
internal static void SaveCustomerSupportVendor(Rbr_Db pDb, CustomerSupportVendorDto pCustomerSupportVendor) { CustomerSupportVendorRow _customerSupportVendorRow = mapToCustomerSupportVendorRow(pCustomerSupportVendor); if (_customerSupportVendorRow != null) { if (_customerSupportVendorRow.Vendor_id == 0) { pDb.CustomerSupportVendorCollection.Insert(_customerSupportVendorRow); pCustomerSupportVendor.VendorId = _customerSupportVendorRow.Vendor_id; } else { pDb.CustomerSupportVendorCollection.Update(_customerSupportVendorRow); } } }
public static void Save(CustomerSupportVendorDto pCustomerSupportVendor) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pCustomerSupportVendor)) { //1. REQUIRED set Contact Info if (pCustomerSupportVendor.ContactInfo.ContactInfoId == 0) { ContactInfoManager.Add(_db, pCustomerSupportVendor.ContactInfo); } else { ContactInfoManager.Update(_db, pCustomerSupportVendor.ContactInfo); } CustomerSupportManager.SaveCustomerSupportVendor(_db, pCustomerSupportVendor); _tx.Commit(); } } }