diff --git a/.vscode/launch.json b/.vscode/launch.json index d4569e4..ec71760 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceRoot}/bin/Debug/netcoreapp2.1/rockfishCore.dll", + "program": "${workspaceRoot}/bin/Debug/netcoreapp3.1/rockfishCore.dll", "args": [], "cwd": "${workspaceRoot}", "stopAtEntry": false, diff --git a/Controllers/CustomerController.cs b/Controllers/CustomerController.cs index 54665af..afd1e04 100644 --- a/Controllers/CustomerController.cs +++ b/Controllers/CustomerController.cs @@ -50,6 +50,32 @@ namespace rockfishCore.Controllers } + // //Get api/customer/list + // [HttpGet("list")] + // public ActionResult GetList() + // { + + // var res = from c in _context.Customer.OrderBy(c => c.Name) + // select new dtoCustomerListItem + // { + // lapsed = false, + // active = c.Active, + // id = c.Id, + // name = c.Name + // }; + + // //Need to be made into a list before updating or else the changes would be lost + // //The tolist is what triggers the actual query to run + // var LapsedRes = res.ToList(); + // foreach (dtoCustomerListItem i in LapsedRes) + // { + // i.lapsed = CustomerHasLapsed(i.id); + // } + + // return Ok(LapsedRes); + // } + + /// /// Check if a customer has any active subs /// return true if no active subs diff --git a/Controllers/MailController.cs b/Controllers/MailController.cs index 64abedb..1ee1adb 100644 --- a/Controllers/MailController.cs +++ b/Controllers/MailController.cs @@ -138,8 +138,8 @@ namespace rockfishCore.Controllers public class dtoReplyMessageItem { - public string composition; - public bool trackDelivery; + public string composition { get; set; } + public bool trackDelivery { get; set; } } diff --git a/Controllers/OpsController.cs b/Controllers/OpsController.cs index bce340f..3338ded 100644 --- a/Controllers/OpsController.cs +++ b/Controllers/OpsController.cs @@ -102,8 +102,8 @@ namespace rockfishCore.Controllers public class dtoOpsStatus { - public bool Status; - public string ServiceCheckError; + public bool Status { get; set; } + public string ServiceCheckError { get; set; } public dtoOpsStatus() { diff --git a/Controllers/ReportController.cs b/Controllers/ReportController.cs index 04db8f0..c41491e 100644 --- a/Controllers/ReportController.cs +++ b/Controllers/ReportController.cs @@ -27,7 +27,7 @@ namespace rockfishCore.Controllers _configuration = configuration; } - + /////////////////////////////////////////////////////// //Get expiring subscriptions list @@ -54,12 +54,12 @@ namespace rockfishCore.Controllers //dto classes for route public class expiresResultItem { - public long id; - public string name; - public string Customer; - public long customerId; - public long? expireDate; - public long site_id; + public long id { get; set; } + public string name { get; set; } + public string Customer { get; set; } + public long customerId { get; set; } + public long? expireDate { get; set; } + public long site_id { get; set; } } @@ -110,7 +110,7 @@ namespace rockfishCore.Controllers private List getEmailsForClient(long id) { List ret = new List(); - + //New for RF 6 var cust = _context.Customer.Where(p => p.Id == id).FirstOrDefault(); if (cust != null) @@ -121,7 +121,7 @@ namespace rockfishCore.Controllers ret.Add(cust.SupportEmail); } - //TOASTED for RF 6 + //TOASTED for RF 6 //search contact, trial, purchase, incident (optionally) // ret.AddRange(_context.Purchase.Where(p => p.CustomerId == id).Select(p => p.Email).Distinct().ToList()); // ret.AddRange(_context.Contact.Where(p => p.CustomerId == id).Select(p => p.Email).Distinct().ToList()); @@ -188,9 +188,9 @@ namespace rockfishCore.Controllers //dto classes for route public class requestEmailsForProductCodes { - public string[] products; - public bool ckIncidental; - public bool ckNoContact; + public string[] products { get; set; } + public bool ckIncidental { get; set; } + public bool ckNoContact { get; set; } } ///////////////////////////////////////////////////////////////////////////////////// diff --git a/Controllers/SubscriptionController.cs b/Controllers/SubscriptionController.cs index f0983f4..abbc796 100644 --- a/Controllers/SubscriptionController.cs +++ b/Controllers/SubscriptionController.cs @@ -102,11 +102,11 @@ namespace rockfishCore.Controllers //dto classes for route public class subnotifyResultItem { - public long id; - public string Customer; - public string purchasenames; - public List purchaseidlist; - public long customerId; + public long id { get; set; } + public string Customer { get; set; } + public string purchasenames { get; set; } + public List purchaseidlist { get; set; } + public long customerId { get; set; } } diff --git a/Controllers/UserController.cs b/Controllers/UserController.cs index e4d5897..32c27e1 100644 --- a/Controllers/UserController.cs +++ b/Controllers/UserController.cs @@ -127,7 +127,7 @@ namespace rockfishCore.Controllers //------------ - + [HttpPost("{id}/changepassword")] public JsonResult ChangePassword([FromRoute] long id, [FromBody] dtoChangePassword cp) { @@ -161,8 +161,8 @@ namespace rockfishCore.Controllers public class dtoChangePassword { - public string oldpassword; - public string newpassword; + public string oldpassword { get; set; } + public string newpassword { get; set; } } diff --git a/Models/dtoCustomerListItem.cs b/Models/dtoCustomerListItem.cs index 489d479..33b9929 100644 --- a/Models/dtoCustomerListItem.cs +++ b/Models/dtoCustomerListItem.cs @@ -3,9 +3,9 @@ namespace rockfishCore.Models //Used to populate list routes for return public class dtoCustomerListItem { - public bool active; - public bool lapsed; - public long id; - public string name; + public bool active { get; set; } + public bool lapsed { get; set; } + public long id { get; set; } + public string name { get; set; } } } \ No newline at end of file diff --git a/Models/dtoLicenseListItem.cs b/Models/dtoLicenseListItem.cs index a268a67..ff77502 100644 --- a/Models/dtoLicenseListItem.cs +++ b/Models/dtoLicenseListItem.cs @@ -2,12 +2,12 @@ namespace rockfishCore.Models { //Used to populate list routes for return public class dtoLicenseListItem - { - public long id; - public long created; - public string regto; - public bool fetched; - public bool trial; + { + public long id { get; set; } + public long created { get; set; } + public string regto { get; set; } + public bool fetched { get; set; } + public bool trial { get; set; } } } diff --git a/Models/dtoNameIdActiveItem.cs b/Models/dtoNameIdActiveItem.cs index fb061b8..c52be01 100644 --- a/Models/dtoNameIdActiveItem.cs +++ b/Models/dtoNameIdActiveItem.cs @@ -3,8 +3,8 @@ namespace rockfishCore.Models //Used to populate list routes for return public class dtoNameIdActiveItem { - public bool active; - public long id; - public string name; + public bool active { get; set; } + public long id { get; set; } + public string name { get; set; } } } \ No newline at end of file diff --git a/Models/dtoNameIdChildrenItem.cs b/Models/dtoNameIdChildrenItem.cs index 839792b..7b1335b 100644 --- a/Models/dtoNameIdChildrenItem.cs +++ b/Models/dtoNameIdChildrenItem.cs @@ -9,10 +9,10 @@ namespace rockfishCore.Models { children = new List(); } - public long id; - public string name; - public List children; + public long id { get; set; } + public string name { get; set; } + public List children { get; set; } } - + } \ No newline at end of file diff --git a/Models/dtoNameIdItem.cs b/Models/dtoNameIdItem.cs index cc445e5..628a4f1 100644 --- a/Models/dtoNameIdItem.cs +++ b/Models/dtoNameIdItem.cs @@ -2,8 +2,8 @@ namespace rockfishCore.Models { //Used to populate list routes for return public class dtoNameIdItem - { - public long id; - public string name; + { + public long id { get; set; } + public string name { get; set; } } } \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index 1bc25b2..7d8fe12 100644 --- a/Startup.cs +++ b/Startup.cs @@ -77,6 +77,8 @@ namespace rockfishCore }; }); + + } @@ -113,6 +115,7 @@ namespace rockfishCore app.UseEndpoints(endpoints => { endpoints.MapControllers(); + }); } } diff --git a/rockfishCore.csproj b/rockfishCore.csproj index eb5bc72..a644f92 100644 --- a/rockfishCore.csproj +++ b/rockfishCore.csproj @@ -8,13 +8,13 @@ - - + + \ No newline at end of file diff --git a/util/FBImporter.cs b/util/FBImporter.cs index da43e69..aa8be03 100644 --- a/util/FBImporter.cs +++ b/util/FBImporter.cs @@ -259,21 +259,21 @@ namespace rockfishCore.Util { attachments = new List(); } - public bool noRecord; - public string id; - public string title; - public string project; - public int priority; - public string notes; - public long? created; - public long? closed; - public List attachments; + public bool noRecord { get; set; } + public string id { get; set; } + public string title { get; set; } + public string project { get; set; } + public int priority { get; set; } + public string notes { get; set; } + public long? created { get; set; } + public long? closed { get; set; } + public List attachments { get; set; } } public class fbAttachment { - public string fileName; - public byte[] blob; + public string fileName { get; set; } + public byte[] blob { get; set; } } //eoc diff --git a/util/OpsDiagnostics.cs b/util/OpsDiagnostics.cs index 56845ca..677f475 100644 --- a/util/OpsDiagnostics.cs +++ b/util/OpsDiagnostics.cs @@ -21,13 +21,18 @@ namespace rockfishCore.Util private const string S3_HOST_ENDPOINT = "https://nyc3.digitaloceanspaces.com"; private const string S3_BUCKET_NAME = "gztw1"; - private static HttpClient Client = new HttpClient(); + private static readonly HttpClient _httpClient; + static OpsDiagnostics() + { + _httpClient = new HttpClient(); + } + public static bool CheckWebsite(string url, string mustContain) { bool Result = false; - var Response = Client.GetAsync(url).Result; + var Response = _httpClient.GetAsync(url).Result; if (Response.IsSuccessStatusCode) { var PageText = Response.Content.ReadAsStringAsync().Result; @@ -73,9 +78,11 @@ namespace rockfishCore.Util } }; - var httpClient = new HttpClient(httpClientHandler); - await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url)); - + using (var httpClient = new HttpClient(httpClientHandler)) + { + await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url)); + //httpClient.Dispose(); + } return ret; } diff --git a/util/RfMail.cs b/util/RfMail.cs index 3fb1e08..da279b2 100644 --- a/util/RfMail.cs +++ b/util/RfMail.cs @@ -43,8 +43,8 @@ namespace rockfishCore.Util public class rfMailMessage { - public MimeMessage message; - public uint uid; + public MimeMessage message { get; set; } + public uint uid { get; set; } } @@ -119,8 +119,8 @@ namespace rockfishCore.Util bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "") { var message = new MimeMessage(); - message.From.Add(new MailboxAddress("",MessageFrom)); - message.To.Add(new MailboxAddress("",MessageTo)); + message.From.Add(new MailboxAddress("", MessageFrom)); + message.To.Add(new MailboxAddress("", MessageTo)); message.Subject = MessageSubject; message.Body = new TextPart("plain") @@ -273,12 +273,12 @@ namespace rockfishCore.Util case rfMailAccount.sales: from_account = MAIL_ACCOUNT_SALES; from_account_password = MAIL_ACCOUNT_PASSWORD_SALES; - from = new MailboxAddress("",from_account); + from = new MailboxAddress("", from_account); break; default: from_account = MAIL_ACCOUNT_SUPPORT; from_account_password = MAIL_ACCOUNT_PASSWORD_SUPPORT; - from = new MailboxAddress("",from_account); + from = new MailboxAddress("", from_account); break; } reply.From.Add(from); @@ -342,7 +342,7 @@ namespace rockfishCore.Util theBody = StripHTML(ht, true); theBody += "> "; theBody = theBody.Replace("\r\n", "\r\n> ").Trim().TrimEnd('>'); - theBody ="\r\n"+theBody;//descend the first line under the On you wrote bit + theBody = "\r\n" + theBody;//descend the first line under the On you wrote bit } else @@ -520,7 +520,7 @@ namespace rockfishCore.Util string CustomHeader = "", string CustomHeaderValue = "") { var message = new MimeMessage(); - message.From.Add(new MailboxAddress("",MessageFrom)); + message.From.Add(new MailboxAddress("", MessageFrom)); //case 3512 handle more than one email in the address @@ -530,13 +530,13 @@ namespace rockfishCore.Util var addrs = MessageTo.Split(','); foreach (string addr in addrs) { - mbAll.Add(new MailboxAddress("",addr.Trim())); + mbAll.Add(new MailboxAddress("", addr.Trim())); } message.To.AddRange(mbAll); } else { - message.To.Add(new MailboxAddress("",MessageTo)); + message.To.Add(new MailboxAddress("", MessageTo)); } @@ -656,12 +656,12 @@ namespace rockfishCore.Util public class rfMessageSummary { - public string account; - public uint id; - public string from; - public string subject; - public long? sent; - public string flags; + public string account { get; set; } + public uint id { get; set; } + public string from { get; set; } + public string subject { get; set; } + public long? sent { get; set; } + public string flags { get; set; } } //Fetch a single string preview of message by Account / folder / UID @@ -737,9 +737,9 @@ namespace rockfishCore.Util public class rfMessagePreview { - public bool isKeyRequest; - public string preview; - public uint id; + public bool isKeyRequest { get; set; } + public string preview { get; set; } + public uint id { get; set; } } diff --git a/util/RfVersion.cs b/util/RfVersion.cs index fc08387..fafe3c3 100644 --- a/util/RfVersion.cs +++ b/util/RfVersion.cs @@ -2,7 +2,7 @@ namespace rockfishCore.Util { public static class RfVersion { - public const string NumberOnly="6.8"; + public const string NumberOnly="6.9"; public const string Full = "Rockfish server " + NumberOnly; } } \ No newline at end of file