コード例 #1
0
        public bool IsEqual(CSmartArray array)
        {
            Dictionary <ProductTag, int> map = array.GetMap();
            int count = m_TagMap.Count;

            if (count != map.Count)
            {
                return(false);
            }

            var en = m_TagMap.Keys.GetEnumerator();

            en.MoveNext();
            for (int i = 0; i < count; i++)
            {
                ProductTag pTag     = en.Current;
                int        TagCount = array.GetTagCount(pTag);
                if (TagCount == 0)
                {
                    return(false);
                }
                if (TagCount != GetTagCount(pTag))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
        public void ExportForExcel(Worksheet pSheet)
        {
            int factByLine = 4;
            int currRow    = 2;
            int currColumn = 2;
            int maxColumn  = 0;

            for (int i = 0; i < m_pFactoryList.Count; i++)
            {
                CFactory pFact = m_pFactoryList[i];
                CExportFactoryResultHelper helper = new CExportFactoryResultHelper(pSheet, pFact, currRow, currColumn);
                currColumn += (helper.GetWidht() + 0);
                maxColumn   = Math.Max(maxColumn, currColumn);
                if ((i + 1) % factByLine == 0)
                {
                    currRow   += (helper.GetHeight() + 1);
                    currColumn = 2;
                }
            }

            Dictionary <ProductTag, int> map = m_array.GetMap();

            Dictionary <ProductTag, int> .KeyCollection.Enumerator e = map.Keys.GetEnumerator();
            int startRow = 3;

            //maxColumn += 3;
            Utils.WriteHeader(pSheet, startRow, maxColumn);

            startRow++;
            int count = map.Keys.Count;

            for (int i = 0; i < count; i++)
            {
                e.MoveNext();
                ProductTag tag   = e.Current;
                string     name  = m_spisok.GetName(tag);
                int        value = map[tag];
                pSheet.Cells[startRow + i + 1, maxColumn]     = name;
                pSheet.Cells[startRow + i + 1, maxColumn + 1] = value;
            }

            Range pRange = pSheet.Range[pSheet.Cells[startRow, maxColumn], pSheet.Cells[startRow + count, maxColumn + 3]];

            for (int i = (int)XlBordersIndex.xlEdgeLeft; i <= (int)XlBordersIndex.xlInsideHorizontal; i++)
            {
                pRange.Borders[(XlBordersIndex)i].LineStyle = XlLineStyle.xlContinuous;
            }
        }
コード例 #3
0
        public CSimpleFactoryExport(Worksheet pSheet, List <CFactory> pList, CSmartArray array)
        {
            int row = 1;

            for (int i = 0; i < pList.Count; i++)
            {
                CFactory pFactory = pList[i];
                if (!pFactory.IsEmpty())
                {
                    Range pRange = pSheet.Range[pSheet.Cells[row, 1], pSheet.Cells[row, 2]];
                    pRange.Merge();
                    pRange.Value = pList[i].GetFactName();
                    row++;
                }
                ExportFactory(pSheet, pFactory, ref row);
            }

            Dictionary <ProductTag, int> map = array.GetMap();

            Dictionary <ProductTag, int> .KeyCollection.Enumerator e = map.Keys.GetEnumerator();
            int count = map.Keys.Count;

            pSheet.Range[pSheet.Cells[row, 1], pSheet.Cells[row, 2]].Merge();
            pSheet.Range[pSheet.Cells[row, 1], pSheet.Cells[row, 2]] = "Вырастить на поле";
            row++;
            for (int i = 0; i < count; i++)
            {
                e.MoveNext();
                ProductTag tag   = e.Current;
                string     name  = m_spisok.GetName(tag);
                int        value = map[tag];
                pSheet.Cells[row, 1] = name;
                pSheet.Cells[row, 2] = value;
                row++;
            }

            Range FullRange = pSheet.Range[pSheet.Cells[1, 1], pSheet.Cells[row - 1, 2]];

            for (int i = (int)XlBordersIndex.xlEdgeLeft; i <= (int)XlBordersIndex.xlInsideHorizontal; i++)
            {
                FullRange.Borders[(XlBordersIndex)i].LineStyle = XlLineStyle.xlContinuous;
            }
            pSheet.Columns[1].AutoFit();
        }
コード例 #4
0
        public CAllSourceWrite(Worksheet pSheet, CSmartArray array)
        {
            Dictionary <ProductTag, int> map = array.GetMap();

            Dictionary <ProductTag, int> .KeyCollection.Enumerator e = map.Keys.GetEnumerator();
            const int startRow    = 3;
            const int startColumn = 10;

            Utils.WriteHeader(pSheet, startRow, startColumn);

            int count = map.Keys.Count;

            for (int i = 0; i < count; i++)
            {
                e.MoveNext();
                ProductTag tag   = e.Current;
                string     name  = m_spisok.GetName(tag);
                int        value = map[tag];
                Utils.WriteTagString(pSheet, startRow + i, startColumn, name, value);
            }
        }