public void CreateClientVendorRel(Client client, Vendor vendor, AuthKey authKey) { using (InfrastructureEntities context = new InfrastructureEntities()) { var result = context.ClientVendorRels.Select(v => v).ToList(); var clientVendor = new ClientVendorRel(); clientVendor.ClientId = client.Id; clientVendor.VendorId = vendor.Id; clientVendor.SourceName = vendor.VendorName + "-" + client.CodeName; clientVendor.Enabled = true; clientVendor.CreatedTime = DateTime.Now; context.ClientVendorRels.Add(clientVendor); context.SaveChanges(); authKey.UniqueIdentifier = authKey.CreateAuthKey(clientVendor); } }
private void AddVendor(string vendorName) { using (InfrastructureEntities context = new InfrastructureEntities()) { var results = context.Vendors.Select(v => v).ToList(); var vendor = new Data.Vendor(); vendor.CreatedTime = DateTime.Now; vendor.Enabled = true; vendor.VendorName = vendorName; vendor.Id = results.Count; results.Add(vendor); context.Vendors.Add(vendor); context.SaveChanges(); } }
public string CreateAuthKey(ClientVendorRel clientVendor) { AuthKey authKey = new AuthKey(); using (InfrastructureEntities context = new InfrastructureEntities()) { var result = context.AuthorizationWS.Select(v => v).ToList(); var newAuth = new AuthorizationW(); newAuth.AuthorizationGuid = Guid.NewGuid(); authKey.UniqueIdentifier = newAuth.AuthorizationGuid.ToString(); newAuth.ClientVendorId = clientVendor.Id; newAuth.InternalURL = "http://api.dev.rmiatl.org/lead/v2/"; newAuth.Enabled = true; newAuth.CreatedTime = DateTime.Now; context.AuthorizationWS.Add(newAuth); context.SaveChanges(); } return(authKey.UniqueIdentifier); }