// GET: Home
        public ActionResult AdminHome()
        {
            if ((bool?)Session["AdminLogin"] == null)
            {
                return(RedirectToAction("AdminHomeLogin"));
            }

            var serviceCus = new CustomerService();
            var serviceOd  = new OrderDetailsService();
            var serviceOr  = new OrderService();
            var servicePro = new ProductsService();

            ViewBag.CostomerNumber = serviceCus.GetAll().Count();
            ViewBag.OrderNumber    = serviceOr.GetAll().Count();
            var ProductNumber = serviceOd.GetAll();
            var Number        = 0;

            foreach (var item in ProductNumber)
            {
                Number += item.Quantity;
            }
            ViewBag.ProductNumber = Number;
            var     GetAllOrder = serviceOd.GetAll();
            decimal total       = 0;

            foreach (var item in GetAllOrder)
            {
                total += servicePro.FindByID(item.ProductID).UnitPrice *item.Quantity;
            }
            ViewBag.Total = Decimal.Round(total);

            return(View());
        }
Пример #2
0
        public ActionResult TestCertificates()
        {
            var orderDetails = OrderDetailsService.GetAll(x =>
                                                          x.Order.UserID == User.UserID && x.Course_TC == CourseTC.Srt && x.Order.PaymentType_TC != null)
                               .OrderByDescending(x => x.CreateDate).ToList();

            return(BaseViewWithModel(new TestCertificatesView(), new TestCertificatesVM(orderDetails)));
        }
Пример #3
0
 public List <OrderDetailsDto> Get()
 {
     return(_orderDetailsService.GetAll());
 }
Пример #4
0
        public async Task <BookingNoteInfoDto> GetAllOrderMess(string id)
        {
            var bookingNote = new BookingNoteInfoDto();

            using (var OrderService = new OrderService())
            {
                var order = await OrderService.GetAll().Where(p => p.BarCode == id).FirstOrDefaultAsync();

                if (order != null)
                {
                    bookingNote.CreateTime = order.CreatTime.ToLongDateString() + " " + order.CreatTime.ToShortTimeString();
                    bookingNote.OrderId    = order.BarCode;
                    switch (order.Status)
                    {
                    case "1": bookingNote.Stutas = "未处理"; break;

                    case "2": bookingNote.Stutas = "接货中"; break;

                    case "3": bookingNote.Stutas = "配货中"; break;

                    case "4": bookingNote.Stutas = "运输中"; break;

                    case "5": bookingNote.Stutas = "配送中"; break;

                    default:
                        bookingNote.Stutas = "已完成";
                        break;
                    }
                    using (var orderDetailsService = new OrderDetailsService())
                    {
                        var orderDetail = await orderDetailsService.GetAll().Where(p => p.OrderId == order.Id).Include(p => p.Sender).Include(p => p.Receiver).FirstOrDefaultAsync();

                        bookingNote.CargoName    = orderDetail.CargoName;
                        bookingNote.CargoUnit    = orderDetail.UitNum;
                        bookingNote.CargoVolumn  = (Convert.ToInt32(orderDetail.UitNum) * Convert.ToDouble(orderDetail.CargoVolume)).ToString();
                        bookingNote.CargoWeight  = (Convert.ToInt32(orderDetail.UitNum) * Convert.ToDouble(orderDetail.CargoWeight)).ToString();
                        bookingNote.PayType      = orderDetail.PayType ? "现付" : "到付";
                        bookingNote.Mark         = orderDetail.Mark;
                        bookingNote.GetGoodsTime = orderDetail.GetGoodsTime;
                        bookingNote.Freight      = orderDetail.Freight.ToString("f2");
                        bookingNote.ServiceFee   = orderDetail.ServiceCharge.ToString("f2");

                        bookingNote.SenderName   = orderDetail.Sender.Name;
                        bookingNote.SMobilePhone = orderDetail.Sender.MobliePhone;
                        bookingNote.SFirm        = orderDetail.Sender.FirmName;
                        bookingNote.STel         = orderDetail.Sender.TelPhone;
                        bookingNote.SAddress     = orderDetail.Sender.Provinces + orderDetail.Sender.DetailAddress;

                        bookingNote.ReceiverName = orderDetail.Receiver.Name;
                        bookingNote.RMobilePhone = orderDetail.Receiver.MobliePhone;
                        bookingNote.RFirm        = orderDetail.Receiver.FirmName;
                        bookingNote.RTel         = orderDetail.Receiver.TelPhone;
                        bookingNote.RAddress     = orderDetail.Receiver.Provinces + orderDetail.Receiver.DetailAddress;

                        if (!orderDetail.IsInsured)
                        {
                            bookingNote.InsureFee = "0";
                            bookingNote.Value     = "0";
                        }
                        else
                        {
                            using (var insuranceInfoService = new InsuranceInfoService())
                            {
                                var insurance = await insuranceInfoService.GetAll().Where(p => p.OrderId == order.Id).FirstOrDefaultAsync();

                                bookingNote.InsureFee = insurance.Fee.ToString("f2");
                                bookingNote.Value     = insurance.Value;
                            }
                        }

                        if (order.StartWebsiteId != new Guid())
                        {
                            using (var websiteInfoService = new WebsiteInfoService())
                            {
                                var website = await websiteInfoService.GetAll().Where(p => p.Id == order.StartWebsiteId).FirstOrDefaultAsync();

                                bookingNote.WebSiteName = website.SiteName;
                            }
                        }
                        else
                        {
                            bookingNote.WebSiteName = "";
                        }
                    }
                    return(bookingNote);
                }
                else
                {
                    return(null);
                }
            }
        }
