public override void Delete(Material entity) { var endpoint = WebService.GetServiceEndpoint <ItemCard_PortChannel>(); var client = new ItemCard_PortClient(endpoint.Binding, endpoint.Address); var item = client.Read(entity.Number); client.Delete(item.Key); }
public override void Update(Material entity) { var endpoint = WebService.GetServiceEndpoint <ItemCard_PortChannel>(); var client = new ItemCard_PortClient(endpoint.Binding, endpoint.Address); var item = client.Read(entity.Number); item = entity.ToErpObject(item); client.Update(ref item); }
public override void Create(Material entity) { var endpoint = WebService.GetServiceEndpoint <ItemCard_PortChannel>(); var client = new ItemCard_PortClient(endpoint.Binding, endpoint.Address); if (entity.Number.Equals("*")) { entity.Number = GetNextNumber(); } var item = entity.ToErpObject(new ItemCard()); client.Create(ref item); }
public static List <ItemCard> GetItemsByNumbers(string[] numbers) { var results = new List <ItemCard>(); var endpoint = WebService.GetServiceEndpoint <ItemCard_PortChannel>(); var client = new ItemCard_PortClient(endpoint.Binding, endpoint.Address); foreach (var number in numbers) { var item = client.Read(number); if (item != null) { results.Add(item); } } return(results); }
public override IEnumerable <Material> Query(IExpression <Material> expression) { var results = new List <Material>(); var endpoint = WebService.GetServiceEndpoint <ItemCard_PortChannel>(); var client = new ItemCard_PortClient(endpoint.Binding, endpoint.Address); var filterArray = new List <ItemCard_Filter>(); foreach (var w in expression.Where) { var ciPrefix = ""; if (new [] { "Number", "Description", "Category", "Shelf", "SearchDescription" }.Contains(w.PropertyName)) { ciPrefix = "@"; } var fieldEnum = w.PropertyName.ToItemCardFieldEnum(); if (fieldEnum == null) { continue; } var criteria = w.ToSearchCriteria(); if (criteria == null) { continue; } filterArray.Add(new ItemCard_Filter { Field = fieldEnum.Value, Criteria = ciPrefix + criteria }); } var list = client.ReadMultiple(filterArray.ToArray(), null, expression.TopCount); foreach (var item in list) { results.Add(item.ToPowerGateObject()); } return(results); }