Пример #1
0
        public bool WorkOrderItemUpdate(WorkOrderItem woi)
        {
            foreach (WorkOrderItem itemWoi in _workOrderItems)
            {
                if (itemWoi.WorkOrderKey == woi.WorkOrderKey && itemWoi.SalesOrderItemKey == woi.SalesOrderItemKey)
                {
                    if (OperationAction.None == itemWoi.OperationAction ||
                        OperationAction.Delete == itemWoi.OperationAction)
                    {
                        return(false);
                    }
                    else if (OperationAction.New == itemWoi.OperationAction)
                    {
                        itemWoi.SalesOrderItemQuantity = woi.SalesOrderItemQuantity;
                    }
                    else if (OperationAction.Update == itemWoi.OperationAction)
                    {
                        itemWoi.SalesOrderItemQuantity = woi.SalesOrderItemQuantity;
                        itemWoi.OperationAction        = OperationAction.Modified;
                    }
                    else if (OperationAction.Modified == itemWoi.OperationAction)
                    {
                        itemWoi.SalesOrderItemQuantity = woi.SalesOrderItemQuantity;
                    }

                    _workOrderQuantityOrdered = _workOrderQuantityOrdered - Convert.ToInt32(itemWoi.SalesOrderItemQuantity) + Convert.ToInt32(woi.SalesOrderItemQuantity);
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        public void WorkOrderItemAdd(WorkOrderItem woi)
        {
            int salesOrderItemQuantity = Convert.ToInt32(woi.SalesOrderItemQuantity);

            foreach (WorkOrderItem itemWoi in _workOrderItems)
            {
                if (itemWoi.WorkOrderKey == woi.WorkOrderKey && itemWoi.SalesOrderItemKey == woi.SalesOrderItemKey)
                {
                    if (OperationAction.Delete == itemWoi.OperationAction)
                    {
                        itemWoi.SalesOrderItemQuantity = salesOrderItemQuantity.ToString();
                        itemWoi.OperationAction        = OperationAction.Modified;

                        _workOrderQuantityOrdered += salesOrderItemQuantity;
                    }
                    else if (OperationAction.Update == itemWoi.OperationAction)
                    {
                        salesOrderItemQuantity        += salesOrderItemQuantity;
                        itemWoi.SalesOrderItemQuantity = (Convert.ToInt32(itemWoi.SalesOrderItemQuantity) + salesOrderItemQuantity).ToString();
                        itemWoi.OperationAction        = OperationAction.Modified;

                        _workOrderQuantityOrdered += salesOrderItemQuantity;
                    }
                    else
                    {
                        itemWoi.SalesOrderItemQuantity = (Convert.ToInt32(itemWoi.SalesOrderItemQuantity) + salesOrderItemQuantity).ToString();

                        _workOrderQuantityOrdered += salesOrderItemQuantity;
                    }
                    return;
                }
            }
            _workOrderItems.Add(woi);

            _workOrderQuantityOrdered += salesOrderItemQuantity;
        }