コード例 #1
0
        /// <summary>
        /// Y视图
        /// </summary>
        /// <param name="reviewCnt"></param>
        /// <returns></returns>
        protected virtual List <Dictionary <int, string> > getNoDispCars(int reviewCnt)
        {
            InitBase();

            List <Dictionary <int, string> > ret = new List <Dictionary <int, string> >();
            int    lastId    = data.Count - 1;
            string RestModel = this.AllNumModel;// "01,02,03,04,05,06,07,08,09,10,11,12,。。。。。。";

            for (int i = 0; i < Math.Min(reviewCnt, data.Count); i++)
            {
                Combin_ExpectData currExpect = new Combin_ExpectData();
                currExpect.Expect   = data[lastId - i].Expect;//  data[lastId - i].CopyTo<ExpectData>();
                currExpect.OpenCode = data[lastId - i].OpenCode;
                currExpect.OpenTime = data[lastId - i].OpenTime;
                Dictionary <int, string> lastData = null;
                Dictionary <int, string> newData  = new Dictionary <int, string>();
                if (i > 0)
                {
                    lastData = ret[i - 1];
                }
                for (int j = 0; j < SelectNums; j++) //从选择的数字中寻找出现的数字
                {
                    string LastString = RestModel;
                    if (lastData != null)
                    {
                        LastString = lastData[j];//取得最后一次的字符串
                    }
                    else
                    {
                    }
                    //string intmatch = (j + 1).ToString().PadLeft(2,'0');//要匹配的数字
                    ////if(intmatch == "10")
                    ////{
                    ////    intmatch = "0";
                    ////}
                    string currval = currExpect.ValueList[j].PadLeft(2, '0');
                    //LastString = LastString.Replace(currExpect.ValueList[j], "");//总数字大于10的必须以符号分割,否则 101112,这种会出现错误,替换01时会影响到10,11.
                    //////for(int c=0;c<currExpect.ValueList.Length;c++)
                    //////{
                    //////    if(currExpect.ValueList[c].PadLeft(2,'0') == intmatch)
                    //////    {
                    //////        currval = currExpect.ValueList[c].PadLeft(2, '0');
                    //////        break;
                    //////    }
                    //////}
                    if (currval != null)//匹配到才替换
                    {
                        //01,02,03,04,05....10,11,12,第一个替换01, 后面的替换 ,12
                        string replacestr = currval;
                        LastString = LastString.Replace(replacestr, "");
                        if (LastString.StartsWith(","))
                        {
                            LastString = LastString.Substring(1);
                        }
                        if (LastString.EndsWith(","))
                        {
                            LastString = LastString.Substring(0, LastString.Length - 1);
                        }
                        LastString = LastString.Replace(splitor + splitor, splitor);
                    }
                    newData.Add(j, LastString);
                }
                ret.Add(newData);
            }
            List <Dictionary <int, string> > reSortRet = new List <Dictionary <int, string> >();

            for (int i = 0; i < SelectNums; i++)
            {
                Dictionary <int, string> tmp = new Dictionary <int, string>();
                for (int j = 0; j < ret.Count; j++)
                {
                    tmp.Add(j, ret[j][i]);
                }
                reSortRet.Add(tmp);
            }

            return(reSortRet);
        }
コード例 #2
0
        //X视图
        public override List <Dictionary <int, string> > getNoDispNums(int reviewCnt)
        {
            InitBase();
            List <Dictionary <int, string> > ret = new List <Dictionary <int, string> >();
            int    lastId    = data.Count - 1;
            string RestModel = this.SelectNumModel;// "1234567890";

            for (int i = 0; i < Math.Min(reviewCnt, data.Count); i++)
            {
                Combin_ExpectData currExpect = new Combin_ExpectData();
                currExpect.OpenCode = data[lastId - i].OpenCode;
                Dictionary <int, string> lastData = null;
                Dictionary <int, string> newData  = new Dictionary <int, string>();
                if (i > 0)
                {
                    lastData = ret[i - 1];
                }
                for (int j = 0; j < AllNums; j++)//选出的号
                {
                    string LastString = RestModel;
                    if (lastData != null)
                    {
                        LastString = lastData[j];//取得最后一次的字符串
                    }
                    string currval = null;
                    for (int c = 0; c < currExpect.ValueList.Length; c++)
                    {
                        if (int.Parse(currExpect.ValueList[c]) == j + 1)
                        {
                            currval = (c + 1).ToString().PadLeft(2, '0');
                        }
                    }
                    ////string intmatch = (j + 1).ToString();//要匹配的数字
                    ////if (intmatch == "10")
                    ////{
                    ////    intmatch = "0";
                    ////}
                    ////string currval = null;
                    //////LastString = LastString.Replace(currExpect.ValueList[j], "");//总数字大于10的必须以符号分割,否则 101112,这种会出现错误,替换01时会影响到10,11.
                    ////if (currExpect.ValueList.ToList().Contains(intmatch.ToString()))
                    ////{
                    ////    currval = (j + 1).ToString().PadLeft(2, '0');
                    ////}

                    if (currval != null)//匹配到才替换
                    {
                        //01,02,03,04,05....10,11,12,第一个替换01, 后面的替换 ,12
                        LastString = LastString.Replace(currval, "");
                        if (LastString.StartsWith(","))
                        {
                            LastString = LastString.Substring(1);
                        }
                        if (LastString.EndsWith(","))
                        {
                            LastString = LastString.Substring(0, LastString.Length - 1);
                        }
                        LastString = LastString.Replace(splitor + splitor, splitor);
                    }
                    newData.Add(j, LastString);
                }
                ret.Add(newData);
            }
            List <Dictionary <int, string> > reSortRet = new List <Dictionary <int, string> >();

            for (int i = 0; i < AllNums; i++)
            {
                Dictionary <int, string> tmp = new Dictionary <int, string>();
                for (int j = 0; j < ret.Count; j++)
                {
                    tmp.Add(j, ret[j][i]);
                }
                reSortRet.Add(tmp);
            }

            return(reSortRet);
        }