예제 #1
0
        protected override int _SetLineCore(int nItemPos, int nRowNumX, Worksheet ws, ArrayList ItemKeys, ArrayList arrItems, ArrayList arrNowNames, ArrayList arrNowValues, ArrayList arrNowSigns, int nRowNowNumY, long ReportTypeID)
        {
            tddTableManage tddMan = new tddTableManage();

            if (nItemPos == ItemKeys.Count - 1)
            {
                double maxScore = 0; // 最高分
                double minScore = 0; // 最低分
                double sumScore = 0; // 所有人的总分
                double aveScore = 0; //平均分
                Expression <Func <T_tdd, bool> > where = GetAndLambdaExpression <T_tdd>(arrNowNames, arrNowValues, arrNowSigns);
                int          count = tddMan.GetRecordCount(where);
                List <T_tdd> list  = tddMan.GetRecord(where);
                clsExcelApp.SetCellValue(ws, nRowNumX, 1, nRowNumX - 3);    //序号
                clsExcelApp.SetCellValue(ws, nRowNumX, nRowNowNumY, count); //录取人数
                if (list != null && list.Count > 0)
                {
                    minScore = maxScore = list[0].Tzcj;
                    foreach (T_tdd l in list)
                    {
                        if (l.Tzcj < minScore)
                        {
                            minScore = l.Tzcj;
                        }
                        if (l.Tzcj > maxScore)
                        {
                            maxScore = l.Tzcj;
                        }
                        sumScore += l.Tzcj;
                    }
                    aveScore = sumScore / count;
                }

                clsExcelApp.SetCellValue(ws, nRowNumX, nRowNowNumY + 1, maxScore); //最高分
                clsExcelApp.SetCellValue(ws, nRowNumX, nRowNowNumY + 2, minScore); //最低分
                clsExcelApp.SetCellValue(ws, nRowNumX, nRowNowNumY + 3, aveScore); //平均分

                nRowNumX++;
                if (nItemPos == 0)
                {
                    nUnitRow1 = nRowNumX;
                }
                else if (nItemPos == 1)
                {
                    nUnitRow2 = nRowNumX;
                }
                else if (nItemPos == 2)
                {
                    nUnitRow3 = nRowNumX;
                }
            }
            else
            {
                nRowNumX = DFSSetLine(nItemPos + 1, nRowNumX, nRowNowNumY, ws, ItemKeys, arrItems, arrNowNames, arrNowValues, arrNowSigns, ReportTypeID);
            }

            UnitCellCore(nItemPos, nRowNumX, ws, ItemKeys);
            return(nRowNumX);
        }
예제 #2
0
        //protected override void SetLines(Worksheet ws, string sSelItems, string sSelTypeIDs, long lGxID, int nStartYear, int nEndYear)
        //{
        //    ArrayList arrNames = new ArrayList(); ArrayList arrValues = new ArrayList(); ArrayList arrSigns = new ArrayList();
        //    arrNames.Add("bmk.DelFlag"); arrValues.Add(false); arrSigns.Add(SIGN.Equal);
        //    arrNames.Add("bmk.YearCode"); arrValues.Add(nStartYear); arrSigns.Add(SIGN.GreaterThanOrEqual);
        //    arrNames.Add("bmk.YearCode"); arrValues.Add(nEndYear); arrSigns.Add(SIGN.LessThanOrEqual);
        //    arrNames.Add("bmk.GxID"); arrValues.Add(lGxID); arrSigns.Add(SIGN.Equal);

        //    int nItemPos;
        //    int nRowNumX;
        //    int nRowNumY;
        //    ArrayList ItemKeys;
        //    ArrayList arrItems;
        //    SetLinesPre(ws, sSelItems, sSelTypeIDs, out nItemPos, out nRowNumX, out nRowNumY, out ItemKeys, out arrItems);

        //    var tempMan = new tddTableManage();
        //    _DFSSetLine(nItemPos, nRowNumX, nRowNumY, ws, ItemKeys, arrItems, arrNames, arrValues, arrSigns, tempMan);
        //}

        //protected override int _DFSSetLine(int nItemPos, int nRowNumX, int nRowNumY, Worksheet ws, ArrayList ItemKeys, ArrayList arrItems, ArrayList arrNames, ArrayList arrValues, ArrayList arrSigns, object tempMan)
        //{
        //    return _DFSSetLine1(nItemPos, nRowNumX, nRowNumY, ws, ItemKeys, arrItems, arrNames, arrValues, arrSigns,tempMan);
        //}

        protected override int _SetLineCore(int nItemPos, int nRowNumX, Worksheet ws, ArrayList ItemKeys, ArrayList arrItems, ArrayList arrNowNames, ArrayList arrNowValues, ArrayList arrNowSigns, int nRowNowNumY, long ReportTypeID)
        {
            tddTableManage  tddMan = new tddTableManage();
            dqdmTableManage dqMan  = new dqdmTableManage();

            Expression <Func <T_tdd, bool> > where = GetAndLambdaExpression <T_tdd>(arrNowNames, arrNowValues, arrNowSigns);
            List <T_tdd> listModels = tddMan.GetRecord(where);

            string[] arr = new string[listModels.Count];
            if (listModels.Count > 0)
            {
                for (int i = 0; i < listModels.Count; i++)
                {
                    if (listModels[i].bmk.dq != null)
                    {
                        string cityCode = listModels[i].bmk.dq.Code.Substring(0, 4) + "00";//获得市的行政代码
                        arr[i] = cityCode;
                    }
                }
                var list = from a in arr
                           group a by a into G
                           orderby G.Key
                           select new
                {
                    sCode = G.Key,
                    count = G.Count()
                };
                foreach (var l in list)
                {
                    nRowNowNumY = 3;
                    string cityName = dqMan.GetNowNamefromCode(l.sCode);
                    clsExcelApp.SetCellValue(ws, nRowNumX, 1, nRowNumX - 3); //序号
                    clsExcelApp.SetCellValue(ws, nRowNumX, nRowNowNumY, cityName); nRowNowNumY++;
                    clsExcelApp.SetCellValue(ws, nRowNumX, nRowNowNumY, l.count);
                    nRowNumX++;
                }
                nRowNumX--;
            }
            else
            {
                clsExcelApp.SetCellValue(ws, nRowNumX, nRowNowNumY, "无"); nRowNowNumY++;
                clsExcelApp.SetCellValue(ws, nRowNumX, nRowNowNumY, 0); nRowNowNumY++;
            }
            nRowNumX++;

            clsExcelApp.UniteCells(ws, nUnitRow1, 2, nRowNumX - 1, 2);

            //if (nItemPos == 0)
            nUnitRow1 = nRowNumX;
            //else if (nItemPos == 1)
            //    nUnitRow2 = nRowNumX;
            //else if (nItemPos == 2)
            //    nUnitRow3 = nRowNumX;

            //UnitCellCore(nItemPos, nRowNumX, ws, ItemKeys);
            return(nRowNumX);
        }