public new bool Add(string SortingLineCode, string DeliverLineCodes, string orderDate)
        {
            if (orderDate == string.Empty || orderDate == null)
            {
                orderDate = DateTime.Now.ToString("yyyyMMdd");
            }
            else
            {
                orderDate = Convert.ToDateTime(orderDate).ToString("yyyyMMdd");
            }

            var sortOder = SortOrderRepository.GetQueryable().Where(s => DeliverLineCodes.Contains(s.DeliverLineCode) && s.OrderDate == orderDate)
                           .GroupBy(s => new { s.DeliverLineCode, s.OrderDate })
                           .Select(s => new { DeliverLineCode = s.Key.DeliverLineCode, OrderDate = s.Key.OrderDate });

            foreach (var item in sortOder.ToArray())
            {
                var sortOrderDispatch = new SortOrderDispatch();
                sortOrderDispatch.SortingLineCode = SortingLineCode;
                sortOrderDispatch.DeliverLineCode = item.DeliverLineCode;
                sortOrderDispatch.WorkStatus      = "1";
                sortOrderDispatch.OrderDate       = item.OrderDate;
                sortOrderDispatch.IsActive        = "1";
                sortOrderDispatch.UpdateTime      = DateTime.Now;

                SortOrderDispatchRepository.Add(sortOrderDispatch);
            }
            SortOrderDispatchRepository.SaveChanges();
            return(true);
        }
        public bool Save(SortOrderDispatch sortDispatch)
        {
            var sortOrderDispatch = SortOrderDispatchRepository.GetQueryable().FirstOrDefault(s => s.ID == sortDispatch.ID);

            sortOrderDispatch.SortingLineCode = sortDispatch.SortingLineCode;
            sortOrderDispatch.DeliverLineCode = sortDispatch.DeliverLineCode;
            sortOrderDispatch.WorkStatus      = "1";
            sortOrderDispatch.OrderDate       = sortDispatch.OrderDate;
            sortOrderDispatch.IsActive        = sortDispatch.IsActive;
            sortOrderDispatch.UpdateTime      = DateTime.Now;

            SortOrderDispatchRepository.SaveChanges();
            return(true);
        }
        public bool Delete(string id)
        {
            int ID = Convert.ToInt32(id);
            var sortOrderDispatch = SortOrderDispatchRepository.GetQueryable()
                                    .FirstOrDefault(s => s.ID == ID);

            if (sortOrderDispatch != null)
            {
                SortOrderDispatchRepository.Delete(sortOrderDispatch);
                SortOrderDispatchRepository.SaveChanges();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemple #4
0
        public new bool Add(string SortingLineCode, string DeliverLineCodes)
        {
            var sortOder = SortOrderRepository.GetQueryable().Where(s => DeliverLineCodes.Contains(s.DeliverLineCode))
                           .GroupBy(s => new { s.DeliverLineCode, s.OrderDate })
                           .Select(s => new { DeliverLineCode = s.Key.DeliverLineCode, OrderDate = s.Key.OrderDate });

            foreach (var item in sortOder.ToArray())
            {
                var sortOrderDispatch = new SortOrderDispatch();
                sortOrderDispatch.SortingLineCode = SortingLineCode;
                sortOrderDispatch.DeliverLineCode = item.DeliverLineCode;
                sortOrderDispatch.WorkStatus      = "1";
                sortOrderDispatch.OrderDate       = item.OrderDate;
                sortOrderDispatch.IsActive        = "1";
                sortOrderDispatch.UpdateTime      = DateTime.Now;

                SortOrderDispatchRepository.Add(sortOrderDispatch);
            }
            SortOrderDispatchRepository.SaveChanges();
            return(true);
        }