// 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 static byte[] LadeOrderDetails(byte[] itemBuffer)
 {
     byte[] objRet = null;
     string strReceive = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, itemBuffer.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0');
     List<OrderDetails> orderDetailsList = JsonConvert.DeserializeObject<List<OrderDetails>>(strReceive);
     bool result = true;
     if (orderDetailsList != null && orderDetailsList.Count > 0)
     {
         foreach (OrderDetails item in orderDetailsList)
         {
             result = OrderDetailsService.GetInstance().LadeOrderDetails(item);
             if (!result)
             {
                 break;
             }
         }
     }
     if (result)
     {
         //成功
         objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
         Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
         Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
     }
     else
     {
         //单品提单失败
         objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
         Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
         Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
     }
     return objRet;
 }
Пример #3
0
        public ActionResult DownloadTestCertificate(decimal orderDetailId, bool second)
        {
            var orderDetail = OrderDetailsService.FirstOrDefault(x =>
                                                                 x.OrderDetailID == orderDetailId && BerthTypes.AllPaidForTestCerts.Contains(x.StudentInGroup.BerthType_TC));
            var userTestId = orderDetail.UserTestId.Value;

            UserTestService.LoadWith(x => x.Test, x => x.TestPassRule);
            var userTest = UserTestService.GetByPK(userTestId);

            TestCertificatePermission(orderDetail, userTest);
            var certificateFileSys = UserImages.GetTestCertFileSys(userTestId);

            try {
                System.IO.File.Delete(certificateFileSys);
            } catch (Exception e) {
                return(Content("Сертификат уже скачивается"));
            }
            var isEng = orderDetail.Params.Lang == TestCertLang.Eng;

            if (orderDetail.Params.Lang == TestCertLang.RusEng && second)
            {
                isEng = true;
            }
            using (var image = Image.FromFile(UserImages.GetTestCertFileSys(isEng ? 0 : 1))) {
                using (var result = ImageUtils.DrawTestString(image,
                                                              isEng ? User.EngFullName : User.FullName,
                                                              EntityUtils.GetTestCertName(isEng, userTest), userTest.RunDate.DefaultString(), userTest.Id))
                    result.Save(certificateFileSys);
            }
            return(File(certificateFileSys, "image/png", "certificate.png"));
        }
Пример #4
0
        public OpenOrderResponse OpenOrder(OpenOrderRequest request)
        {
            OrderDetailsService service  = new OrderDetailsService();
            OpenOrderResponse   response = new OpenOrderResponse();

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    request.Order = service.GetById(request.OrderId);
                    request.Order.OrderStatusId             = 1;
                    request.Order.OrderStatus.OrderStatusId = 1;
                    request.Order.OrderStatus.StatusName    = "Open";
                    if (request.Order != null)
                    {
                        service.Update(request.Order);
                    }
                    // The Complete method commits the transaction. If an exception has been thrown,
                    // Complete is not  called and the transaction is rolled back.
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                response.IsFailed = true;
                response.Message  = ex.Message;
            }
            return(response);
        }
Пример #5
0
        public async Task AddOrderDetails_WithValidModel_ShouldReturnOrderDetailsId()
        {
            //Arrange
            var db = this.SetDb();

            var repo = new Repository <OrderDetails>(db);
            var orderDetailsService = new OrderDetailsService(repo, this.Mapper);

            var model = new OrderDetailsViewModel
            {
                FirstName   = "Test",
                LastName    = "TestTest",
                Email       = "*****@*****.**",
                PhoneNumber = "+359/888777666",
                City        = "Test",
                Country     = "Test",
                Address     = "Test test test 6"
            };

            //Act
            var id = await orderDetailsService.AddOrderDetails(model);

            //Assert
            Assert.Equal(1, id);
        }
Пример #6
0
        /// <summary>
        /// Delete orderdetails
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DeleteOrderDetailsResponse DeleteOrderDetails(DeleteOrderDetailsRequest request)
        {
            OrderDetailsService        service  = new OrderDetailsService();
            DeleteOrderDetailsResponse response = new DeleteOrderDetailsResponse();
            OrderService orderService           = new OrderService();

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    response.IsFailed = !(service.DeleteOrderDetails(request.OrderDetails.OrderDetailId));
                    if (service.GetOrderDetailsByOrderId(request.OrderDetails.OrderId).Count == 0)
                    {
                        orderService.DeleteOrder(request.OrderDetails.OrderId);
                    }
                    // The Complete method commits the transaction. If an exception has been thrown,
                    // Complete is not  called and the transaction is rolled back.
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                response.IsFailed = true;
                response.Message  = ex.Message;
            }
            return(response);
        }
