Esempio n. 1
0
        public ActionResult NetbuyPage(string date, int col = 0, int odcol = 0, NetbuyMode mode = 0, int index = 1)
        {
            Expression <Func <t_foam, bool> > expression = d => true;

            if (date.IsDateTime())
            {
                return(NetbuyAsynByDate(date, col, odcol, mode, index, true, ""));
            }
            return(NetbuyAsynByCodeOrName(date, col, odcol, mode, index, true, ""));
        }
Esempio n. 2
0
        public ActionResult NetbuyOnsPage(string date, string daytype, int col = 0, int odcol = 0, NetbuyMode mode = 0, int index = 1)
        {
            IEnumerable <t_foam> t_foams = new List <t_foam>();
            Expression <Func <t_foam, bool> > expression = d => true;

            if (String.IsNullOrEmpty(date))
            {
                return(NetbuyAsynByDate(Today, col, odcol, mode, index, true, daytype, true));
            }
            return(NetbuyAsynByCodeOrName(date, col, odcol, mode, index, true, daytype, true));
        }
Esempio n. 3
0
        public ActionResult NetbuyAsynByDate(string date, int col, int odcol, NetbuyMode mode, int index, bool isPage, string daytype, bool isOns = false)
        {
            Expression <Func <t_foam, bool> > expression = d => d.Date.CompareTo(date) == 0;

            switch (mode)
            {
            case NetbuyMode.只看上涨:
                expression = expression.And(d => d.Change >= 0m);
                break;

            case NetbuyMode.只看下跌:
                expression = expression.And(d => d.Change < 0m);
                break;

            case NetbuyMode.只看净买:
                expression = expression.And(d => d.Netbuy >= 0m);
                break;

            case NetbuyMode.只看净卖:
                expression = expression.And(d => d.Netbuy < 0m);
                break;

            case NetbuyMode.主力洗筹初期:
                expression = expression.And(d => d.State == ForceState.XI);
                break;

            case NetbuyMode.主力大互盘:
                expression = expression.And(d => d.State == ForceState.HU);
                break;

            case NetbuyMode.主力洗筹末期:
                expression = expression.And(d => d.State == ForceState.xi);
                break;

            case NetbuyMode.主力小互盘:
                expression = expression.And(d => d.State == ForceState.hu);
                break;

            case NetbuyMode.主力大砸盘:
                expression = expression.And(d => d.State == ForceState.ZA);
                break;

            case NetbuyMode.主力拉伸末期:
                expression = expression.And(d => d.State == ForceState.LA);
                break;

            case NetbuyMode.主力小砸盘:
                expression = expression.And(d => d.State == ForceState.za);
                break;

            case NetbuyMode.主力拉伸初期:
                expression = expression.And(d => d.State == ForceState.la);
                break;

            case NetbuyMode.昨日上涨:
            case NetbuyMode.昨日下跌:
            case NetbuyMode.昨日净买:
            case NetbuyMode.昨日净卖:
            case NetbuyMode.昨日主力洗筹初期:
            case NetbuyMode.昨日主力大互盘:
            case NetbuyMode.昨日主力洗筹末期:
            case NetbuyMode.昨日主力小互盘:
            case NetbuyMode.昨日主力大砸盘:
            case NetbuyMode.昨日主力拉伸末期:
            case NetbuyMode.昨日主力小砸盘:
            case NetbuyMode.昨日主力拉伸初期:
                return(GetYestodayNetbuyList(date, col, odcol, mode, index, isPage, isOns));

            default:
                break;
            }

            Expression <Func <t_foam, decimal?> > odby = d => d.State == ForceState.XI ? 2 : (d.State == ForceState.la ? 1 : 0);

            switch (col)
            {
            case 1:
                odby = d => d.Netbuy;
                break;

            case 2:
                odby = d => d.Change;
                break;

            case 3:
                odby = d => d.Ltotal;
                break;

            case 4:
                //odby = d => d.Foam;
                break;

            case 5:
                odby = d => d.Num;
                break;

            default:
                break;
            }

            var samples = GetSamples(date, daytype, isOns);//isOns ? OnsSamples(date, daytype) : SetSamplesByDate(date);

            IEnumerable <t_foam> t_foams = db.FoamList.Where(expression).ConvertAll(d => samples.ContainsKey(d.Code) ? d.SetNum(samples[d.Code]) : d);

            if (isPage || index > 1)
            {
                ViewData["odcol"] = odcol;

                if (col == odcol)
                {
                    t_foams = t_foams.AsQueryable().OrderBy(odby);
                }
                else
                {
                    t_foams = t_foams.AsQueryable().OrderByDescending(odby);
                }
            }
            else
            {
                if (col == odcol)
                {
                    ViewData["odcol"] = 0;
                    t_foams           = t_foams.AsQueryable().OrderByDescending(odby);
                }
                else
                {
                    ViewData["odcol"] = col;
                    t_foams           = t_foams.AsQueryable().OrderBy(odby);
                }
            }

            var pd = t_foams.ToPagedList(index, pageSize);

            return(View(isOns ? "NetbuyOns" : "Netbuy", pd));
        }
