This commit is contained in:
2020-01-23 22:56:01 +00:00
parent 866428776f
commit 784ea46fd1
24 changed files with 365 additions and 902 deletions

View File

@@ -43,13 +43,7 @@ namespace AyaNova.Biz
return await ct.DataListFilter.AnyAsync(e => e.Id == id);
}
////////////////////////////////////////////////////////////////////////////////////////////////
/// GET
internal async Task<DataListFilter> GetNoLogAsync(long fetchId)
{
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
return await ct.DataListFilter.SingleOrDefaultAsync(m => m.Id == fetchId);
}
////////////////////////////////////////////////////////////////////////////////////////////////
//CREATE
@@ -127,6 +121,14 @@ namespace AyaNova.Biz
return ret;
}
////////////////////////////////////////////////////////////////////////////////////////////////
/// GET
internal async Task<DataListFilter> GetNoLogAsync(long fetchId)
{
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
return await ct.DataListFilter.SingleOrDefaultAsync(m => m.Id == fetchId);
}
//get picklist (NOT PAGED)
internal async Task<List<NameIdItem>> GetPickListAsync(string listKey)

View File

@@ -47,21 +47,13 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
/// GET
///
///
///
//Get without logging
internal async Task<Widget> GetNoLogAsync(long fetchId)
{
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
return await ct.Widget.SingleOrDefaultAsync(m => m.Id == fetchId);
}
//Get one with logging
internal async Task<Widget> GetAsync(long fetchId)
internal async Task<Widget> GetAsync(long fetchId, bool log = true)
{
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
var ret = await ct.Widget.SingleOrDefaultAsync(m => m.Id == fetchId);
if (ret != null)
if (log && ret != null)
{
//Log
EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct);
@@ -264,53 +256,6 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
// LISTS
//
//Generic list of widgets
#region GetList
// internal async Task<ApiPagedResponse> GetList(IUrlHelper Url, string routeName, ListOptions listOptions)
// {
// //TODO: Get template (MOCKED FOR NOW UNTIL PROOF OF CONCEPT)
// var MOCK_WIDGET_DISPLAY_TEMPLATE_JSON = @"
// {
// ""full"":[""widgetname"",""widgetserial"",""widgetdollaramount"",""widgetroles"",""widgetstartdate"",""widgetactive"",""username""],
// ""mini"":[""widgetname"",""widgetserial""]
// }
// ";
// return await DataListFetcher.GetResponse(nameof(WidgetDataList), ct, Url, routeName, listOptions, MOCK_WIDGET_DISPLAY_TEMPLATE_JSON, UserId);
// }
#endregion
//TEST WIDGET->USER->EMAILADDRESS multi table list
//once this is working can replicate at will
#region TestGetWidgetUserEmailList
// internal async Task<ApiPagedResponse> TestGetWidgetUserEmailList(IUrlHelper Url, string routeName, ListOptions listOptions)
// {
// //var dlist=AyaNova.DataList.DataListFactory.GetListOfAllDataListKeyNames();
// //TODO: Get template (MOCKED FOR NOW UNTIL PROOF OF CONCEPT)
// var MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON = @"
// {
// ""full"":[""widgetname"",""username"",""emailaddress"",""widgetactive""],
// ""mini"":[""widgetname"",""username"",""emailaddress""]
// }
// ";
// return await DataListFetcher.GetResponse(nameof(TestWidgetUserEmailDataList), ct, Url, routeName, listOptions, MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON, UserId);
// }
#endregion
////////////////////////////////////////////////////////////////////////////////////////////////
//VALIDATION
//
@@ -324,18 +269,6 @@ namespace AyaNova.Biz
//run validation and biz rules
bool isNew = currentObj == null;
// if (isNew)
// {
// //WARNING: this is not really the "current" object, it's been modified already by caller
// // //NEW widgets must be active
// // if (inObj.Active == null || ((bool)inObj.Active) == false)
// // {
// // AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Active", "New widget must be active");
// // }
// }
//Name required
if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
@@ -387,23 +320,6 @@ namespace AyaNova.Biz
CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
}
//for debug purposes
#if (DEBUG)
//TESTING
//make a fake server error for ui testing purposes
// if (proposedObj.Count == 666)
// {
// AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Count", "Test field server error");
// }
//removed because seeding huge kept triggering this
// if (proposedObj.DollarAmount == 666.66M)
// {
// AddError(ApiErrorCode.INVALID_OPERATION, null, "This is a test of a general server error");
// }
//TESTING
#endif
return;
}