Пример #7
0
        /// <summary>
        /// Delete order by request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public DeleteOrderResponse DeleteOrder(DeleteOrderRequest request)
        {
            DeleteOrderResponse response            = new DeleteOrderResponse();
            OrderService        service             = new OrderService();
            OrderDetailsService orderDetailsService = new OrderDetailsService();

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    bool result = service.DeleteOrder(request.OrderId);
                    bool deleteOrderDetailsResult = orderDetailsService.CloseOrderDetailsByOrderID(request.OrderId);
                    if (result && deleteOrderDetailsResult)
                    {
                        scope.Complete();
                    }
                }
            }
            catch (TransactionAbortedException ex)
            {
                response.IsFailed = true;
                response.Message  = ex.Message;
            }
            catch (Exception ex)
            {
                response.IsFailed = true;
                response.Message  = ex.Message;
            }

            return(response);
        }
Пример #8
0
 public OrderController(SignInManager <ApplicationUser> signInManager, CategoryService categoryService, OrderDetailsService orderDetailsService, OrderService orderService, CustomerService customerService)
 {
     _orderService        = orderService;
     _categoryService     = categoryService;
     _customerService     = customerService;
     _orderDetailsService = orderDetailsService;
     _signInManager       = signInManager;
 }
Пример #9
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)));
        }
Пример #10
0
        public async Task SetOrderDetailsId_WithValidId_ShouldSetOrderDetailsToOrder()
        {
            //Arrange
            var db = this.SetDb();

            await this.SeedProducts(db);

            await this.SeedUser(db);

            var productRepo = new Repository <Product>(db);
            var repo        = new Repository <Order>(db);
            var userRepo    = new Repository <CakeItUser>(db);
            var wrapper     = new TestCartSessionWrapper();
            var cartManager = new CartManager(wrapper);

            var item1 = new Item()
            {
                Product = await productRepo.GetByIdAsync(1), Quantity = 1
            };

            cartManager.SetCartItem(new List <Item> {
                item1
            });

            var orderService = new OrderService(repo, userRepo, cartManager, this.Mapper);

            var userName = this.user.UserName;

            var result = await orderService.CreateOrder(userName);

            var detailsRepo         = new Repository <OrderDetails>(db);
            var orderDetailsService = new OrderDetailsService(detailsRepo, this.Mapper);

            var model = new OrderDetailsViewModel
            {
                FirstName   = "Test",
                LastName    = "TestTest",
                Email       = "*****@*****.**",
                PhoneNumber = "+359/888777666",
                City        = "Test",
                Country     = "Test",
                Address     = "Test test test 6"
            };

            var id = await orderDetailsService.AddOrderDetails(model);

            //Act
            await orderService.SetOrderDetailsId(id);

            var expectedOrderDetailsId = 1;
            var actualOrerDetailsId    = (await repo.GetByIdAsync(1)).OrderDetailsId;

            //Assert
            Assert.Equal(expectedOrderDetailsId, actualOrerDetailsId);
        }
        public void ConstructorShould_CreateCategoryInfoService()
        {
            // Arrange
            var EfRepositoryStub = new Mock <IEfRepository <OrderDetail> >();
            var SaveContextStub  = new Mock <ISaveContext>();

            // Act
            var orderService = new OrderDetailsService(EfRepositoryStub.Object, SaveContextStub.Object);

            // Assert
            Assert.IsNotNull(orderService);
        }
Пример #12
0
 public EntityService()
 {
     _appUserService          = new AppUserService();
     _categoryService         = new CategoryService();
     _commentService          = new CommentService();
     _dislikeService          = new DislikeService();
     _ımageForProductsService = new ImageForProductsService();
     _likeService             = new LikeService();
     _orderDetailsService     = new OrderDetailsService();
     _orderService            = new OrderService();
     _productService          = new ProductService();
     _treeCommentService      = new TreeCommentService();
 }
