Пример #1
0
        /*
        public void Test()
        {
            loadKeyTable(getSheet());

            foreach (DictionaryEntry kv in keyTable_)
            {
                Console.WriteLine(kv.Key + ":" + kv.Value);
            }
        }
        */
        public List<OrderData> CreateList()
        {
            List<OrderData> ret = new List<OrderData>();

            Microsoft.Office.Interop.Excel.Worksheet sheet = getSheet();
            //loadKeyTable(sheet);

            int index = 4;
            while (true)
            {
                Microsoft.Office.Interop.Excel.Range rgn = sheet.Cells[index, 1];
                dynamic val = rgn.Value2;
                string tmp = Convert.ToString(val);
                if (tmp == null)
                {
                    break;
                }

                OrderData data = new OrderData();

                rgn = sheet.Cells[index, ColumnIndex.SEASON_COLUMN];
                val = rgn.Value2;
                data.season_ = Convert.ToString(val);

                rgn = sheet.Cells[index, ColumnIndex.MARKET_COLUMN];
                val = rgn.Value2;
                data.market_ = Convert.ToString(val);

                rgn = sheet.Cells[index, ColumnIndex.REFERENCE_COLUMN];
                val = rgn.Value2;
                data.reference_ = Convert.ToString(val);

                rgn = sheet.Cells[index, ColumnIndex.REFERENCE_NAME_COLUMN];
                val = rgn.Value2;
                data.referenceName_ = Convert.ToString(val);

                rgn = sheet.Cells[index, ColumnIndex.COLOR_CODE_COLUMN];
                val = rgn.Value2;
                data.colorCode_ = Convert.ToString(val);

                rgn = sheet.Cells[index, ColumnIndex.COLOR_COLUMN];
                val = rgn.Value2;
                data.color_ = Convert.ToString(val);

                rgn = sheet.Cells[index, ColumnIndex.SIZE_COLUMN];
                val = rgn.Value2;
                data.size_ = Convert.ToString(val);

                rgn = sheet.Cells[index, ColumnIndex.PRICE_COLUMN];
                val = rgn.Value2;
                data.price_ = Convert.ToInt32(val);

                rgn = sheet.Cells[index, ColumnIndex.QTY_COLUMN];
                val = rgn.Value2;
                data.qty_ = Convert.ToInt32(val);

                rgn = sheet.Cells[index, ColumnIndex.NOTE_COLUMN];
                val = rgn.Value2;
                data.note_ = Convert.ToString(val);

                ret.Add(data);
                index++;
            }
            return ret;
        }
Пример #2
0
        /*
         * public void Test()
         * {
         *  loadKeyTable(getSheet());
         *
         *  foreach (DictionaryEntry kv in keyTable_)
         *  {
         *      Console.WriteLine(kv.Key + ":" + kv.Value);
         *  }
         * }
         */

        public List <OrderData> CreateList()
        {
            List <OrderData> ret = new List <OrderData>();

            Microsoft.Office.Interop.Excel.Worksheet sheet = getSheet();
            //loadKeyTable(sheet);

            int index = 4;

            while (true)
            {
                Microsoft.Office.Interop.Excel.Range rgn = sheet.Cells[index, 1];
                dynamic val = rgn.Value2;
                string  tmp = Convert.ToString(val);
                if (tmp == null)
                {
                    break;
                }

                OrderData data = new OrderData();

                rgn          = sheet.Cells[index, ColumnIndex.SEASON_COLUMN];
                val          = rgn.Value2;
                data.season_ = Convert.ToString(val);

                rgn          = sheet.Cells[index, ColumnIndex.MARKET_COLUMN];
                val          = rgn.Value2;
                data.market_ = Convert.ToString(val);

                rgn             = sheet.Cells[index, ColumnIndex.REFERENCE_COLUMN];
                val             = rgn.Value2;
                data.reference_ = Convert.ToString(val);

                rgn = sheet.Cells[index, ColumnIndex.REFERENCE_NAME_COLUMN];
                val = rgn.Value2;
                data.referenceName_ = Convert.ToString(val);

                rgn             = sheet.Cells[index, ColumnIndex.COLOR_CODE_COLUMN];
                val             = rgn.Value2;
                data.colorCode_ = Convert.ToString(val);

                rgn         = sheet.Cells[index, ColumnIndex.COLOR_COLUMN];
                val         = rgn.Value2;
                data.color_ = Convert.ToString(val);

                rgn        = sheet.Cells[index, ColumnIndex.SIZE_COLUMN];
                val        = rgn.Value2;
                data.size_ = Convert.ToString(val);

                rgn         = sheet.Cells[index, ColumnIndex.PRICE_COLUMN];
                val         = rgn.Value2;
                data.price_ = Convert.ToInt32(val);

                rgn       = sheet.Cells[index, ColumnIndex.QTY_COLUMN];
                val       = rgn.Value2;
                data.qty_ = Convert.ToInt32(val);

                rgn        = sheet.Cells[index, ColumnIndex.NOTE_COLUMN];
                val        = rgn.Value2;
                data.note_ = Convert.ToString(val);

                ret.Add(data);
                index++;
            }
            return(ret);
        }