Ejemplo n.º 1
0
        public static List <LotteryOrder> GetLotteryWin(string cpCode, int status, decimal winFee, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string btime = "", string etime = "")
        {
            string sqlwhere = " b.cpCode='" + cpCode + "'";

            if (status > -1)
            {
                sqlwhere += " and b.Status=" + status;
            }
            if (!string.IsNullOrEmpty(btime))
            {
                sqlwhere += " and b.CreateTime>='" + btime + "'";
            }
            if (winFee > 0)
            {
                sqlwhere += " and b.WinFee>=" + winFee;
            }
            if (!string.IsNullOrEmpty(etime))
            {
                sqlwhere += " and b.CreateTime<='" + etime + " 23:59:59:999'";
            }
            DataTable dt = CommonBusiness.GetPagerData(" LotteryOrder b join M_Users a on a.UserID=b.UserID ",
                                                       " b.* ,a.UserName", sqlwhere, " b.AutoID ", pageSize, pageIndex,
                                                       out totalCount, out pageCount);
            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> 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);
        }
Ejemplo n.º 3
0
        public static List <LotteryOrder> GetAccReportList(string btime, string etime, int playtype, string userid, int pageIndex, int pageSize, ref int totalCount, ref int pageCount, int self = 0, string username = "")
        {
            string whereSql = " a.AutoID>0 ";

            if (!string.IsNullOrEmpty(btime))
            {
                whereSql += " and a.CreateTime>='" + btime + "'";
            }
            if (!string.IsNullOrEmpty(etime))
            {
                whereSql += " and a.CreateTime<'" + etime + "'";
            }
            if (playtype > -1)
            {
                whereSql += " and a.playtype=" + playtype;
            }
            if (!string.IsNullOrEmpty(userid))
            {
                if (self > 0)
                {
                    if (self == 1)
                    {
                        whereSql += " and a.UserID in(select UserID from UserRelation where ParentID='" + userid + "')";
                    }
                    else if (self == 2)
                    {
                        whereSql += " and a.UserID in(select UserID from UserRelation where Parents like '%" + userid +
                                    "%')";
                    }
                    else
                    {
                        whereSql += " and a.UserID='" + userid + "' ";
                    }
                }
                else
                {
                    whereSql += " and ( a.UserID in(select UserID from UserRelation where Parents like '%" + userid + "%') or  a.UserID='" + userid + "')";
                }
            }
            if (!string.IsNullOrEmpty(username))
            {
                whereSql += " and c.LoginName='" + username.Trim() + "' ";
            }
            string              clumstr = @" a.AccountChange, a.Type AccountType,  a.CreateTime  , '' Remark, a.AutoID,a.Account,a.PlayType,a.Remark PlayTypeName,c.LoginName UserName ,a.Type ChangeType ";
            DataTable           dt      = CommonBusiness.GetPagerData(" AccountOperateRecord a join M_Users c on a.UseriD=c.Userid ", clumstr, whereSql, "a.AutoID", pageSize, pageIndex, out totalCount, out pageCount, false);
            List <LotteryOrder> list    = new List <LotteryOrder>();

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

            return(list);
        }
        public static LotteryOrder GetUserOrderDetail(string lcode)
        {
            DataTable    dt    = LotteryOrderDAL.BaseProvider.GetLotteryOrderDetail(lcode);
            LotteryOrder model = null;

            if (dt.Rows.Count == 1)
            {
                model = new LotteryOrder();
                model.FillData(dt.Rows[0]);
            }
            return(model);
        }
        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);
        }