Пример #13
0
        public void Update_Should_CallContextCommit()
        {
            // Arrange
            var         EfRepositoryStub     = new Mock <IEfRepository <OrderDetail> >();
            var         SaveContextMock      = new Mock <ISaveContext>();
            var         orederDetailsService = new OrderDetailsService(EfRepositoryStub.Object, SaveContextMock.Object);
            OrderDetail orderDetail          = new OrderDetail();

            // Act
            orederDetailsService.Update(orderDetail);

            // Assert
            SaveContextMock.Verify(x => x.Commit(), Times.Once);
        }
Пример #14
0
        private void btnStatistics_Click(object sender, EventArgs e)
        {
            if (this.dateTimePicker4.Value > this.dateTimePicker3.Value)
            {
                string beginDate = this.dateTimePicker3.Value.ToString("yyyy-MM-dd");
                string endDate   = this.dateTimePicker4.Value.ToString("yyyy-MM-dd");

                IList <TopSellGoods> topSellGoodsList = OrderDetailsService.GetInstance().GetTopSellGoodsByTime(beginDate, endDate);
                if (topSellGoodsList != null && topSellGoodsList.Count > 0)
                {
                    BindChartPieData(topSellGoodsList);
                }
            }
        }
Пример #15
0
        public static byte[] GetLastCustomPrice(byte[] itemBuffer)
        {
            byte[] objRet = null;
            string strReceive = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, itemBuffer.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0');
            Guid goodsID = new Guid(strReceive);

            decimal result = OrderDetailsService.GetInstance().GetLastCustomPrice(goodsID);

            int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + BasicTypeLength.DOUBLE_DECIMAL;
            objRet = new byte[transCount];
            Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
            Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            Array.Copy(BitConverter.GetBytes((double)result), 0, objRet, 2 * BasicTypeLength.INT32, BasicTypeLength.DOUBLE_DECIMAL);
            return objRet;
        }
        public ActionResult Detail(int OrderID, int ProductID, int Quantity)
        {
            var serviceOD = new OrderDetailsService();
            var serviceOR = new OrderService();

            var orderdetail = new OrderDetails()
            {
                OrderID   = OrderID,
                ProductID = ProductID,
                Quantity  = Quantity
            };

            serviceOD.Update(orderdetail);
            return(RedirectToAction("Order", "Admin"));
        }
Пример #17
0
        public void GetById_ShouldReturnsNullWhenOrderDetailIdIsNull()
        {
            //Arrange
            var EfRepositoryStub = new Mock <IEfRepository <OrderDetail> >();
            var SaveContextStub  = new Mock <ISaveContext>();


            var orderDetailsService = new OrderDetailsService(EfRepositoryStub.Object, SaveContextStub.Object);

            // Act
            OrderDetail orderDetailModel = orderDetailsService.GetById(null);

            // Assert
            Assert.IsNull(orderDetailModel);
        }
Пример #18
0
        public ActionResult SearchOrderdetail(int orderid)
        {
            var cookie = Request.Cookies[FormsAuthentication.FormsCookieName];

            if (cookie == null)
            {
                return(RedirectToAction("Login", "Login"));
            }

            var ticket = FormsAuthentication.Decrypt(cookie.Value);

            var customer_service    = new CustomerService();
            var product_service     = new ProductsService();
            var orderdetail_service = new OrderDetailsService();
            var photo_service       = new ProductPhotoService();
            var order_service       = new OrderService();

            var user  = customer_service.FindByCustomerAccount(ticket.Name);
            var items = orderdetail_service.FindById(orderid);

            if (user.CustomerID != order_service.FindById(orderid).CustomerID)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var result = new List <SearchOrderdetailModel>();

            foreach (var item in items)
            {
                SearchOrderdetailModel model = new SearchOrderdetailModel();

                model.Image       = photo_service.FindById(item.ProductID).First().PhotoPath;
                model.ProductID   = item.ProductID;
                model.ProductName = product_service.FindByID(item.ProductID).ProductName;
                model.Color       = product_service.FindByID(item.ProductID).Color;
                model.Size        = product_service.FindByID(item.ProductID).Size;
                model.Amount      = item.Quantity;
                model.UnitPrice   = product_service.FindByID(item.ProductID).UnitPrice;
                model.Total       = product_service.FindByID(item.ProductID).UnitPrice *item.Quantity;

                result.Add(model);
            }

            ViewData.Add("list", result);
            var orders = order_service.FindById(orderid);

            return(View(orders));
        }
