示例#1
0
        public ActionResult Index(string orderid, string customerid, string supplierid, int status = -2, int p = 1)
        {
            OrderSearchEntity search = new OrderSearchEntity();

            search.OrderID    = orderid ?? "";
            search.CustomerID = customerid.ToLong(0);
            search.SupplierID = supplierid.ToLong(0);
            search.Status     = status;


            int count = OrderService.GetOrderCount(search);

            PagerInfo pager = new PagerInfo();

            pager.PageIndex = p;
            pager.PageSize  = PAGESIZE;
            pager.SumCount  = count;
            pager.URL       = "/Order";

            List <StoreEntity>    stores    = StoreService.GetStoreAll().Where(t => t.Status == 1).ToList();
            List <CustomerEntity> customers = CustomerService.GetCustomerList();

            ViewBag.Search = search;
            List <OrderEntity> mList = OrderService.GetOrderByRule(search, pager);

            ViewBag.Orders    = mList;
            ViewBag.Pager     = pager;
            ViewBag.Customers = customers;
            ViewBag.Stores    = stores;

            return(View());
        }
示例#2
0
        public List <OrderEntity> SearchOrder(OrderSearchEntity searchObject)
        {
            IOrderSvc channel = CreateChannel();
            var       result  = channel.SearchOrder(searchObject);

            channel.Dispose();
            return(result);
        }
示例#3
0
 /// <summary>
 /// 更新UI主表[和子表]状态
 /// </summary>
 private void SetQuantityForOrderEntity(OrderSearchEntity entity, GridViewRow row, bool refreshDetails = true)
 {
     _dataContext.SetQuantityForOrderEntity(entity);
     //if (refreshDetails && row.DetailsVisibility != null && row.DetailsVisibility == Visibility.Visible)
     //{
     //    row.DetailsVisibility = Visibility.Collapsed;
     //    row.DetailsVisibility = Visibility.Visible;
     //}
     RadGridView1.CalculateAggregates();
 }
示例#4
0
        public int Count(OrderSearchEntity OrderSearchEntity)
        {
            if (OrderSearchEntity == null)
            {
                OrderSearchEntity = new OrderSearchEntity();
            }
            IQueryable <Order> Orders = context.Orders;

            Apply(Orders, OrderSearchEntity);
            return(Orders.Count());
        }
示例#5
0
        private void btnCancelZero_Click(object sender, RoutedEventArgs e)
        {
            RadButton         btn    = (RadButton)sender;
            OrderSearchEntity entity = (OrderSearchEntity)btn.DataContext;
            var result = _dataContext.ZeroCancelOrderQuantity(entity);

            if (result.IsSucceed)
            {
                this.SetQuantityForOrderEntity(entity, View.Extension.UIHelper.GetAncestor <GridViewRow>(btn));
            }
            MessageBox.Show(result.Message);
        }
示例#6
0
        private void btnRevert_Click(object sender, RoutedEventArgs e)
        {
            RadButton         btn    = (RadButton)sender;
            OrderSearchEntity entity = (OrderSearchEntity)btn.DataContext;
            var result = _dataContext.RevertOrder(entity);

            if (result.IsSucceed)
            {
                entity.订单状态 = true;
            }
            MessageBox.Show(result.Message);
        }
示例#7
0
        public static List <OrderEntity> GetOrderByRule(OrderSearchEntity search, PagerInfo pager)
        {
            List <OrderEntity> all    = new List <OrderEntity>();
            OrderRepository    mr     = new OrderRepository();
            List <OrderInfo>   miList = mr.GetOrderPagerByRule(search, pager);

            foreach (OrderInfo mInfo in miList)
            {
                OrderEntity entity = TranslateOrderEntity(mInfo);
                all.Add(entity);
            }
            return(all);
        }
示例#8
0
        public List <Order> List(OrderSearchEntity OrderSearchEntity)
        {
            if (OrderSearchEntity == null)
            {
                OrderSearchEntity = new OrderSearchEntity();
            }
            IQueryable <Order> Orders = context.Orders
                                        .Include(o => o.OrderDetails);

            Apply(Orders, OrderSearchEntity);
            SkipAndTake(Orders, OrderSearchEntity);
            return(Orders.ToList());
        }
示例#9
0
 public List <OrderEntity> SearchOrder(OrderSearchEntity searchObject)
 {
     //execute
     using (var db = VinaGerman.Database.VinagermanDatabase.GetDatabaseInstance())
     {
         try
         {
             db.OpenConnection();
             return(db.Resolve <IOrderDB>().SearchOrder(searchObject));
         }
         finally
         {
             db.CloseConnection();
         }
     }
 }
示例#10
0
        private IQueryable <Order> Apply(IQueryable <Order> Orders, OrderSearchEntity OrderSearchEntity)
        {
            if (OrderSearchEntity.Id.HasValue)
            {
                Orders = Orders.Where(wh => wh.Id == OrderSearchEntity.Id.Value);
            }
            if (OrderSearchEntity.CustomerId.HasValue)
            {
                Orders = Orders.Where(wh => wh.CustomerId == OrderSearchEntity.CustomerId.Value);
            }
            if (OrderSearchEntity.Status.HasValue)
            {
                Orders = Orders.Where(wh => wh.Status == OrderSearchEntity.Status.Value);
            }
            if (OrderSearchEntity.Total.HasValue)
            {
                Orders = Orders.Where(wh => wh.Total == OrderSearchEntity.Total.Value);
            }
            if (OrderSearchEntity.OnPaid.HasValue)
            {
                Orders = Orders.Where(wh => wh.OnPaid == OrderSearchEntity.OnPaid.Value);
            }
            if (OrderSearchEntity.ShipmentDetailId.HasValue)
            {
                Orders = Orders.Where(wh => wh.ShipmentDetailId == OrderSearchEntity.ShipmentDetailId.Value);
            }
            if (!string.IsNullOrEmpty(OrderSearchEntity.Code))
            {
                Orders = Orders.Where(wh => wh.Code.ToLower().Contains(OrderSearchEntity.Code.ToLower()));
            }
            if (!string.IsNullOrEmpty(OrderSearchEntity.Method))
            {
                Orders = Orders.Where(wh => wh.Method.ToLower().Contains(OrderSearchEntity.Method.ToLower()));
            }

            return(Orders);
        }