Ejemplo n.º 7
0
        public string MessageInfo(string message, string cpcode, string issuenum, string uid)
        {
            string       mes     = "处理失败";
            List <Plays> plays   = CommonBusiness.LottertPlays.Where(x => x.CPCode == cpcode).ToList();
            Lottery      lottery = CommonBusiness.LottertList.Where(x => x.CPCode == cpcode).FirstOrDefault();
            var          strs    = message.Trim().Split('/');

            string[] list1   = new string[] { };
            string[] list2   = new string[] { };
            string[] list3   = new string[] { };
            bool     istotal = false;

            if (strs.Length == 3)
            {
                var chars = strs[1].Trim().ToCharArray();
                if (strs[1].Trim().IndexOf("龙") > -1 || strs[1].Trim().IndexOf("虎") > -1 || strs[1].Trim().IndexOf("和") > -1)
                {
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if ("龙虎和".IndexOf(s) > -1)
                        {
                            list2[list2.Count()] = c.ToString();
                        }
                    }
                    chars = strs[0].Trim().ToCharArray();
                    string mv = "";
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if (cpcode.ToLower() == "bjsc")
                        {
                        }
                        else
                        {
                            if ("万千百十个".IndexOf(s) > -1)
                            {
                                if (mv.Length == 2)
                                {
                                    list1[list1.Count()] = mv;
                                    mv = s;
                                }
                                else
                                {
                                    mv = mv + s;
                                }
                            }
                        }
                    }
                }
                else
                {
                    chars = strs[0].Trim().ToCharArray();
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if (cpcode.ToLower() == "bjsc")
                        {
                        }
                        else
                        {
                            if ("万千百十个".IndexOf(s) > -1)
                            {
                                list1[list1.Count()] = c.ToString();
                            }
                        }
                    }
                    chars = strs[1].Trim().ToCharArray();
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if ("龙虎和大小单双1234567890".IndexOf(s) > -1)
                        {
                            list2[list2.Count()] = s;
                        }
                    }
                }
                chars = strs[2].Trim().ToCharArray();
                foreach (char c in chars)
                {
                    string s = c.ToString();
                    if ("共".IndexOf(s) > -1)
                    {
                        istotal = true;
                    }
                    list3[list3.Count()] = strs[2].Trim().Replace("共", "").Replace("各", "");
                }
            }
            List <LotteryOrder>         orders = new List <LotteryOrder>();
            Dictionary <string, string> tplays = new Dictionary <string, string>();

            foreach (string s in list1)
            {
                foreach (string t in list2)
                {
                    string key = s + t;
                    string pid = plays.Where(x => x.OutName.IndexOf(key) > -1).FirstOrDefault().PIDS;
                    if (!tplays.ContainsKey(s + t) && !string.IsNullOrWhiteSpace(pid))
                    {
                        LotteryOrder order = new LotteryOrder();
                        order.CPCode    = cpcode.ToUpper();
                        order.CPName    = lottery.CPName;
                        order.Status    = 0;
                        order.TypeName  = key;
                        order.Type      = pid;
                        order.Num       = 1;
                        order.PMuch     = 1;
                        order.RPoint    = 0;
                        order.MType     = 0;
                        order.ModelName = "";
                        order.PayFee    = Convert.ToDecimal(list3[list3.Count()]);
                        order.Content   = t;
                        order.UserID    = uid;
                        order.IssueNum  = issuenum;
                        orders.Add(order);
                        tplays.Add(s + t, pid);
                    }
                }
            }

            return(mes);
        }
 public static bool SaveLotteryUpdate(LotteryOrder model, ref string msg)
 {
     return(LotteryOrderDAL.BaseProvider.SaveLotteryUpdate(model.AutoID, model.Type, model.TypeName, model.Content, ref msg));
 }
        public static List <LotteryOrder> GetLotteryOrder(string keyWords, string cpcode, string userid, string lcode, string issuenum, string type, string status, int winType, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, int self = 0, string begintime = "", string endtime = "", string username = "", string orderby = " a.AutoID ", string bcode = "", string winfee = "", string opentime = "", string opentimeend = "")
        {
            string tablename = "LotteryOrder (nolock) a left join M_Users b  on a.UserID =b.UserID " +
                               "left join lotteryResult (nolock) c on a.IssueNum=c.IssueNum   and a.CPCode=c.CPCode " +
                               " left join lotteryBettAuto (nolock) d on a.bcode=d.Bcode ";
            string sqlwhere = " a.status<>9 ";

            if (!string.IsNullOrEmpty(keyWords))
            {
                sqlwhere += " and (b.LoginName like '%" + keyWords + "%' or a.IssueNum like '%" + keyWords + "%' or a.LCode like '%" + keyWords + "%'  or a.TypeName like '%" + keyWords + "%')";
            }
            if (!string.IsNullOrEmpty(type))
            {
                sqlwhere += " and a.Type like '%" + type + "%'";
            }
            if (!string.IsNullOrEmpty(bcode))
            {
                sqlwhere += " and a.bcode='" + bcode + "'";
            }
            if (!string.IsNullOrEmpty(status) && status != "-1")
            {
                sqlwhere += " and a.status in(" + status + ")";
            }
            if (!string.IsNullOrEmpty(cpcode))
            {
                sqlwhere += " and a.cpcode='" + cpcode + "'";
            }
            if (!string.IsNullOrEmpty(username))
            {
                sqlwhere += " and b.LoginName='" + username + "'";
            }
            if (winType > -1)
            {
                sqlwhere += " and a.WinType=" + winType;
            }
            if (!string.IsNullOrEmpty(winfee))
            {
                sqlwhere += " and a.WinFee>" + Convert.ToDecimal(winfee);
            }
            if (!string.IsNullOrEmpty(opentime))
            {
                sqlwhere += " and c.opentime>='" + opentime + "'";
            }
            if (!string.IsNullOrEmpty(opentimeend))
            {
                sqlwhere += " and c.opentime<'" + opentimeend + "'";
            }
            if (!string.IsNullOrEmpty(userid))
            {
                if (self > 0)
                {
                    if (self == 1)
                    {
                        sqlwhere += " and a.UserID in(select UserID from UserRelation where ParentID='" + userid + "') ";
                    }
                    else if (self == 2)
                    {
                        sqlwhere += " and a.UserID in(select UserID from UserRelation where Parents like '%" + userid + "%')";
                    }
                    else
                    {
                        sqlwhere += " and a.UserID='" + userid + "' ";
                    }
                }
                else
                {
                    sqlwhere += " and (a.UserID in(select UserID from UserRelation where Parents like '%" + userid + "%') or  a.UserID='" + userid + "' )";
                }
            }
            if (!string.IsNullOrEmpty(begintime))
            {
                sqlwhere += " and a.CreateTime>='" + begintime + "'";
            }
            if (!string.IsNullOrEmpty(endtime))
            {
                sqlwhere += " and a.CreateTime<'" + endtime + " 23:59:59:999'";
            }
            if (!string.IsNullOrWhiteSpace(lcode))
            {
                sqlwhere += " and a.LCode ='" + lcode + "'";
            }
            if (!string.IsNullOrEmpty(issuenum))
            {
                sqlwhere += " and a.IssueNum ='" + issuenum + "'";
            }
            bool isdesc = true;

            if (!string.IsNullOrEmpty(orderby))
            {
                if (orderby.ToLower().IndexOf(" desc") > -1)
                {
                    isdesc = false;
                }
                orderby = orderby.Replace("desc", " ").Replace("asc", "");
            }
            DataTable           dt   = CommonBusiness.GetPagerData(tablename, " a.*,b.LoginName as UserName,c.ResultNum, isnull(d.IsStart,-1) IsStart,isnull(d.Status,-1) BettStatus", sqlwhere, orderby, pageSize, pageIndex, out totalCount, out pageCount, isdesc);
            List <LotteryOrder> list = new List <LotteryOrder>();

            foreach (DataRow dr in dt.Rows)
            {
                LotteryOrder model = new LotteryOrder();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 10
0
        public JsonResult MessageInfo(string message, string cpcode, string issuenum)
        {
            string mes    = "";
            var    result = -1;

            message = message.Replace("毒", "万千百十个");
            var strs = message.Trim().Split(' ');

            if (strs.Length == 2)
            {
                message = "万个 " + message.Trim();
                strs    = message.Trim().Split(' ');
            }
            if (strs.Length == 3)
            {
                List <Plays>  plays   = CommonBusiness.LottertPlays.Where(x => x.CPCode == cpcode && !string.IsNullOrEmpty(x.OutName)).ToList();
                Lottery       lottery = CommonBusiness.LottertList.Where(x => x.CPCode == cpcode.ToUpper()).FirstOrDefault();
                List <string> list1   = new List <string>();
                List <string> list2   = new List <string>();
                List <string> list3   = new List <string>();
                var           chars   = strs[1].Trim().ToCharArray();
                if (strs[1].Trim().IndexOf("龙") > -1 || strs[1].Trim().IndexOf("虎") > -1 || strs[1].Trim().IndexOf("和") > -1)
                {
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if ("龙虎和".IndexOf(s) > -1)
                        {
                            list2.Add(s);
                        }
                    }
                    chars = strs[0].Trim().ToCharArray();
                    string mv = "";
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if (cpcode.ToLower() == "bjsc")
                        {
                        }
                        else
                        {
                            if ("万千百十个".IndexOf(s) > -1)
                            {
                                mv = mv + s;
                                if (mv.Length == 2)
                                {
                                    list1.Add(mv);
                                    mv = "";
                                }
                            }
                        }
                    }
                }
                else
                {
                    chars = strs[0].Trim().ToCharArray();
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if (cpcode.ToLower() == "bjsc")
                        {
                        }
                        else
                        {
                            if ("万千百十个".IndexOf(s) > -1)
                            {
                                list1.Add(s);
                            }
                        }
                    }
                    chars = strs[1].Trim().ToCharArray();
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if ("龙虎和大小单双1234567890".IndexOf(s) > -1)
                        {
                            list2.Add(s);
                        }
                    }
                }


                list3.Add(System.Text.RegularExpressions.Regex.Replace(strs[2], @"[^0-9]+", ""));
                if (list1.Count > 0 && list2.Count > 0 && list3.Count > 0)
                {
                    List <LotteryOrder>         orders = new List <LotteryOrder>();
                    Dictionary <string, string> tplays = new Dictionary <string, string>();
                    foreach (string s in list1)
                    {
                        foreach (string t in list2)
                        {
                            string key = s + t;
                            string pid = plays.Where(x => x.OutName.IndexOf(key) > -1).FirstOrDefault().PIDS;
                            if (!tplays.ContainsKey(s + t) && !string.IsNullOrWhiteSpace(pid))
                            {
                                LotteryOrder order = new LotteryOrder();
                                order.CPCode    = cpcode.ToUpper();
                                order.CPName    = lottery.CPName;
                                order.Status    = 0;
                                order.TypeName  = key;
                                order.Type      = pid;
                                order.Num       = 1;
                                order.PMuch     = 1;
                                order.RPoint    = 0;
                                order.MType     = 0;
                                order.ModelName = "0/0%";
                                order.PayFee    = Convert.ToDecimal(Convert.ToInt32(list3[list3.Count - 1]));
                                order.Content   = t;
                                order.UserID    = CurrentUser.UserID;
                                order.IssueNum  = issuenum;
                                orders.Add(order);
                                tplays.Add(s + t, pid);
                            }
                        }
                    }
                    if (list2.Count > 1 && orders.Count > 1)
                    {
                        decimal payfee = Convert.ToDecimal(Convert.ToInt32(Convert.ToInt32(list3[list3.Count - 1]) / orders.Count));
                        if (payfee > 10)
                        {
                            orders.ForEach(x => x.PayFee = payfee);
                            result = LotteryOrderBusiness.CreateUserOrderList(orders, CurrentUser, OperateIP, 0, 4, ref mes);
                        }
                        else
                        {
                            mes = "单注金额必须大于10元";
                        }
                    }
                    else if (orders.Count > 0)
                    {
                        if (Convert.ToDecimal(Convert.ToInt32(list3[list3.Count - 1])) > 10)
                        {
                            result = LotteryOrderBusiness.CreateUserOrderList(orders, CurrentUser, OperateIP, 0, 4, ref mes);
                        }
                        else
                        {
                            mes = "单注金额必须大于10元";
                        }
                    }
                    else
                    {
                        mes = "输入格式不正确";
                    }
                }
                else
                {
                    mes = "输入格式不正确";
                }
            }
            JsonDictionary.Add("result", result > 0?"投注成功":mes);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Ejemplo n.º 11