Пример #19
0
        /// <summary>
        /// Select List of all the OrderDetails
        /// </summary>
        /// <returns>List of OrderDetails </returns>
        public GetAllOrderDetailsResponse GetAllOrderDetails(GetAllOrderDetailsRequest request)
        {
            OrderDetailsService        service  = new OrderDetailsService();
            GetAllOrderDetailsResponse response = new GetAllOrderDetailsResponse();

            try
            {
                response.OrderDetailsBEList = service.GetAllOrderDetails();
            }
            catch (Exception ex)
            {
                response.IsFailed = true;
                response.Message  = ex.Message;
            }
            return(response);
        }
Пример #20
0
        /// <summary>
        /// Insert orderdetails
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public InsertOrderResponse InsertOrder(InsertOrderRequest request)
        {
            OrderDetailsService service  = new OrderDetailsService();
            InsertOrderResponse response = new InsertOrderResponse();

            try
            {
                response.OrderBE = service.InsertOrder(request.OrderBE);
            }
            catch (Exception ex)
            {
                response.Message  = ex.Message;
                response.IsFailed = true;
            }
            return(response);
        }
Пример #21
0
        /// <summary>
        /// Update orderdetails
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public UpdateOrderDetailsResponse UpdateOrderDetails(UpdateOrderDetailsRequest request)
        {
            OrderDetailsService        service  = new OrderDetailsService();
            UpdateOrderDetailsResponse response = new UpdateOrderDetailsResponse();

            try
            {
                response.IsFailed = !(service.UpdateOrderDetails(request.OrderDetailsBE));
            }
            catch (Exception ex)
            {
                response.IsFailed = true;
                response.Message  = ex.Message;
            }
            return(response);
        }
        // GET: Order
        public ActionResult AdminOrderDetail(int id)
        {
            var serviceOrderDetails = new OrderDetailsService();
            var serviceOrder        = new OrderService();
            var servicePhoto        = new ProductPhotoService();
            var _OrderDetail        = serviceOrderDetails.FindOrderDetail(id);
            var _Order = serviceOrder.FindById(id);

            var model = new AOrderDetailModel();

            model.OrderId   = id;
            model.OrderDay  = _Order.OrderDay;
            model.Transport = _Order.Transport;
            model.Payment   = _Order.Payment;
            model.Address   = _Order.Address;
            model.Status    = _Order.Status;
            model.Data      = _OrderDetail;

            var status = serviceOrder.Status();
            List <SelectListItem> items = new List <SelectListItem>();

            foreach (var s in status)
            {
                if (s == _Order.Status)
                {
                    items.Add(new SelectListItem()
                    {
                        Text  = s,
                        Value = s
                    });
                }
            }
            foreach (var s in status)
            {
                if (s != _Order.Status)
                {
                    items.Add(new SelectListItem()
                    {
                        Text  = s,
                        Value = s
                    });
                }
            }
            ViewBag.status = items;

            return(View(model));
        }
Пример #23
0
        /// <summary>
        /// Select List of all the OrderDetails by orderid
        /// </summary>
        /// <param name="request"></param>
        /// <returns>List of OrderDetails</returns>
        public GetOrderDetailsByOrderIdResponse GetOrderDetailsByOrderId(GetOrderDetailsByOrderIdRequest request)
        {
            OrderDetailsService service = new OrderDetailsService();
            GetOrderDetailsByOrderIdResponse response = new GetOrderDetailsByOrderIdResponse();

            try
            {
                response.OrderDetailsBEList = service.GetOrderDetailsByOrderId(request.Id);
            }
            catch (Exception ex)
            {
                response.Message  = ex.Message;
                response.IsFailed = true;
                throw new Exception(ex.Message);
            }
            return(response);
        }
