public ReturnInfo Create(OrderInfo inOrderInfo) { ReturnInfo localReturnInfo = new ReturnInfo(); localReturnInfo.RETURNFLAG = false; localReturnInfo.RETURNINFO = CommonDefineData.UNKNOWN_STATUS; var ctx = WebOperationContext.Current; ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK; CTrace.WriteLine(CTrace.TraceLevel.Debug, "OrderInfo/orderid/POST."); try { DataList<OrderInfo> localDLOrderInfo = new DataList<OrderInfo>(); if (inOrderInfo != null) { localDLOrderInfo.AddNewData(inOrderInfo); //调用Domain进行add OrderInfoHelper localOrderInfoHelper = new OrderInfoHelper(); bool ret = localOrderInfoHelper.Update(localDLOrderInfo); if (ret) { localReturnInfo.RETURNFLAG = true; localReturnInfo.RETURNINFO = CommonDefineData.SUCCESS_STATUS; } } else { return localReturnInfo; } if (localReturnInfo.RETURNFLAG) { ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Created; } else { ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK; } } catch (Exception ex) { LogSystem.WebLogDebug(ex.Message); ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.ExpectationFailed; ctx.OutgoingResponse.StatusDescription = ex.Message; localReturnInfo.RETURNFLAG = false; localReturnInfo.RETURNINFO = CommonDefineData.EXCEPTION_STATUS; } return localReturnInfo; }
//所以要返回list.同时,使用查询字符串,支持复杂的查询。 public List<OrderInfo> GetCollection(string crusr,string status) { //CTrace.WriteLine(CTrace.TraceLevel.Debug, "OrderInfo/GET."); //return new List<OrderInfo>() { new OrderInfo() { ORDERID = "007", CONTACTID = "007" } }; List<OrderInfo> localOrderInfo = new List<OrderInfo>(); OrderInfoHelper localOrderInfoHelper = new OrderInfoHelper(); localOrderInfo = localOrderInfoHelper.outOrderInfoList(crusr,status); return localOrderInfo; }
public OrderInfo Get(string orderid) { OrderInfo localorderInfo = new OrderInfo(); if (!string.IsNullOrEmpty(orderid)) { OrderInfoHelper localOrderInfoHelper = new OrderInfoHelper(); localorderInfo= localOrderInfoHelper.outOrderInfo(orderid); } else { // do nothing } return localorderInfo; }