public static List <LotteryOrder> GetTodayUserBett(string btime, string etime, string cpcode = "")
        {
            string sqlwhere = "";

            if (!string.IsNullOrEmpty(btime))
            {
                sqlwhere += " and CreateTime >='" + btime + "'";
            }
            if (!string.IsNullOrEmpty(etime))
            {
                sqlwhere += " and CreateTime <'" + etime + "'";
            }
            if (!string.IsNullOrEmpty(cpcode))
            {
                sqlwhere += " and CpCode in ('" + cpcode.TrimEnd(',').Replace(",", "','") + "')";
            }
            string sqlstr = @" select a.CPCode,a.CPName ,b.UserID ,c.LoginName as UserName,ISNULL(b.PayFee,0) PayFee from Lottery a 
                              join (select  UserID,SUM(PayFee) PayFee,CPcode  from LotteryOrder (nolock)   where Status<>3 " + sqlwhere + " group by UserID,CPCode ) b on a.CPCode=b.CPCode" +
                            " join M_Users c on c.UserID=b.UserID where c.Status<>9 order by a.CPCode  ";
            DataTable           dt   = LotteryOrderDAL.GetDataTable(sqlstr);
            List <LotteryOrder> list = new List <LotteryOrder>();

            foreach (DataRow dr in dt.Rows)
            {
                LotteryOrder model = new LotteryOrder();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }
        public static UserReportDay GetUserWinDay(string userid)
        {
            DataTable     dt    = LotteryOrderDAL.GetDataTable("select sum(PayFee) as TotalPayMent,sum(WinFee) TotalWin from LotteryOrder where UserID='" + userid + "' and CreateTime>=convert(varchar(10),getdate(),120)");
            UserReportDay model = new UserReportDay();

            foreach (DataRow dr in dt.Rows)
            {
                model.FillData(dr);
            }
            return(model);
        }
        public static List <LotteryBettAuto> GetBettAutoByStatus()
        {
            DataTable dt = LotteryOrderDAL.GetDataTable(
                "select  a.*,b.LoginName as UserName from LotteryBettAuto  a left join M_Users b  on a.UserID =b.UserID where a.Status=0 and b.Status<>9");
            List <LotteryBettAuto> list = new List <LotteryBettAuto>();

            foreach (DataRow dr in dt.Rows)
            {
                LotteryBettAuto model = new LotteryBettAuto();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }
        public static List <LotteryOrder> GetIssueNumReport(string cpcode, string issuenum = "")
        {
            string swhere = "";

            if (!string.IsNullOrEmpty(issuenum))
            {
                swhere = "  and issuenum='" + issuenum + "'";
            }
            DataTable dt =
                LotteryOrderDAL.GetDataTable(
                    "select   CPCOde,CPName,IssueNum,Type+'_'+Content Type,TypeName,Sum(payFee) payFee   from LotteryOrder (nolock) where CPCode='" + cpcode + "' " + swhere + " group by  CPCOde,CPName, IssueNum,Type+'_'+Content,TypeName    ");
            List <LotteryOrder> list = new List <LotteryOrder>();

            foreach (DataRow dr in dt.Rows)
            {
                LotteryOrder model = new LotteryOrder();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }
        public static List <LotteryOrder> GetTodayBett(string btime, string etime)
        {
            string sqlwhere = "";

            if (!string.IsNullOrEmpty(btime))
            {
                sqlwhere += " and CreateTime >='" + btime + "'";
            }
            if (!string.IsNullOrEmpty(etime))
            {
                sqlwhere += " and CreateTime <'" + etime + "'";
            }
            string              sqlstr = @" select a.CPCode,a.CPName,ISNULL(b.PayFee,0) PayFee from Lottery a left join (select CPCode,SUM(PayFee) PayFee  from LotteryOrder (nolock)  where Status<>3 " + sqlwhere + " group by CPCode ) b on a.CPCode=b.CPCode ";
            DataTable           dt     = LotteryOrderDAL.GetDataTable(sqlstr);
            List <LotteryOrder> list   = new List <LotteryOrder>();

            foreach (DataRow dr in dt.Rows)
            {
                LotteryOrder model = new LotteryOrder();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }