This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -35,7 +35,7 @@
|
||||
"SOCKEYE_DB_CONNECTION": "Server=localhost;Username=postgres;Password=sockeye;Database=sockeye;CommandTimeout=300;",
|
||||
"SOCKEYE_DATA_PATH": "c:\\temp\\sockeye",
|
||||
"SOCKEYE_USE_URLS": "http://*:7676;",
|
||||
//"SOCKEYE_PERMANENTLY_ERASE_DATABASE":"true",
|
||||
"SOCKEYE_PERMANENTLY_ERASE_DATABASE":"true",
|
||||
//"SOCKEYE_REMOVE_LICENSE_FROM_DB":"true",
|
||||
//"SOCKEYE_REPORT_RENDERING_TIMEOUT":"1",
|
||||
"SOCKEYE_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin"
|
||||
|
||||
@@ -48,6 +48,14 @@ namespace Sockeye.DataList
|
||||
SqlValueColumnName = "acustomer.active"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "DoNotContact",
|
||||
FieldKey = "DoNotContact",
|
||||
UiFieldDataType = (int)UiFieldDataType.Bool,
|
||||
SqlValueColumnName = "acustomer.donotcontact"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Tags",
|
||||
|
||||
@@ -662,6 +662,10 @@ namespace Sockeye
|
||||
Console.WriteLine("Forced shutdown: Ctrl+C keyboard shortcut");
|
||||
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
|
||||
|
||||
|
||||
|
||||
GlobalBizSettingsBiz biz = GlobalBizSettingsBiz.GetBiz(dbContext);
|
||||
biz.ImportRockfish(dbContext, _newLog).Wait();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -250,6 +250,7 @@ namespace Sockeye.Biz
|
||||
.AddText(obj.Region)
|
||||
.AddText(obj.Country)
|
||||
.AddText(obj.AddressPostal)
|
||||
.AddText(obj.DbId)
|
||||
.AddCustomFields(obj.CustomFields);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,11 +201,70 @@ namespace Sockeye.Biz
|
||||
*/
|
||||
res = await client.GetAsync($"{URL_ROCKFISH}api/customer/list");
|
||||
responseText = await res.Content.ReadAsStringAsync();
|
||||
var d = JArray.Parse(responseText);
|
||||
//
|
||||
var jaCustomerList = JArray.Parse(responseText);
|
||||
foreach (JObject jCustomerListItem in jaCustomerList)
|
||||
{
|
||||
res = await client.GetAsync($"{URL_ROCKFISH}api/customer/{jCustomerListItem["id"].Value<long>()}");
|
||||
|
||||
var jCustomer = JObject.Parse(await res.Content.ReadAsStringAsync());
|
||||
|
||||
//SITES
|
||||
res = await client.GetAsync($"{URL_ROCKFISH}api/customer/{jCustomerListItem["id"].Value<long>()}/sites");
|
||||
var jaSiteList = JArray.Parse(await res.Content.ReadAsStringAsync());
|
||||
|
||||
bool multiSite = jaSiteList.Count() > 1;
|
||||
|
||||
foreach (JObject jSite in jaSiteList)
|
||||
{
|
||||
var CustomerName = jCustomer["name"].Value<string>();
|
||||
if (multiSite)
|
||||
CustomerName += " - " + jSite["name"].Value<string>();
|
||||
|
||||
//Create customer if we don't have one already
|
||||
if (await ct.Customer.AnyAsync(z => z.Name == CustomerName))
|
||||
continue;//already have this one so no need to process it again
|
||||
{
|
||||
//CREATE CUSTOMER
|
||||
Customer c = new Customer();
|
||||
c.Name = CustomerName;
|
||||
c.Country = jSite["country"].Value<string>();
|
||||
c.Region = jSite["stateProvince"].Value<string>();
|
||||
c.DoNotContact = jCustomer["doNotContact"].Value<bool>();
|
||||
c.Notes = jCustomer["notes"].Value<string>();
|
||||
c.DbId = jSite["dbId"].Value<string>();
|
||||
if (c.DbId == "v7_no_dbid"){
|
||||
c.DbId=null;
|
||||
c.Tags.Add("v7");
|
||||
}
|
||||
else
|
||||
c.Tags.Add("raven");
|
||||
|
||||
if (jSite["hosted"].Value<bool>() == true)
|
||||
c.Tags.Add("hosted");
|
||||
|
||||
var adminEmail = jCustomer["adminEmail"].Value<string>();
|
||||
if (!string.IsNullOrWhiteSpace(adminEmail))
|
||||
c.Notes += "\nAdmin Email: " + adminEmail;
|
||||
c.EmailAddress = jCustomer["adminEmail"].Value<string>();
|
||||
CustomerBiz biz = CustomerBiz.GetBiz(ct);
|
||||
var NewObject = await biz.CreateAsync(c);
|
||||
|
||||
//Add all customer related shit here
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}//end of all customers iteration
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -214,6 +273,7 @@ namespace Sockeye.Biz
|
||||
}
|
||||
|
||||
|
||||
log.LogInformation("FINISHED IMPORTING");
|
||||
//in the correct order retrieve every object and if it's not already present in sockeye, import it
|
||||
//this should be callable any time and it will just update so it can be test live in sync / parallel until ready to switch over
|
||||
//await Task.CompletedTask;
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Sockeye.Models
|
||||
//NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal,
|
||||
//otherwise the server will call it an invalid record if the field isn't sent from client
|
||||
|
||||
//#### MIRRORED IN QBI !!
|
||||
public class Customer : ICoreBizObjectModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
@@ -19,14 +18,14 @@ namespace Sockeye.Models
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public bool DoNotContact { get; set; }
|
||||
public string DbId { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public string Wiki { get; set; }
|
||||
public string CustomFields { get; set; }
|
||||
public List<string> Tags { get; set; }
|
||||
|
||||
|
||||
//cant use these due to import v7 malformed shit adn can't be arsed to deal with that
|
||||
//[Url]
|
||||
public string WebAddress { get; set; }
|
||||
public string AlertNotes { get; set; }
|
||||
public bool BillHeadOffice { get; set; }
|
||||
@@ -35,7 +34,7 @@ namespace Sockeye.Models
|
||||
public string HeadOfficeViz { get; set; }
|
||||
public string TechNotes { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
|
||||
public string Phone1 { get; set; }
|
||||
public string Phone2 { get; set; }
|
||||
public string Phone3 { get; set; }
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace Sockeye.Util
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
|
||||
private const int DESIRED_SCHEMA_LEVEL = 16;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 495;
|
||||
internal const long EXPECTED_COLUMN_COUNT = 497;
|
||||
internal const long EXPECTED_INDEX_COUNT = 71;
|
||||
internal const long EXPECTED_CHECK_CONSTRAINTS = 237;
|
||||
internal const long EXPECTED_CHECK_CONSTRAINTS = 238;
|
||||
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 32;
|
||||
internal const long EXPECTED_VIEWS = 0;
|
||||
internal const long EXPECTED_ROUTINES = 2;
|
||||
@@ -491,7 +491,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
|
||||
//CUSTOMER
|
||||
await ExecQueryAsync("CREATE TABLE acustomer (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, "
|
||||
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, "
|
||||
+ "notes TEXT, donotcontact BOOL NOT NULL DEFAULT false, dbid TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, "
|
||||
+ "webaddress TEXT, alertnotes TEXT, billheadoffice BOOL, technotes TEXT, accountnumber TEXT, "
|
||||
+ "phone1 TEXT, phone2 TEXT, phone3 TEXT, phone4 TEXT, phone5 TEXT, emailaddress TEXT, "
|
||||
+ "postaddress TEXT, postcity TEXT, postregion TEXT, postcountry TEXT, postcode TEXT, address TEXT, city TEXT, region TEXT, country TEXT, latitude DECIMAL(9,6), longitude DECIMAL(9,6) "
|
||||
@@ -1220,6 +1220,21 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
|
||||
#endregion gzcase
|
||||
|
||||
#region CUSTOMER ADDITIONS
|
||||
//english translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'DoNotContact', 'Do not contact' FROM atranslation t where t.baselanguage = 'en'");
|
||||
|
||||
//spanish translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'DoNotContact', 'Do not contact' FROM atranslation t where t.baselanguage = 'es'");
|
||||
|
||||
//french translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'DoNotContact', 'Do not contact' FROM atranslation t where t.baselanguage = 'fr'");
|
||||
|
||||
//german translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'DoNotContact', 'Do not contact' FROM atranslation t where t.baselanguage = 'de'");
|
||||
|
||||
#endregion customer additions
|
||||
|
||||
currentSchema = 16;
|
||||
await SetSchemaLevelAsync(currentSchema);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user