示例#11
0
        public List <OrderEntity> Get(EmployeeEntity EmployeeEntity, OrderSearchEntity OrderSearchEntity)
        {
            List <Order> Orders = UnitOfWork.OrderRepository.List(OrderSearchEntity);

            return(Orders.ToList().Select(od => new OrderEntity(od, od.OrderDetails)).ToList());
        }
示例#12
0
 public int Count(EmployeeEntity EmployeeEntity, OrderSearchEntity OrderSearchEntity)
 {
     return(UnitOfWork.OrderRepository.Count(OrderSearchEntity));
 }
示例#13
0
 public List <OrderEntity> SearchOrder(OrderSearchEntity searchObject)
 {
     return(Factory.Resolve <IOrderBL>().SearchOrder(searchObject));
 }
示例#14
0
 public List <OrderEntity> Get(OrderSearchEntity SearchOrderEntity)
 {
     return(OrderService.Get(EmployeeEntity, SearchOrderEntity));
 }
示例#15
0
 public long Count(OrderSearchEntity SearchOrderEntity)
 {
     return(OrderService.Count(EmployeeEntity, SearchOrderEntity));
 }
示例#16
0
        public List <OrderEntity> SearchOrder(OrderSearchEntity searchObject)
        {
            List <OrderEntity> result       = null;
            string             sqlStatement = "SELECT " + Environment.NewLine +
                                              "[Order].OrderId," + Environment.NewLine +
                                              "[Order].OrderType," + Environment.NewLine +
                                              "[Order].BusinessId," + Environment.NewLine +
                                              "[Order].IndustryId," + Environment.NewLine +
                                              "[Order].CreatedBy," + Environment.NewLine +
                                              "[Order].ResponsibleBy," + Environment.NewLine +
                                              "[Order].OrderDate," + Environment.NewLine +
                                              "[Order].CreatedDate," + Environment.NewLine +
                                              "[Order].CompanyId," + Environment.NewLine +
                                              "[Order].LocationId," + Environment.NewLine +
                                              "[Order].CustomerCompanyId," + Environment.NewLine +
                                              "[Order].CustomerContactId," + Environment.NewLine +
                                              "[Order].OrderNumber," + Environment.NewLine +
                                              "[Order].Description," + Environment.NewLine +
                                              "[Order].OrderStatus," + Environment.NewLine +
                                              "Company.Description as CustomerCompanyName," + Environment.NewLine +
                                              "Location.Description as LocationName," + Environment.NewLine +
                                              "Business.Description as BusinessName," + Environment.NewLine +
                                              "Industry.Description as IndustryName," + Environment.NewLine +
                                              "Contact.FullName as CustomerContactName," + Environment.NewLine +
                                              "ResponsibleContact.FullName as ResponsibleContactName" + Environment.NewLine +
                                              "FROM [Order] join Company on [Order].CustomerCompanyId = Company.CompanyId " + Environment.NewLine +
                                              "left join Contact on [Order].CustomerContactId = Contact.ContactId" + Environment.NewLine +
                                              "left join Contact ResponsibleContact on [Order].ResponsibleBy = ResponsibleContact.ContactId" + Environment.NewLine +
                                              "left join Location on [Order].LocationId = Location.LocationId" + Environment.NewLine +
                                              "join Business on [Order].BusinessId = Business.BusinessId" + Environment.NewLine +
                                              "join Industry on [Order].IndustryId = Industry.IndustryId" + Environment.NewLine +
                                              "WHERE 1=1 " + Environment.NewLine;

            if (searchObject.SearchText != null && searchObject.SearchText.Length > 0)
            {
                sqlStatement += "AND ([Order].OrderNumber LIKE N'%" + searchObject.SearchText + "%' OR [Order].Description LIKE N'%" + searchObject.SearchText + "%')" + Environment.NewLine;
            }
            if (searchObject.BusinessId > 0)
            {
                sqlStatement += "AND [Order].BusinessId=" + searchObject.BusinessId + Environment.NewLine;
            }
            if (searchObject.IndustryId > 0)
            {
                sqlStatement += "AND [Order].IndustryId=" + searchObject.IndustryId + Environment.NewLine;
            }
            if (searchObject.OrderType > 0)
            {
                sqlStatement += "AND [Order].OrderType=" + searchObject.OrderType + Environment.NewLine;
            }
            //if (searchObject.FromOrderDate != null)
            //{
            //    sqlStatement += "AND Order.OrderDate>=" + searchObject.FromOrderDate + Environment.NewLine;
            //}
            //if (searchObject.ToOrderDate != null)
            //{
            //    sqlStatement += "AND Order.OrderDate<=" + searchObject.ToOrderDate + Environment.NewLine;
            //}
            //execute
            result = Connection.Query <OrderEntity>(sqlStatement).ToList();
            return(result);
        }
示例#17
0
 public static int GetOrderCount(OrderSearchEntity search)
 {
     return(new OrderRepository().GetOrderCount(search));
 }