0
        public static List <LotteryOrder> GetLotteryOrderReportList(string btime, string etime, int playtype, string cpcode, string userid, string lcode, string issuenum, string type, string state, int winType, int pageIndex, int pageSize, ref int totalCount, ref int pageCount, int self = 0)
        {
            string whereSql = " a.AutoID>0 ";

            if (!string.IsNullOrEmpty(btime))
            {
                whereSql += " and a.CreateTime>='" + btime + "'";
            }
            if (!string.IsNullOrEmpty(etime))
            {
                whereSql += " and a.CreateTime<'" + etime + "'";
            }
            if (playtype > -1)
            {
                whereSql += " and a.playtype=" + playtype;
            }
            if (!string.IsNullOrEmpty(type))
            {
                whereSql += " and b.Type like '%" + type + "%'";
            }
            if (!string.IsNullOrEmpty(cpcode))
            {
                whereSql += " and b.cpcode='" + cpcode + "'";
            }
            if (winType > -1)
            {
                whereSql += " and b.WinType=" + winType;
            }
            if (!string.IsNullOrEmpty(userid))
            {
                if (self > 0)
                {
                    if (self == 1)
                    {
                        whereSql += " and b.UserID in(select UserID from UserRelation where ParentID='" + userid + "')";
                    }
                    else if (self == 2)
                    {
                        whereSql += " and b.UserID in(select UserID from UserRelation where Parents like '%" + userid + "%')";
                    }
                    else
                    {
                        whereSql += " and b.UserID='" + userid + "' ";
                    }
                }
            }
            if (!string.IsNullOrWhiteSpace(lcode))
            {
                if (!string.IsNullOrEmpty(state))
                {
                    whereSql += " and b." + state + " ='" + lcode + "'";
                }
                else
                {
                    whereSql += " and (b.LCode like '%" + lcode + "%' or b.BCode like '%" + lcode + "%') ";
                }
            }
            if (!string.IsNullOrEmpty(issuenum))
            {
                whereSql += " and b.IssueNum ='" + issuenum + "'";
            }
            string              clumstr = " b.LCode,b.IssueNum,b.Type,b.TypeName,b.CPCode,b.CPName, case when a.Type=0 then a.AccountChange else b.WinFee end WinFee,case when a.Type=1 then a.AccountChange else isnull(b.PayFee,0.00) end PayFee ,isnull(b.Remark,'') Remark, a.AutoID,a.Account ,a.PlayType,a.Remark PlayTypeName,c.UserName ,a.Type ChangeType ";
            DataTable           dt      = CommonBusiness.GetPagerData(" AccountOperateRecord a join M_Users c on a.UseriD=c.Userid left join LotteryOrder b on a.Userid=b.Userid and a.FkCode=b.LCode and b.Status<>9 ", clumstr, whereSql, "a.AutoID", pageSize, pageIndex, out totalCount, out pageCount);
            List <LotteryOrder> list    = new List <LotteryOrder>();

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

            return(list);
        }
