コード例 #1
0
        public IEnumerable <itemDetails> GetItemDetails()
        {
            string fileName = String.Format(@"C:\Users\ska338\react-redux-starter\files\Student.xlsx");
            var    genList  = new List <itemDetails>();

            using (SpreadsheetDocument spreadSheetDocument = SpreadsheetDocument.Open(fileName, false))
            {
                WorkbookPart        workbookPart = spreadSheetDocument.WorkbookPart;
                IEnumerable <Sheet> sheets       = spreadSheetDocument.WorkbookPart.Workbook.GetFirstChild <Sheets>().Elements <Sheet>();
                string            relationshipId = sheets.First().Id.Value;
                WorksheetPart     worksheetPart  = (WorksheetPart)spreadSheetDocument.WorkbookPart.GetPartById(relationshipId);
                Worksheet         workSheet      = worksheetPart.Worksheet;
                SheetData         sheetData      = workSheet.GetFirstChild <SheetData>();
                IEnumerable <Row> rows           = sheetData.Descendants <Row>();
                var i = 0;

                foreach (Row row in rows)
                {
                    if (i != 0 && row != null)
                    {
                        List <Cell> cells       = row.Descendants <Cell>().ToList();
                        var         itemDetails = new itemDetails();
                        itemDetails.toothNumber = Convert.ToInt32(cells[0].InnerText.ToString());
                        itemDetails.itemCode    = cells[1].InnerText.ToString();
                        itemDetails.price       = Convert.ToDecimal(cells[2].InnerText.ToString());
                        genList.Add(itemDetails);
                    }
                    i++;
                }
            }
            return(genList);
        }
コード例 #2
0
    private void SetUpShop(Collision col)
    {
        //find object in children
        itemDetails iD = col.gameObject.GetComponentInChildren <itemDetails>();

        costOfItems += iD.itemValue;
        moneyObject.SetActive(true);
        showPrice.SetText("Price:\n\n{0}", costOfItems);
        moneyObject.transform.position = payOutLocation.transform.position;
        stuffToSell.Add(col.gameObject);
    }
コード例 #3
0
    private void OnCollisionExit(Collision collision)
    {
        if (collision.gameObject.tag == purchaseTagString)
        {
            stuffToSell.Remove(collision.gameObject);
            itemDetails iD = collision.gameObject.GetComponentInChildren <itemDetails>();
            costOfItems -= iD.itemValue;
            showPrice.SetText("Price:\n\n{0}", costOfItems);
        }

        if (stuffToSell.Count == 0)
        {
            moneyObject.SetActive(false);
        }
    }