Пример #5
0
        public async Task <OrderTraceDto> TrackOrder(string code)
        {
            var traceInfo = new OrderTraceDto();

            try
            {
                //得到订单信息
                using (OrderService orderService = new OrderService())
                {
                    var order = orderService.GetAllOrder().Where(p => p.BarCode == code).FirstOrDefault();
                    traceInfo.Code    = code;
                    traceInfo.OStatus = order.Status;
                    traceInfo.OrderId = order.Id;

                    using (OrderDetailsService orderDetailsService = new OrderDetailsService())
                    {
                        var odetail = orderDetailsService.GetAll().Where(p => p.OrderId == order.Id).FirstOrDefault();
                        if (odetail == null)
                        {
                            return(null);
                        }

                        //寄方信息
                        using (CargoSenderService senderService = new CargoSenderService())
                        {
                            var sender = await senderService.GetOneById(odetail.SenderId);

                            if (sender == null)
                            {
                                return(null);
                            }

                            traceInfo.SFAddress = sender.Provinces;
                            traceInfo.SSAddress = sender.DetailAddress;
                            traceInfo.SLocation = sender.Location;
                            traceInfo.SName     = sender.Name;
                            traceInfo.STel      = sender.MobliePhone;
                        }

                        //收方信息
                        using (CargoReceiverService receiverService = new CargoReceiverService())
                        {
                            var receiver = await receiverService.GetOneById(odetail.ReceiverId);

                            if (receiver == null)
                            {
                                return(null);
                            }

                            traceInfo.RFAddress = receiver.Provinces;
                            traceInfo.RSAddress = receiver.DetailAddress;
                            traceInfo.RLocation = receiver.Location;
                            traceInfo.RName     = receiver.Name;
                            traceInfo.RTel      = receiver.MobliePhone;
                        }
                    }
                }

                //得到汽车信息
                using (OrderWaybillLinkService orderWaybillLinkService = new OrderWaybillLinkService())
                {
                    var owlink = orderWaybillLinkService.GetAll().Where(p => p.OrderId == traceInfo.OrderId).FirstOrDefault();

                    if (owlink == null)
                    {
                        return(null);
                    }

                    using (WaybillTransportLinkService waybillTransportLinkService = new WaybillTransportLinkService())
                    {
                        var waybill = waybillTransportLinkService.GetAll().Where(p => p.WayBillId == owlink.WaybillId).FirstOrDefault();

                        if (waybill == null)
                        {
                            return(null);
                        }

                        using (TruckTraceService truckTrace = new TruckTraceService())
                        {
                            var truck = truckTrace.GetAll().Where(p => p.truckId == waybill.TransportInfoId).OrderByDescending(p => p.CreatTime).FirstOrDefault();

                            if (truck == null)
                            {
                                return(null);
                            }

                            traceInfo.TransLocation = truck.Location;
                        }
                    }
                }

                //得到追踪详细
                using (OrderTraceService orderTraceService = new OrderTraceService())
                {
                    var statusList = orderTraceService.GetAll().Where(p => p.OrderId == traceInfo.OrderId).OrderBy(p => p.CreatTime);

                    if (statusList == null)
                    {
                        return(null);
                    }

                    var packegeList = new List <PackegeStatus>();
                    foreach (var item in statusList)
                    {
                        packegeList.Add(new PackegeStatus()
                        {
                            Data = item.CreatTime.ToShortDateString(),
                            Time = item.CreatTime.ToShortTimeString(),
                            Mark = item.Mark
                        });
                    }
                    traceInfo.StatusList = packegeList;
                }
            }
            catch (Exception err)
            {
                return(null);
            }

            return(traceInfo);
        }