Esempio n. 1
0
 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);
     }
 }
        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);
        }