Пример #1
0
        public static AuthorizationConfig CreateNew(string email, string LinnworksUniqueIdentifier, string accountName, string serverPath)
        {
            AuthorizationConfig output = new AuthorizationConfig();

            output.AuthorizationToken = Guid.NewGuid();
            output.Email = email;
            output.LinnworksUniqueIdentifier = LinnworksUniqueIdentifier;
            output.AccountName = accountName;
            output.serverPath  = serverPath;
            output.Save();
            return(output);
        }
Пример #2
0
 public static AuthorizationConfig Load(string AuthorizationToken)
 {
     if (AwsS3.S3FileIsExists("Files/" + AuthorizationToken + ".json"))
     {
         string json = AwsS3.GetS3File("Files/" + AuthorizationToken + ".json");
         AuthorizationConfig output = Newtonsoft.Json.JsonConvert.DeserializeObject <AuthorizationConfig>(json);
         return(output);
     }
     else
     {
         return(null);
     }
 }
 public static ConfigStage GetUserConfigStage(AuthorizationConfig authConfig)
 {
     return(new ConfigStage()
     {
         WizardStepDescription = "Customer config can be changed",
         WizardStepTitle = "Customer Details",
         ConfigItems = new List <ConfigItem>()
         {
             new ConfigItem()
             {
                 ConfigItemId = "NAME",
                 Description = "Contact name",
                 GroupName = "Sender Address",
                 MustBeSpecified = true,
                 Name = "Contact Name",
                 ReadOnly = false,
                 SelectedValue = authConfig.AccountName,
                 SortOrder = 1,
                 ValueType = ConfigValueType.STRING
             },
             new ConfigItem()
             {
                 ConfigItemId = "ADDRESS1",
                 Description = "Address line 1",
                 GroupName = "Sender Address",
                 MustBeSpecified = true,
                 Name = "Address 1",
                 ReadOnly = false,
                 SelectedValue = authConfig.AddressLine1,
                 SortOrder = 3,
                 ValueType = ConfigValueType.STRING
             },
             new ConfigItem()
             {
                 ConfigItemId = "COUNTRY",
                 Description = "Country",
                 GroupName = "Sender Address",
                 MustBeSpecified = true,
                 Name = "Country",
                 ReadOnly = true,
                 SelectedValue = authConfig.CountryCode,
                 SortOrder = 7,
                 ValueType = ConfigValueType.LIST,
                 ListValues = new List <ConfigItemListItem>()
                 {
                     new ConfigItemListItem()
                     {
                         Display = "United Kingdom",
                         Value = "GB"
                     },
                     new ConfigItemListItem()
                     {
                         Display = "Germany",
                         Value = "DE"
                     },
                     new ConfigItemListItem()
                     {
                         Display = "France",
                         Value = "FR"
                     },
                     new ConfigItemListItem()
                     {
                         Display = "United States",
                         Value = "US"
                     }
                 }
             }
         }
     });
 }