public async Task <RO <string> > CustomerDelete([FromBody] CurrentClientData currentClient) { var ro = new RO <string>(); if (ModelState.IsValid) { #if SESAM VendorInterface vendor = new VendorInterface(); ro = await vendor.CustomerDelete(currentClient); #else var returnCode = await VendorDL.CustomerStatusChanged(true, true, currentClient.CustomerKey); var ro = new RO <string> { ReturnCode = returnCode }; #endif } else { var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage)); ro.ReturnCode = 100; ro.Message = $"Bad request - CustomerDelete - Incorrect parameters: {message}"; } return(ro); }
public static async Task <RO <CardList> > CardList(CurrentClientData currentClient) { var ro = new RO <CardList> { ReturnCode = 0, Message = string.Empty }; _db.GetCollection <DBCard>("cards"); var clientList = _db.GetCollection <DBClient>("clients").Include(x => x.Cards); IEnumerable <DBClient> clients = null; DBClient client = null; clients = currentClient.InstallationID != "NA" ? clientList.Find(a => a.InstallationID.Equals(currentClient.InstallationID) && a.Id.Equals(int.Parse(currentClient.CustomerKey))) : clientList.Find(a => a.Id.Equals(int.Parse(currentClient.CustomerKey))); if (clients != null) { client = clients.FirstOrDefault(); } if (client != null) { var cardsList = client.Cards.Where(c => c.Deleted).Select(c => new BossIDWS.Vendor.REST.ReturnObjects.Card { rfid = c.RFID, status = "D" }).Concat(client.Cards.Where(c => c.Blocked && c.Deleted == false).Select(c => new BossIDWS.Vendor.REST.ReturnObjects.Card { rfid = c.RFID, status = "B" })).Concat(client.Cards.Where(c => c.Blocked == false && c.Deleted == false).Select(c => new BossIDWS.Vendor.REST.ReturnObjects.Card { rfid = c.RFID, status = "A" })).ToList(); //var cards = new CardList { Cards = cardsList }; var cards = new CardList(); ro.ReturnValue = cards; } return(await Task.FromResult(ro)); }
public async Task <RO <CardList> > CardList([FromBody] CurrentClientData client) { var ro = new RO <CardList>(); if (ModelState.IsValid) { // ro = await VendorDL.CardList(client); VendorInterface vendor = new VendorInterface(); ro = await vendor.CardList(client); } else { var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage)); ro.ReturnCode = 100; ro.Message = $"Bad request - CardList - Incorrect parameters: {message}"; } return(ro); }
//-------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// /// </summary> /// <param name="client"></param> /// <returns></returns> //-------------------------------------------------------------------------------------------------------------------------------- public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList> > CustomerAccessPoints(CurrentClientData client) { BossIDWS.Vendor.REST.ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList> ror = new ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList>(); try { VendorEngine engine = new VendorEngine(); List <VendorCustomerPoint> points = engine.CustomerAccessPoints(client.InstallationID, client.CustomerKey); ror.ReturnCode = 0; ror.ReturnValue = TransformToCustomerPointList(client.InstallationID, points); ror.Message = string.Empty; } catch (VendorException se) { VendorRO ro = se.ReturObjekt; ror.ReturnCode = ro.ReturnCode; ror.Message = ro.Message; } catch (Exception e) { ror.ReturnCode = 1024; ror.Message = "CustomerAccessPoints failure - " + e.ToString(); } return(await Task.FromResult(ror)); }
/// <summary> /// Delete a customer /// </summary> /// <param name="client"></param> /// <returns></returns> public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <string> > CustomerDelete(CurrentClientData client) { BossIDWS.Vendor.REST.ReturnObjects.RO <string> roc = new ReturnObjects.RO <string>(); try { VendorEngine engine = new VendorEngine(); VendorRO vendorro = engine.CustomerDelete(client.InstallationID, client.CustomerKey); roc.ReturnCode = vendorro.ReturnCode; roc.ReturnValue = vendorro.ReturnValue; roc.Message = vendorro.Message; } catch (Exception e) { roc.ReturnCode = 1024; roc.Message = "CustomerDelete failure - " + e.ToString(); } return(await Task.FromResult(roc)); }
public async Task <RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList> > CustomerAccessPoints([FromBody] CurrentClientData currentClient) { var ro = new RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList>(); if (ModelState.IsValid) { #if SESAM VendorInterface vendor = new VendorInterface(); ro = await vendor.CustomerAccessPoints(currentClient); #else var detailsList = await VendorDL.CustomerAccessPoints(currentClient.CustomerKey); var ro = new RO <AccessPointDetailList> { ReturnCode = 0, ReturnValue = detailsList }; #endif } else { var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage)); ro.ReturnCode = 100; ro.Message = $"Bad request - CustomerAccessPoints - Incorrect parameters: {message}"; } return(ro); }