/// <summary> /// 订单提交 /// </summary> /// <returns></returns> public string AddOrders() { string content = string.Empty; var respData = new OrdersInfoRespData(); try { //接收参数 string reqContent = HttpContext.Current.Request["ReqContent"]; var reqObj = reqContent.DeserializeJSONTo <OrdersInfoReqData>(); reqObj = reqObj == null ? new OrdersInfoReqData() : reqObj; //获取客户ID if (!string.IsNullOrEmpty(reqObj.common.customerId)) { customerId = reqObj.common.customerId; } //初始化返回对象 respData.content = new OrdersInfoRespContentData(); respData.content.orderList = new List <OrdersInfoRespContentDataItem>(); //用户登录信息 var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1"); TInoutBLL inoutBLL = new TInoutBLL(loggingSessionInfo); TInoutEntity inoutEntity = new TInoutEntity(); //添加订单 inoutEntity.OrderID = Guid.NewGuid().ToString(); inoutEntity.OrderTypeID = "1F0A100C42484454BAEA211D4C14B80F"; inoutEntity.OrderReasonID = "2F6891A2194A4BBAB6F17B4C99A6C6F5"; inoutEntity.OrderNo = GetOrdersNo(); inoutEntity.VipNo = reqObj.common.userId; inoutEntity.OrderDate = DateTime.Now.ToString("yyyy-MM-dd"); inoutEntity.RedFlag = "1"; inoutEntity.Status = "100"; inoutEntity.StatusDesc = "未审核"; inoutEntity.PurchaseUnitID = ConfigurationManager.AppSettings["HS_PurchaseUnitID"].ToString(); inoutEntity.CreateTime = DateTime.Now.ToString(); if (reqObj.special.photo.Length > 0) { var length = reqObj.special.photo.Length; inoutEntity.Field1 = length >= 1 ? reqObj.special.photo[0].ToString() : ""; inoutEntity.Field2 = length >= 2 ? reqObj.special.photo[1].ToString() : ""; inoutEntity.Field3 = length >= 3 ? reqObj.special.photo[2].ToString() : ""; inoutEntity.Field4 = length >= 4 ? reqObj.special.photo[3].ToString() : ""; inoutEntity.Field5 = length >= 5 ? reqObj.special.photo[4].ToString() : ""; inoutEntity.Field6 = length >= 6 ? reqObj.special.photo[5].ToString() : ""; } inoutEntity.Field7 = "100"; //后台查询订单用 inoutEntity.Field10 = ""; //订单状态 inoutEntity.Field8 = reqObj.special.model; //产品型号 inoutEntity.Field9 = reqObj.special.serial; //产品序列号 inoutEntity.Field11 = reqObj.special.buyWay; //购买方式 关联Option inoutEntity.Field12 = reqObj.special.name; //客户姓名 inoutEntity.Field13 = reqObj.special.mobile; //电话 inoutEntity.Field14 = reqObj.special.email; //Email inoutEntity.Field15 = reqObj.special.getWay; //客户获取方式 关联Option inoutEntity.Field16 = reqObj.special.date; //订单日期 inoutEntity.Field17 = reqObj.special.price; //订单价格 inoutEntity.Field18 = reqObj.special.school; //学校 inoutEntity.Field19 = reqObj.special.specialt; //专业 inoutEntity.Field20 = reqObj.special.intent; //购买前意向 inoutEntity.CustomerID = reqObj.common.customerId; inoutBLL.Create(inoutEntity); respData.code = "200"; respData.description = "操作成功"; } catch (Exception ex) { respData.code = "103"; respData.description = "数据库操作错误"; respData.exception = ex.ToString(); } content = respData.ToJSON(); return(content); }
/// <summary> /// 华硕校园 获取订单列表 /// </summary> /// <returns></returns> public string GetOrderList() { string content = string.Empty; var respData = new OrdersInfoRespData(); try { //接收参数 string reqContent = HttpContext.Current.Request["ReqContent"]; var reqObj = reqContent.DeserializeJSONTo <OrdersInfoReqData>(); reqObj = reqObj == null ? new OrdersInfoReqData() : reqObj; //获取客户ID if (!string.IsNullOrEmpty(reqObj.common.customerId)) { customerId = reqObj.common.customerId; } //初始化返回对象 respData.content = new OrdersInfoRespContentData(); respData.content.orderList = new List <OrdersInfoRespContentDataItem>(); //用户登录信息 var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1"); OnlineShoppingItemBLL itemService = new OnlineShoppingItemBLL(loggingSessionInfo); int pageSize = 15, pageIndex = 1; if (!string.IsNullOrEmpty(reqObj.special.pageSize)) { pageSize = int.Parse(reqObj.special.pageSize); } if (!string.IsNullOrEmpty(reqObj.special.pageIndex)) { pageIndex = int.Parse(reqObj.special.pageIndex); } int rowCount = 0; var orderInfo = itemService.GetOrderList(reqObj.common.userId, pageSize, pageIndex, out rowCount); if (orderInfo != null && orderInfo.Count > 0) { List <OrdersInfoRespContentDataItem> list = new List <OrdersInfoRespContentDataItem>(); foreach (var item in orderInfo) { OrdersInfoRespContentDataItem info = new OrdersInfoRespContentDataItem(); info.OrdersID = item.OrdersID; info.OrdersNo = item.OrdersNo; info.VipName = item.VipName; info.Phone = item.Phone; info.Model = item.Model; info.OrderDate = item.OrderDate; info.BuyWay = item.BuyWay; info.GetWay = item.GetWay; info.Price = item.Price; info.OrdersStatusText = item.OrdersStatusText; list.Add(info); } respData.content.orderList = list; respData.content.rowCount = rowCount; pageSize = 15; if (!string.IsNullOrEmpty(reqObj.special.pageSize)) { int.TryParse(reqObj.special.pageSize, out pageSize); } respData.content.pageCount = (int)(Math.Ceiling((decimal)rowCount / pageSize)); } else { respData.code = "111"; respData.description = "没有获取到数据"; } } catch (Exception ex) { respData.code = "103"; respData.description = "数据库操作错误"; respData.exception = ex.ToString(); } content = respData.ToJSON(); return(content); }