public override void Execute(UpdateOrderNoBase data)
        {
            var item = (UpdateNewOrderNo)data;

            var orderNo    = _expenseRepository.GetMaxOrderNo(item.UserId);
            var maxOrderNo = orderNo.HasValue ? orderNo.Value + 1 : 0;

            item.Expenses.ForEach(n => n.OrderNo = maxOrderNo++);
        }
示例#2
0
        public override void Execute(UpdateOrderNoBase data)
        {
            var item = (UpdateExistingOrderNo)data;

            var maxOrderNo = _expenseRepository.GetMaxOrderNo(item.UserId);             // value is always present (sort as last)

            var expense = _expenseRepository.Find(item.UserId, item.UpdateId);

            expense.OrderNo = maxOrderNo.Value + 1;
        }
示例#3
0
        public override void Execute(UpdateOrderNoBase data)
        {
            var item = (UpdateExistingOrderNo)data;

            var orderNoFrom = _expenseRepository.Find(item.UserId, item.BaseItemId.Value).OrderNo.Value;    // first get expense from which I'll get orderNoFrom; i'm sure that found expense has order no

            var expenses = _expenseRepository.FindWithOrderNumberGraterThan(item.UserId, item.UpdateId, orderNoFrom).ToList();

            expenses.ForEach(n => n.OrderNo = n.OrderNo.Value + 1);

            var expense = _expenseRepository.Find(item.UserId, item.UpdateId);                              // get moved expense and change it's order no

            expense.OrderNo = orderNoFrom;
        }
 public void UpdateOrderNo(UpdateOrderNoBase data)
 {
     _updateOrderNoService.Execute(data.UpdateType, data);
 }
 public void UpdateExpensesOrderNo(UpdateOrderNoBase data)
 {
     UpdateOrderNo(data);
     _unitOfWork.Save();
 }
        private void UpdateOrderNo(UpdateOrderNoBase data)
        {
            var updateOrderNoService = new UpdateOrderNoService(_expenseRepository);

            updateOrderNoService.UpdateOrderNo(data);
        }
示例#7
0
 public abstract void Execute(UpdateOrderNoBase data);