public dynamic GetDelivery() { int deliveryId = Fun.Query("deliveryId", 0); CustomerBLL bll = new CustomerBLL(); P_Delivery d = bll.GetDelivery(deliveryId); Delivery delivery = new Delivery(); delivery.time = d.delivery_time.ToString("yyyy-MM-dd"); delivery.type = d.delivery_type; delivery.name = d.target_name; delivery.phone = d.target_phone; delivery.addr = d.target_addr; delivery.memo = d.delivery_memo; List <P_Cubilose> list = null; if (!string.IsNullOrEmpty(d.cubilose_ids)) { list = new CubiloseBLL().GetCubiloseList(); string[] ids = d.cubilose_ids.Split('|'); string[] nums = d.cubilose_nums.Split('|'); string[] gps = d.cubilose_GPs.Split('|'); for (int i = 0; i < ids.Length; i++) { delivery.goodsInfo += list.Where(x => x.cubilose_id == int.Parse(ids[i])).FirstOrDefault().cubilose_name.Trim() + "(" + nums[i] + ") EXP:" + gps[i].Replace("-", "") + ","; } delivery.goodsInfo = delivery.goodsInfo.Substring(0, delivery.goodsInfo.Length - 1); } return(delivery); }
public dynamic GetProduct() { int id = Fun.Query("id", 0); ProductBLL bll = new ProductBLL(); P_ProductInfo p = bll.GetProduct(id); List <P_Cubilose> list = null; ProductInfo product = new ProductInfo(); product.id = p.product_id; if (!string.IsNullOrEmpty(p.product_component)) { list = new CubiloseBLL().GetCubiloseList(); string[] arr = p.product_component.Split(','); string[] arr2 = p.component_num.Split('|'); for (int i = 0; i < arr.Length; i++) { product.component += "<span data-id = '" + arr[i] + "'>" + list.Where(x => x.cubilose_id == int.Parse(arr[i])).FirstOrDefault().cubilose_name.Trim() + "(" + arr2[i] + ")</span>,"; } product.component = product.component.Substring(0, product.component.Length - 1); } product.componentId = p.product_component; product.num = p.component_num; product.name = p.product_name.Trim(); product.img = p.product_img; product.info = p.product_info; product.type = p.product_type; product.mode = p.product_mode.Trim(); product.price = p.product_price; switch (p.product_type) { case 1: product.typeDescript = "月卡"; break; case 2: product.typeDescript = "礼盒"; break; case 3: product.typeDescript = "干货"; break; } return(product); }