This commit is contained in:
@@ -319,6 +319,33 @@ namespace AyaNova.Api.Controllers
|
|||||||
return Ok(ApiOkResponse.Response(ret));
|
return Ok(ApiOkResponse.Response(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get list of Customer Contact Users
|
||||||
|
/// (Rights to Customer object required)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Customer contact users</returns>
|
||||||
|
[HttpGet("customer-contacts/{customerId}")]
|
||||||
|
public async Task<IActionResult> GetClientContactList(long customerId)
|
||||||
|
{
|
||||||
|
if (!serverState.IsOpen)
|
||||||
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
|
||||||
|
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
|
||||||
|
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
|
|
||||||
|
var ret = await ct.User.Where(z => z.UserType == UserType.Customer && z.CustomerId==customerId).Select(z => new dtUser
|
||||||
|
{
|
||||||
|
Id = z.Id,
|
||||||
|
Active = z.Active,
|
||||||
|
Name = z.Name,
|
||||||
|
UserType = z.UserType,
|
||||||
|
LastLogin = z.LastLogin
|
||||||
|
|
||||||
|
}).ToListAsync();
|
||||||
|
return Ok(ApiOkResponse.Response(ret));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetch user type (inside meaning staff or subcontractor or outside meaning customer or headoffice type user)
|
/// Fetch user type (inside meaning staff or subcontractor or outside meaning customer or headoffice type user)
|
||||||
|
|||||||
56
server/AyaNova/PickList/CustomerPickList.cs
Normal file
56
server/AyaNova/PickList/CustomerPickList.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using AyaNova.Biz;
|
||||||
|
namespace AyaNova.PickList
|
||||||
|
{
|
||||||
|
internal class CustomerPickList : AyaPickList
|
||||||
|
{
|
||||||
|
public CustomerPickList()
|
||||||
|
{
|
||||||
|
|
||||||
|
DefaultListObjectType = AyaType.Customer;
|
||||||
|
SQLFrom = "from acustomer";
|
||||||
|
AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select;
|
||||||
|
dynamic dTemplate = new JArray();
|
||||||
|
|
||||||
|
dynamic cm = new JObject();
|
||||||
|
cm.fld = "customername";
|
||||||
|
dTemplate.Add(cm);
|
||||||
|
|
||||||
|
cm = new JObject();
|
||||||
|
cm.fld = "customertags";
|
||||||
|
dTemplate.Add(cm);
|
||||||
|
|
||||||
|
base.DefaultTemplate = dTemplate.ToString(Newtonsoft.Json.Formatting.None);
|
||||||
|
|
||||||
|
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||||
|
ColumnDefinitions = new List<AyaPickListFieldDefinition>();
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Active",
|
||||||
|
FieldKey = "customeractive",
|
||||||
|
ColumnDataType = UiFieldDataType.Bool,
|
||||||
|
SqlValueColumnName = "acustomer.active",
|
||||||
|
IsActiveColumn = true
|
||||||
|
});
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Name",
|
||||||
|
FieldKey = "customername",
|
||||||
|
ColumnDataType = UiFieldDataType.Text,
|
||||||
|
SqlIdColumnName = "acustomer.id",
|
||||||
|
SqlValueColumnName = "acustomer.name",
|
||||||
|
IsRowId = true
|
||||||
|
});
|
||||||
|
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Tags",
|
||||||
|
FieldKey = "customertags",
|
||||||
|
ColumnDataType = UiFieldDataType.Tags,
|
||||||
|
SqlValueColumnName = "acustomer.tags"
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}//eoc
|
||||||
|
}//eons
|
||||||
@@ -16,6 +16,8 @@ namespace AyaNova.PickList
|
|||||||
//CoreBizObject add here
|
//CoreBizObject add here
|
||||||
case AyaType.Contract:
|
case AyaType.Contract:
|
||||||
return new ContractPickList() as IAyaPickList;
|
return new ContractPickList() as IAyaPickList;
|
||||||
|
case AyaType.Customer:
|
||||||
|
return new CustomerPickList() as IAyaPickList;
|
||||||
case AyaType.HeadOffice:
|
case AyaType.HeadOffice:
|
||||||
return new HeadOfficePickList() as IAyaPickList;
|
return new HeadOfficePickList() as IAyaPickList;
|
||||||
case AyaType.Widget:
|
case AyaType.Widget:
|
||||||
|
|||||||
Reference in New Issue
Block a user