Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ItemReturn itemReturn = db.ItemReturns.Find(id);

            db.ItemReturns.Remove(itemReturn);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
            /// <summary>
            /// Serializes the specified item to an XML string.
            /// </summary>
            /// <param name="itemReturn">The object to serialize.</param>
            /// <returns>An XML string.</returns>
            public static string Serialize(ItemReturn itemReturn)
            {
                if (itemReturn == null)
                {
                    return(null);
                }

                return(SerializationHelper.SerializeObjectToXml <ItemReturn>(itemReturn));
            }
Ejemplo n.º 3
0
 /// <summary>
 ///     Adds a new Item return
 /// </summary>
 /// <param name="itemreturn"></param>
 public void AddItemReturn(ItemReturn itemreturn)
 {
     if (string.IsNullOrEmpty(itemreturn.ContactInfo))
     {
         throw new ArgumentNullException(nameof(itemreturn.CustomerId), "ItemReturn Contact Information is null");
     }
     using (var connection = Connector.GetConnection())
     {
         new ItemReturnDal(connection).Insert(itemreturn.ItemId, itemreturn.CustomerId, itemreturn.ContactInfo,
                                              itemreturn.ReturnQty, itemreturn.IsHandled, itemreturn.Note);
     }
 }
Ejemplo n.º 4
0
            private NullResponse MarkItemsReturned(MarkReturnedItemsRealtimeRequest request)
            {
                ThrowIf.Null(request, "request");

                // Try convert sales line to returned items
                // Consider active lines only. Ignore voided lines.
                List <ItemReturn> itemReturns = new List <ItemReturn>();

                foreach (var salesLine in request.SalesTransaction.ActiveSalesLines)
                {
                    if (salesLine.IsReturnByReceipt)
                    {
                        // Might be empty after customer order return
                        if (string.IsNullOrWhiteSpace(salesLine.ReturnStore))
                        {
                            salesLine.ReturnStore = request.SalesTransaction.StoreId;
                        }

                        // Might be empty after customer order return
                        if (string.IsNullOrWhiteSpace(salesLine.ReturnTerminalId))
                        {
                            salesLine.ReturnTerminalId = request.SalesTransaction.TerminalId;
                        }

                        // we don't store the return channel identifier for the lines, just for the transaction
                        if (salesLine.ReturnChannelId == 0)
                        {
                            salesLine.ReturnChannelId = request.SalesTransaction.ChannelId;
                        }

                        var itemReturn = new ItemReturn();
                        itemReturn.ChannelId     = salesLine.ReturnChannelId;
                        itemReturn.StoreId       = salesLine.ReturnStore;
                        itemReturn.TerminalId    = salesLine.ReturnTerminalId;
                        itemReturn.TransactionId = salesLine.ReturnTransactionId;
                        itemReturn.LineNumber    = salesLine.ReturnLineNumber;
                        itemReturn.Quantity      = salesLine.Quantity;

                        itemReturns.Add(itemReturn);
                    }
                }

                // Mark return quantities if needed
                if (itemReturns.Any())
                {
                    // Call the transaction service to update return quantities
                    var transactionService = new TransactionServiceClient(request.RequestContext);
                    transactionService.MarkItemsReturned(itemReturns.ToArray());
                }

                return(new NullResponse());
            }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "Id,UserId,ProdId,DeptTakenId,DeptRetId,Quantity,Date,Condition")] ItemReturn itemReturn)
 {
     if (ModelState.IsValid)
     {
         db.Entry(itemReturn).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DeptRetId   = new SelectList(db.Departments, "Id", "Name", itemReturn.DeptRetId);
     ViewBag.DeptTakenId = new SelectList(db.Departments, "Id", "Name", itemReturn.DeptTakenId);
     ViewBag.ProdId      = new SelectList(db.Products, "Id", "Name", itemReturn.ProdId);
     ViewBag.UserId      = new SelectList(db.Users, "Id", "Name", itemReturn.UserId);
     return(View(itemReturn));
 }
Ejemplo n.º 6
0
        // GET: ItemReturn/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ItemReturn itemReturn = db.ItemReturns.Find(id);

            if (itemReturn == null)
            {
                return(HttpNotFound());
            }
            return(View(itemReturn));
        }
