예제 #1
0
 public IActionResult Index()
 {
     Model.CaiPiao current = cpbll.GetCurrentModel();
     ViewBag.current = current; //本期
     ViewBag.prev    = cpbll.GetModel((int.Parse(current.qihao) - 1).ToString());
     return(View());
 }
예제 #2
0
파일: BJPK10.cs 프로젝트: ps51/caipiao_wlgj
        public Model.CaiPiao GetModel(string qihao)
        {
            DAL.QihaoinfoDAL qhdal = new DAL.QihaoinfoDAL()
            {
                ConnStr = ConnStr
            };
            Model.Qihaoinfo qh = qhdal.GetModelByQiHaoAndCZID(qihao, 23);

            if (qh == null)
            {
                return(null);
            }
            Model.CaiPiao cp = new Model.CaiPiao()
            {
                czid      = 23,
                czname    = "北京PK拾",
                qihao     = qh.qihao,
                starttime = qh.starttime,
                endtime   = qh.endtime,
                kjtime    = qh.kjtime,
                kjcode    = qh.kjcode,
                remark    = qh.remark
            };
            return(cp);
        }
예제 #3
0
 public ActionResult Add(int?id)
 {
     ViewBag.userlist = udal.GetListArray("1=1 order by username");
     Model.CaiPiao current_cp = cpbll.GetCurrentModel();
     if (current_cp == null)
     {
         return(Content("当前期号不存在,请联系管理员添加!"));
     }
     return(View(current_cp));
 }
예제 #4
0
 //取当前期和上一期
 public ActionResult GetCurrentAndPrev()
 {
     Model.CaiPiao current = cpbll.GetCurrentModel();
     Model.CaiPiao prev    = cpbll.GetModel((int.Parse(current.qihao) - 1).ToString());
     return(Json(new
     {
         current_qihao = current.qihao,
         current_endtime = current.endtime.ToString("yyyy-MM-dd HH:mm:ss"),
         prev_qihao = prev.qihao,
     }));
 }
예제 #5
0
파일: BJPK10.cs 프로젝트: ps51/caipiao_wlgj
        public Model.CaiPiao GetCurrentModel()
        {
            DAL.QihaoinfoDAL qhdal = new DAL.QihaoinfoDAL()
            {
                ConnStr = ConnStr
            };
            string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            Model.Qihaoinfo qh = null;
            if (DateTime.Now.Hour >= 9 && DateTime.Now <= DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:55:00")))
            {
                //在今天的9:00 ~ 23:55 之间的,取当前期号
                qh = qhdal.GetModelByCond($"czid=23 and starttime<='{now}' and '{now}'<=kjtime ");
            }
            else
            {
                //在今天23:55 ~ 第二天的9:00之间的,取第二天的第一期
                string tmp = "";
                if (DateTime.Now.Hour == 23 && DateTime.Now.Minute >= 55)
                {
                    tmp = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
                }
                else
                {
                    tmp = DateTime.Now.ToString("yyyy-MM-dd");
                }
                qh = qhdal.GetModelByCond($"czid=23 and starttime between '{tmp + (" 00:00:00")}' and '{tmp + (" 23:59:59")}' order by qihao asc");
            }
            if (qh == null)
            {
                return(null);
            }
            Model.CaiPiao cp = new Model.CaiPiao()
            {
                czid      = 23,
                czname    = "北京PK拾",
                qihao     = qh.qihao,
                starttime = qh.starttime,
                endtime   = qh.endtime,
                kjtime    = qh.kjtime,
                kjcode    = qh.kjcode,
                remark    = qh.remark
            };
            return(cp);
        }
예제 #6
0
 public Model.CaiPiao GetModel(string qihao)
 {
     Model.Qihaoinfo qh = new DAL.QihaoinfoDAL().GetModelByCond($"czid=1 and qihao='{qihao}'");
     if (qh == null)
     {
         return(null);
     }
     Model.CaiPiao cp = new Model.CaiPiao()
     {
         czid      = 1,
         czname    = "北京28",
         qihao     = qh.qihao,
         starttime = qh.starttime,
         endtime   = qh.endtime,
         kjtime    = qh.kjtime,
         kjcode    = qh.kjcode,
         remark    = qh.remark
     };
     return(cp);
 }