Esempio n. 4
0
        public ActionResult NetbuyAsynByCodeOrName(string date, int col, int odcol, NetbuyMode mode, int index, bool isPage, string daytype, bool isOns = false)
        {
            Expression <Func <t_foam, bool> > expression = d => true;
            bool isYestoday = false;

            switch (mode)
            {
            case NetbuyMode.只看上涨:
                expression = expression.And(d => d.Change >= 0m);
                break;

            case NetbuyMode.只看下跌:
                expression = expression.And(d => d.Change < 0m);
                break;

            case NetbuyMode.只看净买:
                expression = expression.And(d => d.Netbuy >= 0m);
                break;

            case NetbuyMode.只看净卖:
                expression = expression.And(d => d.Netbuy < 0m);
                break;

            case NetbuyMode.主力洗筹初期:
                expression = expression.And(d => d.State == ForceState.XI);
                break;

            case NetbuyMode.主力大互盘:
                expression = expression.And(d => d.State == ForceState.HU);
                break;

            case NetbuyMode.主力洗筹末期:
                expression = expression.And(d => d.State == ForceState.xi);
                break;

            case NetbuyMode.主力小互盘:
                expression = expression.And(d => d.State == ForceState.hu);
                break;

            case NetbuyMode.主力大砸盘:
                expression = expression.And(d => d.State == ForceState.ZA);
                break;

            case NetbuyMode.主力拉伸末期:
                expression = expression.And(d => d.State == ForceState.LA);
                break;

            case NetbuyMode.主力小砸盘:
                expression = expression.And(d => d.State == ForceState.za);
                break;

            case NetbuyMode.主力拉伸初期:
                expression = expression.And(d => d.State == ForceState.la);
                break;

            case NetbuyMode.昨日上涨:
                expression = expression.And(d => d.Change >= 0m);
                isYestoday = true;
                break;

            case NetbuyMode.昨日下跌:
                expression = expression.And(d => d.Change < 0m);
                isYestoday = true;
                break;

            case NetbuyMode.昨日净买:
                expression = expression.And(d => d.Netbuy >= 0m);
                isYestoday = true;
                break;

            case NetbuyMode.昨日净卖:
                expression = expression.And(d => d.Netbuy < 0m);
                isYestoday = true;
                break;

            case NetbuyMode.昨日主力洗筹初期:
                expression = expression.And(d => d.State == ForceState.XI);
                isYestoday = true;
                break;

            case NetbuyMode.昨日主力大互盘:
                expression = expression.And(d => d.State == ForceState.HU);
                isYestoday = true;
                break;

            case NetbuyMode.昨日主力洗筹末期:
                expression = expression.And(d => d.State == ForceState.xi);
                isYestoday = true;
                break;

            case NetbuyMode.昨日主力小互盘:
                expression = expression.And(d => d.State == ForceState.hu);
                isYestoday = true;
                break;

            case NetbuyMode.昨日主力大砸盘:
                expression = expression.And(d => d.State == ForceState.ZA);
                isYestoday = true;
                break;

            case NetbuyMode.昨日主力拉伸末期:
                expression = expression.And(d => d.State == ForceState.LA);
                isYestoday = true;
                break;

            case NetbuyMode.昨日主力小砸盘:
                expression = expression.And(d => d.State == ForceState.za);
                isYestoday = true;
                break;

            case NetbuyMode.昨日主力拉伸初期:
                expression = expression.And(d => d.State == ForceState.la);
                isYestoday = true;
                break;

            default:
                break;
            }

            var samples = SetSamplesByDateByCodeOrName(date);
            //var pd = db.FoamList.Where(expression).ConvertAll(d => samples.ContainsKey(d.Date) ? d.SetNum(samples[d.Date]) : d).OrderBy(d => d.Code).ThenByDescending(d => d.Date).ToPagedList(index, pageSize);
            var groups = db.FoamList.Where(d => date.Contains(d.Code) || date.Contains(d.Name)).GroupBy(d => d.Date)
                         .Select(g => new { date = g.Key, queue = g });
            IEnumerable <t_foam> pd = new List <t_foam>();

            if (groups.Any())
            {
                if (groups.SelectMany(d => d.queue).GroupBy(d => d.Code).Count() == 1)
                {
                    pd = groups.SelectMany(d => d.queue)
                         .ConvertAll(d => samples.ContainsKey(d.Code + d.Date) ? d.SetNum(samples[d.Code + d.Date]) : d);
                }
                else if (isYestoday)
                {
                    if (groups.Count() > 1)
                    {
                        var codes = groups.OrderByDescending(d => d.date).Skip(1).FirstOrDefault()?.queue.AsQueryable()
                                    .Where(expression).Select(d => d.Code);
                        pd = groups.OrderByDescending(d => d.date).FirstOrDefault()?.queue.AsQueryable().Where(d => codes.Contains(d.Code))
                             .ConvertAll(d => samples.ContainsKey(d.Code + d.Date) ? d.SetNum(samples[d.Code + d.Date]) : d);
                    }
                }
                else
                {
                    pd = groups.OrderByDescending(d => d.date).FirstOrDefault()?.queue.AsQueryable().Where(expression)
                         .ConvertAll(d => samples.ContainsKey(d.Code + d.Date) ? d.SetNum(samples[d.Code + d.Date]) : d);
                }

                Expression <Func <t_foam, decimal?> > odby = d => d.State == ForceState.XI ? 1 : 0;

                switch (col)
                {
                case 1:
                    odby = d => d.Netbuy;
                    break;

                case 2:
                    odby = d => d.Change;
                    break;

                case 3:
                    odby = d => d.Ltotal;
                    break;

                //case 4:
                //    odby = d => d.Foam;
                //    break;
                case 5:
                    odby = d => d.Num;
                    break;

                default:
                    break;
                }

                if (isPage || index > 1)
                {
                    ViewData["odcol"] = odcol;

                    if (col == odcol)
                    {
                        pd = pd.AsQueryable().OrderBy(d => d.Date).ThenBy(odby);
                    }
                    else
                    {
                        pd = pd.AsQueryable().OrderByDescending(d => d.Date).ThenBy(odby);
                    }
                }
                else
                {
                    if (col == odcol)
                    {
                        ViewData["odcol"] = 0;
                        pd = pd.AsQueryable().OrderByDescending(d => d.Date).ThenBy(odby);
                    }
                    else
                    {
                        ViewData["odcol"] = col;
                        pd = pd.AsQueryable().OrderBy(d => d.Date).ThenBy(odby);
                    }
                }
            }

            return(View(isOns ? "NetbuyOns" : "Netbuy", pd.ToPagedList(index, pageSize)));
        }