Пример #24
0
        public void GivenAlreadyHaveCreatedOrderDetailEntity_TryToCreateAgain_ReturnInsertEntityException()
        {
            var mockOrderDetRep = new Mock <IOrderDetailRepository>();

            mockOrderDetRep.Setup(x => x.Get(It.IsAny <int>(), It.IsAny <int>()))
            .Returns(() => new OrderDetail()
            {
                OrderId = 1, ProductId = 1
            });

            var service = new OrderDetailsService(mockOrderDetRep.Object);

            Assert.ThrowsException <InsertEntityException>(() => service.Create(new OrderDetail()
            {
                OrderId = 1, ProductId = 1
            }));
        }
        public ActionResult AdminDetail(AOrderDetailModel model)
        {
            var serviceOD = new OrderDetailsService();
            var serviceOR = new OrderService();

            var order = new Order()
            {
                OrderID   = model.OrderId,
                Transport = model.Transport,
                Payment   = model.Payment,
                Status    = model.Status,
                Address   = model.Address
            };

            serviceOR.Update(order);

            return(RedirectToAction("Order", "Admin"));
        }
Пример #26
0
        public static byte[] GetAllDeletedItems(byte[] itemBuffer)
        {
            byte[] objRet = null;
            string beginDate = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.BEGINDATE).Trim('\0');
            string endDate = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE, ParamFieldLength.ENDDATE).Trim('\0');
            int dateType = BitConverter.ToInt32(itemBuffer, ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE + ParamFieldLength.ENDDATE);

            DeletedAllItems deletedAllItems = OrderDetailsService.GetInstance().GetAllDeletedItems(DateTime.Parse(beginDate), DateTime.Parse(endDate), dateType);
            string json = JsonConvert.SerializeObject(deletedAllItems);
            byte[] jsonByte = Encoding.UTF8.GetBytes(json);

            int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
            objRet = new byte[transCount];
            Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
            Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            return objRet;
        }
Пример #27
0
 public List <OrderListDto> GetOrderByWebsite(out Guid id, out string websiteLocation, string name = null, string type = null)
 {
     using (var websiteServicce = new WebsiteInfoService())
     {
         if (name == null || type == null)
         {
             id = new Guid();
             websiteLocation = null;
             return(null);
         }
         else
         {
             var  website = websiteServicce.GetAll().Where(p => p.SiteName == name).FirstOrDefault();
             Guid _id     = website.Id;
             websiteLocation = website.Location;
             using (var orderDetailsService = new OrderDetailsService())
             {
                 var orderData = orderDetailsService.GetAllOrder(false).Include(p => p.Order).Include(p => p.Sender).Include(p => p.Receiver)
                                 .Where(p => p.Order.Status == type && p.Order.StartWebsiteId == _id)
                                 .Select(p => new OrderListDto()
                 {
                     OrderId         = p.Order.BarCode.Substring(2),
                     SenderAddress   = p.Sender.DetailAddress,
                     ReceiverAddress = p.Receiver.Provinces,
                     Time            = p.GetGoodsTime,
                     Location        = type == "1" ? p.Sender.Location : p.Receiver.Location,
                     Income          = p.Freight,
                     CargoWeight     = p.CargoWeight,
                     CargoVolume     = p.CargoVolume,
                     UnitNUm         = p.UitNum
                 }).ToList();
                 id = _id;
                 return(orderData);
             }
         }
     }
 }
Пример #28
0
        public async Task <List <OrderListDto> > GetAllOrderViewNoPage()
        {
            using (var orderDetailsService = new OrderDetailsService())
            {
                var list = await orderDetailsService.GetAllOrder(false)
                           .Include(p => p.Order).Include(p => p.Sender).Include(p => p.Receiver)
                           .Select(p => new OrderListDto()
                {
                    OrderId         = p.Order.BarCode,
                    CargoName       = p.CargoName,
                    CargoWeight     = p.CargoWeight,
                    CargoVolume     = p.CargoVolume,
                    UnitNUm         = p.UitNum,
                    InsuredValue    = p.IsInsured ? "1" : "0",
                    Status          = p.Order.Status,
                    SenderAddress   = p.Sender.Provinces + p.Sender.DetailAddress,
                    ReceiverAddress = p.Receiver.Provinces + p.Receiver.DetailAddress,
                    SenderId        = p.SenderId,
                    ReceiverId      = p.ReceiverId,
                }).ToListAsync();

                return(list);
            }
        }
Пример #29
0
 public void SetUp()
 {
     _mock    = new Mock <IUnitOfWork>();
     _service = new OrderDetailsService(_mock.Object);
 }
