This commit is contained in:
89
server/AyaNova/DataList/UnitMeterReadingDataList.cs
Normal file
89
server/AyaNova/DataList/UnitMeterReadingDataList.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System.Collections.Generic;
|
||||
using AyaNova.Biz;
|
||||
using AyaNova.Models;
|
||||
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
internal class UnitMeterReadingDataList : DataListProcessingBase, IDataListInternalCriteria
|
||||
{
|
||||
public UnitMeterReadingDataList()
|
||||
{
|
||||
DefaultListAType = AyaType.UnitMeterReading;
|
||||
SQLFrom = "from aunitmeterreading left join aunit on (aunitmeterreading.unitid=aunit.id) left join aworkorderitem on (aunitmeterreading.workorderitemid) left join aworkorder";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
DefaultColumns = new List<string>() { "notedate", "UnitMeterReadingDescription", "Unit" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "notedate", "-" } };
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Unit",
|
||||
FieldKey = "Unit",
|
||||
AType = (int)AyaType.Unit,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "aunit.id",
|
||||
SqlValueColumnName = "aunit.name",
|
||||
IsRowId = false
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "UnitMeterReadingDescription",
|
||||
FieldKey = "UnitMeterReadingDescription",
|
||||
AType = (int)AyaType.UnitMeterReading,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "aunitmeterreading.id",
|
||||
SqlValueColumnName = "aunitmeterreading.description",
|
||||
IsRowId = false
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "UnitMeterReadingMeter",
|
||||
FieldKey = "UnitMeterReadingMeter",
|
||||
AType = (int)AyaType.UnitMeterReading,
|
||||
UiFieldDataType = (int)UiFieldDataType.Integer,
|
||||
SqlIdColumnName = "aunitmeterreading.id",
|
||||
SqlValueColumnName = "aunitmeterreading.meter",
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "UnitMeterReadingMeterDate",
|
||||
FieldKey = "UnitMeterReadingMeterDate",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "aunitmeterreading.meterdate"
|
||||
});
|
||||
|
||||
//META column
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metaunit",
|
||||
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||
SqlIdColumnName = "aunitmeterreading.unitid",
|
||||
SqlValueColumnName = "aunitmeterreading.unitid",
|
||||
IsMeta = true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
//ClientCriteria MUST be CustomerId
|
||||
if (string.IsNullOrWhiteSpace(clientCriteria))
|
||||
throw new System.ArgumentNullException("UnitMeterReadingDataList - ClientCriteria is empty, should be Customer ID");
|
||||
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = clientCriteria, op = DataListFilterComparisonOperator.Equality });
|
||||
|
||||
ret.Add(FilterOption);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -18,7 +18,7 @@ namespace AyaNova.Models
|
||||
public long Meter { get; set; }
|
||||
public DateTime MeterDate { get; set; }
|
||||
public long UnitId { get; set; }
|
||||
public long? WorkOrderItemId { get; set; }
|
||||
public long? WorkOrderItemUnitId { get; set; }
|
||||
[NotMapped]
|
||||
public string UnitViz { get; set; }
|
||||
[NotMapped]
|
||||
|
||||
@@ -1120,7 +1120,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
|
||||
//UNITMETERREADING
|
||||
await ExecQueryAsync("CREATE TABLE aunitmeterreading (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, meterdate TIMESTAMP NOT NULL, description TEXT, "
|
||||
+ "meter BIGINT NOT NULL, unitid BIGINT NOT NULL REFERENCES aunit(id) ON DELETE CASCADE, workorderitemid BIGINT REFERENCES aworkorderitem(id) ON DELETE SET NULL)");
|
||||
+ "meter BIGINT NOT NULL, unitid BIGINT NOT NULL REFERENCES aunit(id) ON DELETE CASCADE, workorderitemunitid BIGINT REFERENCES aworkorderitemunit(id) ON DELETE SET NULL)");
|
||||
|
||||
//LOGO
|
||||
await ExecQueryAsync("CREATE TABLE alogo (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "
|
||||
|
||||
Reference in New Issue
Block a user