using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Data.Entity;
using System.Diagnostics;
using MySql.Data.MySqlClient;
namespace ExternalCustomerSoapServer
public class ExternalSoapCustomerService : IExternalSoapCustomerService
CustomerInformation CreateCustomerInfo(CUST cust)
return new CustomerInformation
CardNumber = cust.CARD_NUMBER,
public CustomerInformation GetCustomerInformation(string CardNumber)
using (var db = new SELFSCANEntities())
List<CUST> list = db.CUST.Where(c => c.CARD_NUMBER.Equals(CardNumber)).ToList();
return CreateCustomerInfo(list[0]);
return new CustomerInformation();
public CustomerInformation[] GetCustomerInformationArray(SearchCriteria[] criteria, long offset, long count)
List<CustomerInformation> result = new List<CustomerInformation>();
using (var db = new XXXEntities())
StringBuilder whereString = new StringBuilder();
foreach (SearchCriteria crit in criteria)
whereString.Append(crit.CriteriaOperator + " " + "it." + crit.FieldName + " " + crit.FieldOperator + " " + crit.FieldValue + " ");
.Where(whereString.ToString())
.OrderBy("it.CARD_NUMBER")
).Skip((int)offset).Take((int)count);
foreach (CUST cust in query)
result.Add(CreateCustomerInfo(cust));