public void Test_GroupBySourcingGuide_BrokenBulkPack()
        {
            // Build the item dictionary
            var itemData1 = new ItemData()
            {
                MPN = "123456",
                SourcingGuideline = "Branch",
                BulkPack          = true,
                BulkPackQuantity  = 10
            };

            itemController.items.ItemDict.Add(itemData1.MPN, itemData1);

            // Create a list of items to imitate the items on an incoming order
            var item1 = new Item()
            {
                masterProdId = "123456",
                quantity     = "15"
            };
            var itemRes1 = new ItemRes(item1);

            var allLines = sourcingController.GroupBySourcingGuide(new List <ItemRes>()
            {
                itemRes1
            });

            var itemLine1 = allLines.lineDict["DC"].FirstOrDefault(i => i.MasterProductNumber == itemData1.MPN);

            Assert.Equal(15, itemLine1.Quantity);
        }
        public void Test_GroupBySourcingGuide()
        {
            // Build the item dictionary
            var itemData1 = new ItemData()
            {
                SourcingGuideline = "DC",
                MPN = "123456"
            };

            var itemData2 = new ItemData()
            {
                MPN = "789654",
                SourcingGuideline = "FEI"
            };

            itemController.items.ItemDict.Add(itemData1.MPN, itemData1);
            itemController.items.ItemDict.Add(itemData2.MPN, itemData2);

            // Create a list of items to imitate the items on an incoming order
            var item1 = new Item()
            {
                masterProdId = "123456",
                quantity     = "6"
            };

            var item2 = new Item()
            {
                masterProdId = "789654",
                quantity     = "9"
            };
            var itemRes1 = new ItemRes(item1);
            var itemRes2 = new ItemRes(item2);

            var allLines = sourcingController.GroupBySourcingGuide(new List <ItemRes>()
            {
                itemRes1, itemRes2
            });

            var itemLine1 = allLines.lineDict[itemData1.SourcingGuideline].FirstOrDefault(i => i.MasterProductNumber == itemData1.MPN);
            var itemLine2 = allLines.lineDict[itemData2.SourcingGuideline].FirstOrDefault(i => i.MasterProductNumber == itemData2.MPN);

            Assert.Equal(6, itemLine1.Quantity);
            Assert.Equal(9, itemLine2.Quantity);
        }
        public async Task SetItemShippingValues(ItemRes item, string mpn)
        {
            try
            {
                item.preferredShippingMethod = items.ItemDict[mpn].PreferredShippingMethod;

                var shippingController = new ShippingController(_logger, this);

                var shipViaTask = shippingController.GetItemPreferredShipVia(item.preferredShippingMethod, item.masterProdId, int.Parse(item.quantity));
                item.preferredShipVia = await shipViaTask;
            }
            catch (Exception ex)
            {
                var title        = $"Error in SetShippingValues for MPN {item.masterProdId}";
                var text         = $"Error message: {ex.Message}. Stacktrace: {ex.StackTrace}";
                var teamsMessage = new TeamsMessage(title, text, "yellow", SourcingEngineFunctions.errorLogsUrl);
                teamsMessage.LogToTeams(teamsMessage);
                _logger.LogError(ex, title);
            }
        }
Beispiel #4
0
 public void AllLoadItemGoRes(ItemRes.eRES_GO eImgType)
 {
     foreach (var item in m_ItemList)
     {
         item.Value.LoadGoRes(eImgType);
     }
 }
Beispiel #5
0
 public void AllLoadItemTexRes(ItemRes.eRES_TEX eImgType)
 {
     foreach (var item in m_ItemList)
     {
         item.Value.LoadTexRes(eImgType);
     }
 }
Beispiel #6
0
    public bool LoadGoRes(ItemRes.eRES_GO eType)
    {
        string strPath = GetGoResPath(eType);
        if (null == strPath)
            return false;

        return ItemRes.LoadGameObject(eType, strPath);
    }
Beispiel #7
0
    // Load
    public bool LoadTexRes(ItemRes.eRES_TEX eType )
    {
        string strPath = GetTexResPath( eType );
        if (null == strPath)                   
            return false;                  

        return ItemRes.LoadTexture(eType, strPath);        
    }
Beispiel #8
0
    public string GetGoResPath(ItemRes.eRES_GO eType)
    {
        switch (eType)
        {
			 case ItemRes.eRES_GO.ICON:
                return ItemData.GetIcon();	
			
            case ItemRes.eRES_GO.DROP:
                return ItemData.GetDropItem();
			
            case ItemRes.eRES_GO.PARTS_W:
                return ItemData.GetPartsItem_W();
			
			case ItemRes.eRES_GO.PARTS_M:
                return ItemData.GetPartsItem_M();
        }
        return null;
    }
Beispiel #9
0
    public string GetTexResPath(ItemRes.eRES_TEX eType)
    {
        switch (eType)
        {
        case ItemRes.eRES_TEX.DIFF_W:			
			return ItemData.GetPartsItemDiff_W();
		case ItemRes.eRES_TEX.DIFF_M:
			return ItemData.GetPartsItemDiff_M();
		}

        return null;
    }
Beispiel #10
0
    public Texture GetTexture(ItemRes.eRES_TEX eType)
    {
        string strPath = GetTexResPath(eType);
        if (null == strPath)
            return null;

        Texture tex = ItemRes.GetTexture(eType);
        if (null == tex)
        {
            if (false == ItemRes.LoadTexture(eType, strPath))
                return null;
        }

        return ItemRes.GetTexture(eType);
    }
Beispiel #11
0
    public GameObject GetGameObject(ItemRes.eRES_GO eType)
    {
        string strPath = GetGoResPath(eType);
        if (null == strPath)
            return null;

        GameObject go = ItemRes.GetGameObject(eType);
        if (null == go)
        {
            if (false == ItemRes.LoadGameObject(eType, strPath))
                return null;
        }

        return ItemRes.GetGameObject(eType);
    }
Beispiel #12
0
    public Item(BinaryReader br)
	{
        m_ItemData = new ItemData( br);
#if USE_ITEM_RES
        m_ItemRes = new ItemRes();
#endif
	}
Beispiel #13
0
	//---------------------------------------------------------------------
	/* functon */
	//---------------------------------------------------------------------

    
    public Item(XmlElement _element)
    {
        m_ItemData = new ItemData(_element);
#if USE_ITEM_RES
        m_ItemRes = new ItemRes();
#endif
    }