Ejemplo n.º 12
0
        public static List <LotteryOrder> GetLotteryOrder(string keyWords, string cpcode, string userid, string lcode, string issuenum, string type, int status, int winType, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, int self = 0, string begintime = "", string endtime = "")
        {
            string tablename = "LotteryOrder  a left join M_Users b  on a.UserID =b.UserID left join lotteryResult c on a.IssueNum=c.IssueNum   and a.CPCode=c.CPCode ";
            string sqlwhere  = " a.status<>9 ";

            if (!string.IsNullOrEmpty(keyWords))
            {
                sqlwhere += " and (b.UserName like '%" + keyWords + "%' or a.IssueNum like '%" + keyWords + "%' or a.LCode like '%" + keyWords + "%'  or a.TypeName like '%" + keyWords + "%')";
            }
            if (!string.IsNullOrEmpty(type))
            {
                sqlwhere += " and a.Type like '%" + type + "%'";
            }
            if (status > -1)
            {
                sqlwhere += " and a.status=" + status;
            }
            if (!string.IsNullOrEmpty(cpcode))
            {
                sqlwhere += " and a.cpcode='" + cpcode + "'";
            }
            if (winType > -1)
            {
                sqlwhere += " and a.WinType=" + winType;
            }
            if (!string.IsNullOrEmpty(userid))
            {
                if (self > 0)
                {
                    if (self == 1)
                    {
                        sqlwhere += " and a.UserID in(select UserID from UserRelation where ParentID='" + userid + "')";
                    }
                    else if (self == 2)
                    {
                        sqlwhere += " and a.UserID in(select UserID from UserRelation where Parents like '%" + userid + "%')";
                    }
                    else
                    {
                        sqlwhere += " and a.UserID='" + userid + "' ";
                    }
                }
            }
            if (!string.IsNullOrEmpty(begintime))
            {
                sqlwhere += " and a.CreateTime>='" + begintime + "'";
            }
            if (!string.IsNullOrEmpty(endtime))
            {
                sqlwhere += " and a.CreateTime<'" + endtime + " 23:59:59:999'";
            }
            if (!string.IsNullOrWhiteSpace(lcode))
            {
                sqlwhere += " and a.LCode ='" + lcode + "'";
            }
            if (!string.IsNullOrEmpty(issuenum))
            {
                sqlwhere += " and a.IssueNum ='" + issuenum + "'";
            }
            DataTable           dt   = CommonBusiness.GetPagerData(tablename, "a.*,b.UserName,c.ResultNum ", sqlwhere, "a.AutoID ", pageSize, pageIndex, out totalCount, out pageCount);
            List <LotteryOrder> list = new List <LotteryOrder>();

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