Ejemplo n.º 7
0
 public void ShowObject(object keyValue)
 {
     try
     {
         var info = keyValue as ReturnInfo;
         itemReturn = context.ItemReturns.Single(r => r.ReturnId == info.ReturnId);
         returnBindingSource.DataSource       = itemReturn;
         returnDetailBindingSource.DataSource = itemReturn.ReturnedItems;
         this.Text = string.Format("Return: {0}", itemReturn.ReturnNo);
         AuthorizeForm();
     }
     catch (Exception exception)
     {
         ViewHelper.ShowErrorMessage("Error loading return information", exception);
     }
 }
Ejemplo n.º 8
0
        // GET: ItemReturn/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ItemReturn itemReturn = db.ItemReturns.Find(id);

            if (itemReturn == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DeptRetId   = new SelectList(db.Departments, "Id", "Name", itemReturn.DeptRetId);
            ViewBag.DeptTakenId = new SelectList(db.Departments, "Id", "Name", itemReturn.DeptTakenId);
            ViewBag.ProdId      = new SelectList(db.Products, "Id", "Name", itemReturn.ProdId);
            ViewBag.UserId      = new SelectList(db.Users, "Id", "Name", itemReturn.UserId);
            return(View(itemReturn));
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     Updates an item return record with new attributes
        /// </summary>
        /// <param name="itemreturn"></param>
        /// <param name="customerId"></param>
        /// <param name="itemId"></param>
        /// <param name="qty"></param>
        /// <param name="isHandled"></param>
        /// <param name="note"></param>
        public void UpdateItemReturn(ItemReturn itemreturn, uint?customerId = null, uint?itemId = null,
                                     uint?qty    = null, bool?isHandled = null,
                                     string note = null)
        {
            if (itemreturn.Id == null)
            {
                throw new ArgumentNullException(nameof(itemreturn.CustomerId), "ItemReturn Id is null");
            }

            using (var connection = Connector.GetConnection())
            {
                new ItemReturnDal(connection).Update(itemreturn.Id.Value, customerId, itemId, qty, isHandled, note);
                // Update object if successful
                itemreturn.CustomerId = customerId ?? itemreturn.CustomerId;
                itemreturn.ItemId     = itemId ?? itemreturn.ItemId;
                itemreturn.ReturnQty  = qty ?? itemreturn.ReturnQty;
                itemreturn.IsHandled  = isHandled ?? itemreturn.IsHandled;
            }
        }
Ejemplo n.º 10
0
    public static void selectItem(Character characterSheet, MapGenerator mapGenerator, Unit u)
    {
        Vector3 mousePos = Input.mousePosition;

        mousePos.y = Screen.height - mousePos.y;
        foreach (InventorySlot slot in inventorySlots)
        {
            Rect r = UnitGUI.getInventorySlotRect(slot);
            if (r.Contains(mousePos))
            {
                Vector2 v = getIndexOfSlot(slot);
                //				Debug.Log(v);
                int ind = getLinearIndexFromIndex(v);
                InventoryItemSlot sl  = characterSheet.characterSheet.inventory.inventory[ind];
                InventoryItemSlot slR = sl.itemSlot;
                if (slR == null)
                {
                    break;
                }
                //	Item i = slR.item;
                Vector2    itemSlot = Inventory.getSlotForIndex(ind);
                ItemReturn ir       = characterSheet.characterSheet.inventory.removeItemFromSlot(itemSlot);
                selectedItem = ir.item;
                if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
                {
                    if (selectedItem.stackSize() > 1)
                    {
                        characterSheet.characterSheet.inventory.insertItemInSlot(selectedItem, itemSlot - ir.slot);
                        selectedItem = selectedItem.popStack();
                    }
                }
                selectedCell     = ir.slot;
                selectedMousePos = mousePos;
                //				selectedItemPos = getInventorySlotPos();
                selectedItemPos       = UnitGUI.getInventorySlotPos(inventorySlots[slR.index]);
                selectedItemWasInSlot = inventorySlots[slR.index];
                break;
            }
        }
//		if (!GameGUI.looting || mousePos.x < groundX || mousePos.y < groundY || mousePos.x > groundX + groundWidth || mousePos.y > groundY + groundHeight) return;
        Vector2 scrollOff = UnitGUI.groundScrollPosition;
        float   div       = 20.0f;
        float   y         = div + UnitGUI.groundY - scrollOff.y;
        float   mid       = UnitGUI.groundX + UnitGUI.groundWidth / 2.0f + scrollOff.x;

        //	mousePos.y += groundScrollPosition.y;
        selectedItem = null;
        if (mapGenerator != null)
        {
            List <Item> groundItems = mapGenerator.tiles[(int)u.position.x, (int)-u.position.y].getReachableItems();
            foreach (Item i in groundItems)
            {
                if (i.inventoryTexture == null)
                {
                    continue;
                }
                //	Debug.Log(mousePos.x + "  " + mousePos.y + "       " + mid + "  " + y);
                Vector2 size = i.getSize();
                float   x    = mid - size.x * inventoryCellSize / 2.0f;
                Rect    r    = new Rect(x, y, size.x * inventoryCellSize, size.y * UnitGUI.inventoryCellSize);
                if (r.Contains(mousePos))
                {
                    //	Debug.Log(i);
                    selectedCell = new Vector2((int)((mousePos.x - x) / inventoryCellSize), (int)((mousePos.y - y) / inventoryCellSize));
                    foreach (Vector2 cell in i.getShape())
                    {
                        if (cell.x == selectedCell.x && cell.y == selectedCell.y)
                        {
                            selectedItemPos       = new Vector2(x, y);
                            selectedMousePos      = mousePos;
                            selectedItem          = i;
                            selectedItemWasInSlot = InventorySlot.None;
                        }
                    }
                    Debug.Log(selectedCell);
                    if (selectedItem != null)
                    {
                        break;
                    }
                }
                y += size.y * UnitGUI.inventoryCellSize + div;
            }
        }
    }
Ejemplo n.º 11
0
    public void selectItem(Image overlayObject)
    {
        beforeItemStandards = (selectedUnit != null ? selectedUnit.getStandardTypes() : new StandardType[0]);
        InventoryItem ii = overlayObject.GetComponent <InventoryItem>();
        InventorySlot sl = ii.slot;
        Item          i  = null;

        Debug.Log(sl + ": " + overlayObjects.Count);
        if (sl == InventorySlot.None)
        {
            Debug.Log(overlayObjects.Count);
            InventoryItem iii = overlayObject.transform.parent.GetComponent <InventoryItem>();
            if (iii != null)
            {
                i = iii.item;
                if (currentLootTile != null)
                {
                    currentLootTile.removeItem(i, 0);
                }
                else if (currentStash != null)
                {
                    currentStash.removeItem(i);
                }
                originalSlot = sl;
                overlayObject.gameObject.SetActive(false);
                overlayObject.transform.parent.GetComponent <LayoutElement>().ignoreLayout = true;
                overlayObject.transform.parent.GetComponent <CanvasGroup>().blocksRaycasts = false;
                mouseHoverLeave(overlayObject);
                Invoke("resetLootScrollPos", 0.05f);
            }
        }
        else if (UnitGUI.armorSlots.Contains(sl))
        {
            i = selectedCharacter.characterSheet.characterLoadout.removeItemFromSlot(sl);
            getArmourParent(sl).transform.FindChild("Canvas").GetComponent <RectTransform>().sizeDelta        = new Vector2(64.0f, 64.0f);
            getArmourParent(sl).transform.FindChild("Canvas").GetComponent <RectTransform>().anchoredPosition = new Vector2(0.0f, 0.0f);
            originalSlot = sl;
        }
        else if (UnitGUI.inventorySlots.Contains(sl))
        {
            ItemReturn i2 = selectedCharacter.characterSheet.inventory.removeItemFromSlot(sl);
            i            = i2.item;
            originalSlot = UnitGUI.getInventorySlotFromIndex(UnitGUI.getIndexOfSlot(sl) - i2.slot);
        }
        else if (BaseManager.trapTurretInventorySlots.Contains(sl))
        {
            i = baseManager.removeTrapTurretInSlot(sl);            // selectedCharacter.characterSheet.characterLoadout.removeItemFromSlot(sl);
            getArmourParent(sl).transform.FindChild("Canvas").GetComponent <RectTransform>().sizeDelta        = new Vector2(64.0f, 64.0f);
            getArmourParent(sl).transform.FindChild("Canvas").GetComponent <RectTransform>().anchoredPosition = new Vector2(0.0f, 0.0f);
            originalSlot = sl;
            if (baseManager.turretFrame == null || baseManager.turretApplicator == null || baseManager.turretGear == null || baseManager.energySource == null)
            {
                removeTurret();
            }
            if (baseManager.trapFrame == null || baseManager.trapApplicator == null || baseManager.trapGear == null || baseManager.trigger == null)
            {
                removeTrap();
            }
            if (sl == InventorySlot.Turret)
            {
                //	originalSlot = InventorySlot.None;
                removeTurretSupplies();
                //	hideLoot = false;
            }
            else if (sl == InventorySlot.Trap)
            {
                //	originalSlot = InventorySlot.None;
                removeTrapSupplies();
                //	hideLoot = false;
            }
        }
        if (i == null)
        {
            return;
        }
        GameObject[] items = GameObject.FindGameObjectsWithTag("inventoryitem");
        foreach (GameObject item in items)
        {
            if (item.GetComponent <InventoryItem>().item == i)
            {
                selectedItem = item;
                item.transform.SetParent(inventoryBackground.transform);
                Vector3 pos = item.transform.position;
                pos.y = Screen.height - pos.y;
                Vector3 mousePos = Input.mousePosition;
                mousePos.y   = Screen.height - mousePos.y;
                selectedCell = new Vector2((int)((mousePos.x - pos.x) / 32.0f), (int)((mousePos.y - pos.y) / 32.0f));
                Vector2 closest     = selectedCell;
                float   closestDist = float.MaxValue;
                foreach (Vector2 v in i.getShape())
                {
                    float dist = Mathf.Abs(v.x - selectedCell.x) + Mathf.Abs(v.y - selectedCell.y);
                    if (dist < closestDist)
                    {
                        closestDist = dist;
                        closest     = v;
                    }
                    if (dist <= Mathf.Epsilon)
                    {
                        break;
                    }
                }
                mouseSelectPos.x += (selectedCell.x - closest.x) * 32.0f;
                mouseSelectPos.y += (selectedCell.y - closest.y) * 32.0f;
                selectedCell      = closest;
                break;
            }
        }
        setACText();
        setLootInteractable(false);
    }
Ejemplo n.º 12
0
 public override void Start()
 {
     returnCounter = returnCounterObj.GetComponent <ItemReturn>();
     referee       = refereeObj.GetComponent <Referee>();
     base.Start();
 }
Ejemplo n.º 13
0
        /// <summary>
        /// IAnalyzeItemインスタンス作成
        /// </summary>
        /// <param name="node">対象Node</param>
        /// <param name="semanticModel">対象ソースのsemanticModel</param>
        /// <param name="container">イベントコンテナ</param>
        /// <param name="parent">親IAnalyzeItemインスタンス(デフォルトはnull)</param>
        /// <returns>IAnalyzeItemインスタンス</returns>
        public static IAnalyzeItem Create(SyntaxNode node, SemanticModel semanticModel, EventContainer container, IAnalyzeItem parent = null)
        {
            IAnalyzeItem result = null;

            // nodeの種類によって取得メソッドを実行
            switch (node)
            {
            // クラス定義
            case ClassDeclarationSyntax targetNode:
                result = new ItemClass(targetNode, semanticModel, parent, container);
                break;

            // インターフェース
            case InterfaceDeclarationSyntax targetNode:
                result = new ItemInterface(targetNode, semanticModel, parent, container);
                break;

            // クラス要素定義
            case PropertyDeclarationSyntax targetNode:
                result = new ItemProperty(targetNode, semanticModel, parent, container);
                break;

            case FieldDeclarationSyntax targetNode:
                result = new ItemField(targetNode, semanticModel, parent, container);
                break;

            case MethodDeclarationSyntax targetNode:
                result = new ItemMethod(targetNode, semanticModel, parent, container);
                break;

            case ConstructorDeclarationSyntax targetNode:
                result = new ItemConstructor(targetNode, semanticModel, parent, container);
                break;

            case EnumDeclarationSyntax targetNode:
                result = new ItemEnum(targetNode, semanticModel, parent, container);
                break;

            // ラムダ式
            case ArrowExpressionClauseSyntax targetNode:
                if (parent is ItemProperty)
                {
                    result = new ItemAccessor(targetNode, semanticModel, parent, container);
                }
                else
                {
                    var op = semanticModel.GetOperation(targetNode).Children.First();
                    switch (op)
                    {
                    case Microsoft.CodeAnalysis.Operations.IReturnOperation operation:
                        result = new ItemReturn(op.Syntax, semanticModel, parent, container);
                        break;

                    case Microsoft.CodeAnalysis.Operations.IExpressionStatementOperation operation:
                        result = new ItemStatementExpression(op.Syntax, semanticModel, parent, container);
                        break;
                    }
                }
                break;

            // ローカル定義
            case LocalFunctionStatementSyntax targetNode:
                result = new ItemLocalFunction(targetNode, semanticModel, parent, container);
                break;

            case LocalDeclarationStatementSyntax targetNode:
                result = new ItemStatementLocalDeclaration(targetNode, semanticModel, parent, container);
                break;

            case ExpressionStatementSyntax targetNode:
                result = new ItemStatementExpression(targetNode, semanticModel, parent, container);
                break;

            case AccessorDeclarationSyntax targetNode:
                result = new ItemAccessor(targetNode, semanticModel, parent, container);
                break;

            // 分岐処理
            case IfStatementSyntax targetNode:
                result = new ItemIf(targetNode, semanticModel, parent, container);
                break;

            case ElseClauseSyntax targetNode:
                result = new ItemElseClause(targetNode, semanticModel, parent, container);
                break;

            case SwitchStatementSyntax targetNode:
                result = new ItemSwitch(targetNode, semanticModel, parent, container);
                break;

            case SwitchSectionSyntax targetNode:
                result = new ItemSwitchCase(targetNode, semanticModel, parent, container);
                break;

            // ループ処理
            case WhileStatementSyntax targetNode:
                result = new ItemWhile(targetNode, semanticModel, parent, container);
                break;

            case DoStatementSyntax targetNode:
                result = new ItemDo(targetNode, semanticModel, parent, container);
                break;

            case ForEachStatementSyntax targetNode:
                result = new ItemForEach(targetNode, semanticModel, parent, container);
                break;

            case ForStatementSyntax targetNode:
                result = new ItemFor(targetNode, semanticModel, parent, container);
                break;

            // その他
            case ReturnStatementSyntax targetNode:
                result = new ItemReturn(targetNode, semanticModel, parent, container);
                break;

            case BreakStatementSyntax targetNode:
                result = new ItemBreak(targetNode, semanticModel, parent, container);
                break;

            case ContinueStatementSyntax targetNode:
                result = new ItemContinue(targetNode, semanticModel, parent, container);
                break;
            }

            return(result);
        }
Ejemplo n.º 14
0
 public void ShowObject(object keyValue)
 {
     itemReturn                     = new ItemReturn();
     itemReturn.ReturnNo            = InventoryHelper.GetNextReturnNo();
     returnBindingSource.DataSource = itemReturn;
 }