Пример #30
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dataGirdViewExt1.Rows.Clear();
            dataGirdViewExt2.Rows.Clear();
            string beginDate = dateTimePicker1.Value.ToString("yyyy-MM-dd 00:00:00");
            string endDate   = dateTimePicker2.Value.ToString("yyyy-MM-dd 23:59:59");
            int    dateType  = 1;

            if (cmbDateType.Text == "账务日")
            {
                dateType = 1;
            }
            if (cmbDateType.Text == "营业日")
            {
                dateType = 2;
            }
            DeletedAllItems deletedAllItems = OrderDetailsService.GetInstance().GetAllDeletedItems(beginDate, endDate, dateType);

            //绑定单品删除品项
            if (deletedAllItems.DeletedGoodsItemList != null && deletedAllItems.DeletedGoodsItemList.Count > 0)
            {
                decimal totalAmount = 0M;
                foreach (DeletedItem item in deletedAllItems.DeletedGoodsItemList)
                {
                    totalAmount += item.TotalSellPrice;
                    int index = dataGirdViewExt1.Rows.Add();
                    dataGirdViewExt1.Rows[index].Cells["colTranSequence"].Value     = item.TranSequence;
                    dataGirdViewExt1.Rows[index].Cells["colDeskName"].Value         = item.DeskName;
                    dataGirdViewExt1.Rows[index].Cells["colOrderNo"].Value          = item.OrderNo;
                    dataGirdViewExt1.Rows[index].Cells["colGoodsName"].Value        = item.GoodsName;
                    dataGirdViewExt1.Rows[index].Cells["colItemQty"].Value          = item.ItemQty;
                    dataGirdViewExt1.Rows[index].Cells["colCancelReasonName"].Value = item.CancelReasonName;
                    dataGirdViewExt1.Rows[index].Cells["colCancelEmployeeNo"].Value = item.CancelEmployeeNo;
                    dataGirdViewExt1.Rows[index].Cells["colLastModifiedTime"].Value = item.LastModifiedTime;
                    string type = string.Empty;
                    if (item.PayTime == null)
                    {
                        type = "退菜";
                    }
                    else
                    {
                        type = "退单";
                    }
                    dataGirdViewExt1.Rows[index].Cells["colType"].Value = type;
                }
                txtTotalQty.Text    = deletedAllItems.DeletedGoodsItemList.Count.ToString();
                txtTotalAmount.Text = totalAmount.ToString("f2");
            }
            //绑定整单删除品项
            if (deletedAllItems.DeletedOrderItemList != null && deletedAllItems.DeletedOrderItemList.Count > 0)
            {
                decimal totalMoney = 0M;
                foreach (DeletedItem item in deletedAllItems.DeletedOrderItemList)
                {
                    totalMoney += item.TotalSellPrice;
                    int index = dataGirdViewExt2.Rows.Add();
                    dataGirdViewExt2.Rows[index].Cells["colTranSequence1"].Value     = item.TranSequence;
                    dataGirdViewExt2.Rows[index].Cells["colDeskName1"].Value         = item.DeskName;
                    dataGirdViewExt2.Rows[index].Cells["colOrderNo1"].Value          = item.OrderNo;
                    dataGirdViewExt2.Rows[index].Cells["colGoodsName1"].Value        = item.GoodsName;
                    dataGirdViewExt2.Rows[index].Cells["colItemQty1"].Value          = item.ItemQty;
                    dataGirdViewExt2.Rows[index].Cells["colCancelReasonName1"].Value = item.CancelReasonName;
                    dataGirdViewExt2.Rows[index].Cells["colCancelEmployeeNo1"].Value = item.CancelEmployeeNo;
                    dataGirdViewExt2.Rows[index].Cells["colLastModifiedTime1"].Value = item.LastModifiedTime;
                    string type = string.Empty;
                    if (item.PayTime == null)
                    {
                        type = "退菜";
                    }
                    else
                    {
                        type = "退单";
                    }
                    dataGirdViewExt2.Rows[index].Cells["colType1"].Value = type;
                }
                txtTotalNum.Text   = deletedAllItems.DeletedOrderItemList.Count.ToString();
                txtTotalMoney.Text = totalMoney.ToString("f2");
            }
        }