public ActionResult SaveOrders(string SourceAccountId, string MemberCardNo, string orderid, string peoCount, string seat, string name, string phone, string sex, string remark) { OrderModel odm = new OrderModel(); Order order = new Order(); order.Id = new Guid(orderid); // DateTime date1 = Convert.ToDateTime(date); // DateTime time1 = Convert.ToDateTime(time); // date1= date1.AddHours(time1.Hour); // date1= date1.AddMinutes(time1.Minute); //date1= date1.AddSeconds(time1.Second); // order.DiningDate = Convert.ToDateTime(date1); order.PersonCount = string.IsNullOrEmpty(peoCount) ? 0 : Convert.ToInt32(peoCount); //order.TableCount = Convert.ToInt32(seat); order.TableCount = 1; order.ContactName = name; order.ContactPhone = phone; order.Sex = Convert.ToBoolean(sex); order.Remark = remark; order.Status = OrderStatus.New; order.CreateDate = DateTime.Now; int i = odm.SaveOrders("Update", order); string RestaurantId = Session["begindm"] != null ? Session["begindm"].ToString() : ""; string CompanyId = Session["CompanyId"] != null ? Session["CompanyId"].ToString() : ""; // return RedirectToAction("MyMenu", "MyMenu", new { MemberCardNo = MemberCardNo, OrderId = orderid ,SourceAccountId=SourceAccountId}); return RedirectToAction("MyOrderDetail", "MyMenu", new { MemberCardNo = MemberCardNo, OrderId = orderid, SourceAccountId = SourceAccountId, CompanyId = CompanyId }); // <a href="/pay/MyOrderDetail?MemberCardNo=@(ViewBag.MemberCardNo)&OrderId=@(item.OrderId)&SourceAccountId= @(ViewBag.SourceAccountId)&type='detail'&CompanyId=@( ViewBag.CompanyId)" style="color:#ccc"> }
// // GET: /ProductType/ public ActionResult Index(string SourceAccountId, string RestaurantId, string Status = null, string Date = null, string Time = null, string Type = null, string IsOrder = null, string MemberCardNo = null, string Orderid = null) { Session["SourceAccountId"] = SourceAccountId; ProductTypeModel ptm = new ProductTypeModel(); if (Date != null & Time != null) { if (Time.Equals("0")) { DateTime data = Convert.ToDateTime(Date); data = data.AddHours(9); ViewBag.BookTime = data; } else if (Time.Equals("1")) { DateTime data = Convert.ToDateTime(Date); data = data.AddHours(16); ViewBag.BookTime = data; } } if (!string.IsNullOrEmpty(IsOrder) && IsOrder == "1" && !string.IsNullOrEmpty(Orderid)) { OrderDetailsModel odm = new OrderDetailsModel(); OrderModel om = new OrderModel(); int i; i = odm.EmptyOrderDetails(MemberCardNo, Orderid); i = om.EmptyOrderStatus(Orderid); i = om.EmptyOrder(Orderid); } List<ProductType> pt = null; if (!string.IsNullOrEmpty(RestaurantId)) { if (RestaurantId.ToUpper() == "0E71D411-EFE0-4964-8E3D-2901E0823815") { List<ProductType> onept = ptm.getOneProductType(RestaurantId); ViewBag.FirstMenus = onept; if (onept != null && onept.Count() > 0) pt = ptm.getProductTypebyId(RestaurantId, onept.First().TypeId.ToString()); } else { pt = ptm.getProductType(RestaurantId); } } Session["begindm"] = RestaurantId; string RestaurantId1 = Session["begindm"] != null ? Session["begindm"].ToString() : ""; ViewBag.SourceAccountId = SourceAccountId; ViewBag.Status = Status; ViewBag.FastFood = Type; ViewBag.RestaurantId = RestaurantId; ViewBag.MemberCardNo = MemberCardNo; ViewBag.OrderId = Orderid; return View(pt ?? new List<ProductType>()); }
// // GET: /Product/ public ActionResult getProductByProductTypeId(string RestaurantId, string ProductTypeId, string SourceAccountId, string Status, string Type = null) { List<ProductNew> p = null; //object obj = System.Web.HttpRuntime.Cache.Get("ProductType" + ProductTypeId); //if (obj != null) //{ // p = obj as List<ProductNew>; //} //if (p == null) //{ ProductModel pm = new ProductModel(); p = pm.getProductByProductTypeId(RestaurantId, ProductTypeId); // System.Web.HttpRuntime.Cache.Add("ProductType" + ProductTypeId, p, null, DateTime.Now.AddHours(2), // TimeSpan.Zero, CacheItemPriority.Normal, null); //} CrmMemberModel cdb = new CrmMemberModel(); if (SourceAccountId != null && SourceAccountId != "") { List<CrmMember> crm = cdb.getCrmMemberListInfoData(SourceAccountId); ViewBag.MemberCardNo = crm.First().Uid; string MemberCardNo = crm.First().Uid; OrderModel odm = new OrderModel(); Order order = null; Order FastFoodOrder = null; //Type == "FastFood"表明此店为快餐店。 if (!string.IsNullOrEmpty(Type) && Type == "FastFood") { FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); } else { order = odm.SelectUnFinishedOrder(crm.First().Uid); } string OrderId = ""; if (order != null || FastFoodOrder != null) { OrderId = order != null ? order.Id.ToString() : FastFoodOrder.Id.ToString(); ViewBag.OrderId = OrderId; /* 显示用户已点菜数量*/ MyMenuModel myMenu = new MyMenuModel(); List<MyMenu> mymenu = myMenu.getMyMenuListData(MemberCardNo, OrderId, Type); ViewBag.MyMenuListData = mymenu; } } ViewBag.Status = Status; return View(p); }
// // GET: /Book/ public ActionResult Book(string MemberCardNo, string OrderId, string SourceAccountId) { Order info = new Order(); OrderModel odm = new OrderModel(); //List<Order> order = odm.selOrderId(MemberCardNo); Guid orderId= Guid.Empty; if (Guid.TryParse(OrderId, out orderId)) { ViewBag.orderInfo = odm.selOrderByOrderId(orderId); } ViewBag.orderId = OrderId; ViewBag.MemberCardNo = MemberCardNo; ViewBag.SourceAccountId = SourceAccountId; return View(); }
public ActionResult stage2(string RestaurantId, string ProductTypeId, string TypeName, string SourceAccountId, string Status, string Type = null, string imgid = null, string peopleCount=null) { List<ProductNew> p = null; object obj = System.Web.HttpRuntime.Cache.Get("ProductType" + ProductTypeId); if (obj != null) { p = obj as List<ProductNew>; } if (p == null) { ProductModel pm = new ProductModel(); p = pm.getProductByProductTypeId(RestaurantId, ProductTypeId); System.Web.HttpRuntime.Cache.Add("ProductType" + ProductTypeId, p, null, DateTime.Now.AddHours(2), TimeSpan.Zero, CacheItemPriority.Normal, null); } CrmMemberModel cdb = new CrmMemberModel(); List<CrmMember> crm = cdb.getCrmMemberListInfoData(SourceAccountId); ViewBag.MemberCardNo = crm.First().Uid; ViewBag.TypeName = TypeName; ViewBag.Type = Type; ViewBag.imgid = imgid; ViewBag.peopleCount = peopleCount; ViewBag.SourceAccountId = SourceAccountId; ViewBag.RestaurantId = RestaurantId; /* 显示用户已点菜数量*/ OrderModel odm = new OrderModel(); Order FastFoodOrder = null; ViewBag.OrderId = null; FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); if ( FastFoodOrder != null) { if (Type == "Auto") { Type = "FastFood"; } string OrderId =FastFoodOrder.Id.ToString(); ViewBag.OrderId = FastFoodOrder.Id; /* 显示用户已点菜数量*/ MyMenuModel myMenu = new MyMenuModel(); List<MyMenu> myAutoMenu = myMenu.getMyMenuListData(crm.First().Uid, OrderId, Type); ViewBag.MyAutoMenuListData = myAutoMenu; } return View(p); }
// // GET: /AutoMenuIndex/ public ActionResult AutoMenuIndex(string id, string name, string Type, string CompanyId, string RstType, string IsOrder = null, string IsNewOrder = null, string orderId = null, string MemberCardNo=null) { // Session["CompanyId"] = id; ViewBag.RestaurantId = id; ViewBag.SourceAccountId = name; ViewBag.Type = Type; ViewBag.CompanyId = CompanyId; ViewBag.RstType = RstType; ViewBag.IsOrder = IsOrder; if (!string.IsNullOrEmpty(IsNewOrder) && IsNewOrder == "NewOrder") { OrderDetailsModel odm = new OrderDetailsModel(); OrderModel om = new OrderModel(); int i; i = odm.EmptyOrderDetails(MemberCardNo, orderId); i = om.EmptyOrder(orderId); } return View(); }
public ActionResult Index2(string id, string name, string peopleCount, string Type, string CompanyId = null, string RstType = null, string IsOrder=null) { ViewBag.SourceAccountId = name; ViewBag.RestaurantId = id; ViewBag.Type = Type; ViewBag.peopleCount = peopleCount; ViewBag.CompanyId = CompanyId; // Session["CompanyId"] = id; ViewBag.RstType = RstType; CrmMemberModel cdb = new CrmMemberModel(); List<CrmMember> crm = cdb.getCrmMemberListInfoData(name); ViewBag.MemberCardNo = crm.First().Uid; AutoMenusModel am = new AutoMenusModel(); string RestaurantId = id; //判断此用户有没有有效的订单。如果有则显示有订单的菜。 Order FastFoodOrder = null; OrderModel odm = new OrderModel(); FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); if (FastFoodOrder != null) { //ViewBag.OrderId = FastFoodOrder.First().Id; // return View(FastFoodOrder); ViewBag.Orders = FastFoodOrder; } List<AutoMenuAndProduct> list = am.getAutoProduct(RestaurantId, peopleCount); Session["begindm"] = RestaurantId; return View(list); }
public ActionResult CancelOrder(string uid, string orderId, bool isEdit) { ActionResult result = Content("FAILED"); try { bool success = true; var orderManager = new OrderManager(); var order = orderManager.GetOrderSummary(Guid.Parse(orderId)); if (order != null) { OrderModel orderModel = new OrderModel(); using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { PrepayRecordModel prepayRecordModel = new PrepayRecordModel(); CrmMemberModel crmMemberModel = new CrmMemberModel(); if (isEdit) { if (order.Status == OrderStatus.New) { success = orderModel.UpdateOrderStatus(Guid.Parse(orderId), OrderStatus.Cancelled); var prepayRecord = prepayRecordModel.GetPrepayRecordByOrderId(orderId); if (prepayRecord != null) { //取消订单,支付失败 prepayRecord.AsureDate = DateTime.Now; prepayRecord.RState = "99"; success = success && prepayRecordModel.UpdatePrepayRecord(prepayRecord); } } else { success = false; } } else { if (OrderStatus.Paid == order.Status) { PrepayRecord prepayRecord = null; PrepayRecord newPrepayRecord = null; PrepayAccount prepayAccount = null; prepayAccount = crmMemberModel.GetPrepayAccount(uid); prepayRecord = prepayRecordModel.GetPrepayRecordByOrderId(orderId); //已退款 prepayRecord.RState = "02"; prepayRecord.AsureDate = DateTime.Now; newPrepayRecord = new PrepayRecord(); newPrepayRecord.AddMoney = -prepayRecord.AddMoney; newPrepayRecord.AsureDate = DateTime.Now; newPrepayRecord.BillPayId = Guid.NewGuid(); newPrepayRecord.DiscountlMoeny = 0; newPrepayRecord.PayByScore = 0; newPrepayRecord.PayModel = "02"; newPrepayRecord.PrepayDate = DateTime.Now; newPrepayRecord.PrepayMoney = -0; newPrepayRecord.PresentMoney = 0; newPrepayRecord.PromotionId = 0; newPrepayRecord.RecMoney = 0; newPrepayRecord.RecordId = -1; newPrepayRecord.RState = ""; newPrepayRecord.RstId = order.RestaurantId; newPrepayRecord.ScoreVip = 0; newPrepayRecord.SId = ""; newPrepayRecord.Uid = uid; newPrepayRecord.UserId = "System"; prepayAccount.AccountMoney += newPrepayRecord.AddMoney.Value; newPrepayRecord.PrepayDate = DateTime.Now; newPrepayRecord.AsureDate = DateTime.Now; success = orderModel.UpdateOrderStatus(Guid.Parse(orderId), OrderStatus.Refunded); success = success && prepayRecordModel.AddPrepayRecord(newPrepayRecord); success = success && crmMemberModel.UpdatePrepayAccount(prepayAccount); success = success && prepayRecordModel.UpdatePrepayRecord(prepayRecord); } else { success = false; } } if (success) { result = Content("SUCCESS"); scope.Complete(); } else { result = Content("FAILED"); scope.Dispose(); } } } else { result = Content("FAILED"); } } catch (Exception ex) { Logger.Log(ex); } return result; }
// // GET: /Order/ //public ActionResult Index(string SourceAccountId, string RestaurantId, string Status = null, string Date = null, string Time = null, string Type = null) //{ // if (Date != null & Time != null) // { // if (Time.Equals("0")) // { // DateTime data = Convert.ToDateTime(Date); // data = data.AddHours(9); // ViewBag.BookTime = data; // } // else if (Time.Equals("1")) // { // DateTime data = Convert.ToDateTime(Date); // data = data.AddHours(16); // ViewBag.BookTime = data; // } // } // OrderModel odb = new OrderModel(); // ViewBag.ProductListData = odb.getProductListInfoData(RestaurantId); // Session["begindm"] = RestaurantId; // ViewBag.SourceAccountId = SourceAccountId; // ViewBag.RestaurantId = RestaurantId; // ViewBag.Status = Status; // ViewBag.RstType = Type; // CrmMemberModel cdb = new CrmMemberModel(); // if (SourceAccountId != null && SourceAccountId != "") // { // List<CrmMember> crm = cdb.getCrmMemberListInfoData(SourceAccountId); // ViewBag.MemberCardNo = crm.First().Uid; // string MemberCardNo = crm.First().Uid; // OrderModel odm = new OrderModel(); // List<Order> order = null; // List<FastFoodOrder> FastFoodOrder = null; // if (!string.IsNullOrEmpty(Type) && Type == "FastFood") // { // FastFoodOrder = odm.selOrderByMemberId(crm.First().Uid); // } // else { order = odm.SelUnFinValidOrder(crm.First().Uid); } // string OrderId = ""; // if ((order != null && order.Count > 0) || (FastFoodOrder != null && FastFoodOrder.Count > 0)) // { // ViewBag.OrderId = order.First().Id; // OrderId = order.First().Id.ToString(); // /* 显示用户已点菜数量*/ // MyMenuModel myMenu = new MyMenuModel(); // List<MyMenu> mymenu = myMenu.getMyMenuListData(MemberCardNo, OrderId); // ViewBag.MyMenuListData = mymenu; // } // } // return View(); //} public ActionResult Begin(string id, string name, string type = null, string CityId = null, string CityName = null) { try { Session["SourceAccountId"] = name; Session["CompanyId"] = id; ViewBag.CompanyId = id; OrderModel odm = new OrderModel(); CrmMemberModel cdb = new CrmMemberModel(); List<CrmMember> crm = cdb.getCrmMemberListInfoData(name); ViewBag.MemberCardNo = crm.First().Uid; Session["CrmMember"] = crm.First(); // Session["MemberCardNo"] = crm.First().Uid; if (!string.IsNullOrEmpty(CityName)) { ViewBag.cityName = CityName; } //根据type来判断是否是快捷预定(Quick)或智能点餐(Auto) if (string.IsNullOrEmpty(type) && type != "Quick" && type != "Auto") { //判断该用户在该店面预定的时间是否小于当前时间,如果是,弹出“我的订单”选择“修改” //或者“新预定”框体。修改默认显示当前订单内容 如果订单是未完成状态则直接跳转到点餐页面 // ViewBag.CompanyId = id; Order info = new Order(); Order unFinishedOrder = odm.SelectUnFinishedOrder(crm.First().Uid); int status = 0; if (unFinishedOrder != null) { DateTime bookTime = unFinishedOrder.DiningDate; if (DateTime.Now < bookTime.AddHours(5)) { ViewBag.RecOrder = 1; status = 1; //return RedirectToAction("MY", "Order", new { id = id, name = name }); } } if (status != 1) { Order paidOrder = odm.SelectPaidOrder(crm.First().Uid); ViewBag.isCurTime = 0; if (paidOrder != null) { DateTime bookTime = paidOrder.DiningDate; if (DateTime.Now < bookTime) { ViewBag.isCurTime = 1; } } } } Order FastFoodOrder = null; //如果为自动点餐和快捷点餐。如果还有未过期的订单则跳转到订单详情 ViewBag.AutoOrderCount=1 有订单 ViewBag.AutoOrderCount = 0; if (!string.IsNullOrEmpty(type) && (type == "Auto" || type == "Quick")) { FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); if (FastFoodOrder != null) { ViewBag.AutoOrderCount = 1; ViewBag.OrderId = FastFoodOrder.Id; } } string dm = Session["begindm"] != null ? Session["begindm"].ToString() : ""; // if (string.IsNullOrEmpty(dm)) // { // List<RestaurantAbstract> p = null; // object obj = System.Web.HttpRuntime.Cache.Get("id" + id); // if (obj != null) // { // p = obj as List<RestaurantAbstract>; // } // if (p == null) // { RestaurantModel rdb = new RestaurantModel(); //CityId = string.IsNullOrEmpty(CityId) ? "510100" : CityId; List<RestaurantAbstract> p = rdb.getRestaurentState(id); // System.Web.HttpRuntime.Cache.Add("id" + id, p, null, DateTime.Now.AddHours(2), // TimeSpan.Zero, CacheItemPriority.Normal, null); // } ViewBag.SourceAccountId = name; ViewBag.type = type; return View(p); // } // return RedirectToAction("Index","Order", new { SourceAccountId = id, RestaurantId = dm }); } catch (Exception ex) { Logger.Log(ex); return Content("页面加载错误"); } }
// public ActionResult Quick(string id, string name) { // Guid OrderId = this.SaveOrders("Insert", name); // CrmMemberModel cdb = new CrmMemberModel(); // List<CrmMember> crm = cdb.getCrmMemberListInfoData(name); // if (OrderId != new Guid("00000000-0000-0000-0000-000000000000")){ //// /book/book?MemberCardNo=@(ViewBag.MemberCardNo)&OrderId=@(ViewBag.OrderId)&SourceAccountId=@(ViewBag.SourceAccountId) // return RedirectToAction("book","book", new { MemberCardNo = crm.First().Uid, OrderId = OrderId,SourceAccountId=name }); // } // return View(); // } public Guid SaveOrders(string type, string SourceAccountId, string bookTime = null, string isQuick = null, string peopleCont = null, string Remark = null, string OrderId = null) { int i; try { Session["SourceAccountId"] = SourceAccountId; OrderModel odm = new OrderModel(); CrmMemberModel cdb = new CrmMemberModel(); List<CrmMember> crm = cdb.getCrmMemberListInfoData(SourceAccountId); Order order = null; Order FastFoodOrder = null; Order info = new Order(); //isQuick=="Quick" 表明此订单为快捷预定 isQuick==null表明为预定订单 isQuick=Auto 表明是智能点餐 if (string.IsNullOrEmpty(isQuick)) { order = odm.SelectUnFinishedOrder(crm.First().Uid); } else { FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); } if (order != null) { type = "Update"; // i = odm.SaveOrders(type, info); return order.Id; } else if (FastFoodOrder != null) { type = "UpdateFastFood"; info.CreateDate = DateTime.Now; if (string.IsNullOrEmpty(OrderId)) { info.Id = Guid.NewGuid(); } else { info.Id = new Guid(OrderId); } info.Remark = Remark; i = odm.SaveOrders(type, info); return FastFoodOrder.Id; } //if ((order!=null&&order.Count > 0)||(FastFoodOrder != null && FastFoodOrder.Count > 0)) //{ // type = "Update"; // // i = odm.SaveOrders(type, info); // return order.First().Id; //} else { info.Id = Guid.NewGuid(); //info.Id = crm.First().Uid; info.ContactName = string.IsNullOrEmpty(crm.First().MemberName) ? "" : crm.First().MemberName; info.ContactPhone = crm.First().Tel; info.MemberCardNo = crm.First().Uid; info.OperatorId = Guid.NewGuid();//new Guid("6E4DE867-4AF0-2DEA-FC5C-036EB8637CAB") info.OperatorName = "xxx"; info.CreateDate = DateTime.Now; if (!string.IsNullOrEmpty(isQuick) && isQuick == "FastFood") { info.DiningDate = string.IsNullOrEmpty(bookTime) ? DateTime.Now : Convert.ToDateTime(bookTime); //if (!string.IsNullOrEmpty(bookTime)) //{ // info.DiningDate = Convert.ToDateTime(bookTime); //} //else { // info.DiningDate = Convert.ToDateTime("1997-10-1"); //} } else if (!string.IsNullOrEmpty(isQuick) && isQuick == "Auto") { info.PersonCount = Convert.ToInt32(peopleCont); info.DiningDate = DateTime.Now; //info.DiningDate = string.IsNullOrEmpty(bookTime) ? DateTime.Now : Convert.ToDateTime(bookTime); } else { info.DiningDate = string.IsNullOrEmpty(bookTime) ? DateTime.Now : Convert.ToDateTime(bookTime); } info.Status = OrderStatus.New; info.ReserveType = "01"; string RestaurantId = Session["begindm"] != null ? Session["begindm"].ToString() : ""; if (!string.IsNullOrEmpty(RestaurantId)) { info.RstId = new Guid(RestaurantId); } else { info.RstId = Guid.NewGuid(); } i = odm.SaveOrders(type, info); //ViewBag.MemberCardNo = info.MemberCardNo; //ViewBag.OrderId = info.Id; } if (i == 1) { return info.Id; } } catch (Exception ex) { Logger.Log(ex); return new Guid("00000000-0000-0000-0000-000000000000"); } return new Guid("00000000-0000-0000-0000-000000000000"); }
public ActionResult My(string id, string name) { ViewBag.CompanyId = id; ViewBag.SourceAccountId = name; OrderModel odm = new OrderModel(); CrmMemberModel cdb = new CrmMemberModel(); List<CrmMember> crm = cdb.getCrmMemberListInfoData(name); //Order info = new Order(); //List<Order> order = odm.selOrderId(crm.First().Uid); //List<FastFoodOrder> Quickorder = odm.selOrderByMemberId(crm.First().Uid); //string OrderId = "", QuickorderId=""; //if (order.Count > 0 || Quickorder.Count>0) //{ // ViewBag.OrderId = order.First().Id; // OrderId = order.First().Id.ToString(); // ViewBag.QuickorderId = order.First().Id; // QuickorderId = order.First().Id.ToString(); // if (OrderId == null || OrderId == "" || QuickorderId == null || QuickorderId == "") // { // ViewBag.MyOrderListData = null; // return View("myOrder"); // } string MemberCardNo = crm.First().Uid; ViewBag.MemberCardNo = crm.First().Uid; MyMenuModel odb = new MyMenuModel(); List<MyOrder> myOrder = odb.getMyOrderListData(MemberCardNo); List<MyOrder> myQuickOrder = odb.getMyOrderListData(MemberCardNo, "FastFood"); if (myQuickOrder != null && myQuickOrder.Count > 0) { ViewBag.MyQuickOrderListData = myQuickOrder; } if (myOrder != null && myOrder.Count > 0) { ViewBag.MyOrderListData = myOrder; } //decimal sum = 0; //if (myOrder.Count > 0) //{ // for (int i = 0; i < myOrder.Count; i++) // { // sum += myOrder[i].UnitPrice*myOrder[i].; // } //} //ViewBag.total = sum; // } return View("myOrder"); }
//public byte[] getByte() //{ // string path = Server.MapPath("~/Content/images/xchlogo.jpg"); // FileStream fs = new FileStream(path, FileMode.Open); // int streamLength = (int)fs.Length; // byte[] image = new byte[streamLength]; // fs.Read(image, 0, streamLength); // fs.Close(); // return image; //} public FileContentResult GetImages(string id) { OrderModel odb = new OrderModel(); if (!string.IsNullOrEmpty(id)) { List<Product> list = odb.getThumbImageProductListInfoData(id); if (list != null && list.Count > 0) { Product info = list.First(); if (info != null) { if (info.ThumbImage != null) { return File(info.ThumbImage, "jpg", "image_" + id + ".jpg"); } } } } List<ReceiveOrder1> list1 = odb.getDefauleImage(id); if (list1 != null && list1.Count > 0) { ReceiveOrder1 info = list1.First(); if (info != null) { if (info.DefaultImg != null) { return File(info.DefaultImg, "jpg", "image_" + id + ".jpg"); } } } return File(new Byte[] { }, "jpg", "image_" + id + ".jpg"); }