Exemplo n.º 1
0
        private void DoAction(string Action)
        {
            string s   = "{\"state\":false,\"msg\":\"未定义操作\"}";
            int    num = Globals.RequestFormNum("pageIndex");

            if (num > 0)
            {
                OneyuanTaoPartInQuery query = new OneyuanTaoPartInQuery {
                    PageIndex  = num,
                    PageSize   = 10,
                    ActivityId = "",
                    UserId     = Globals.GetCurrentMemberUserId(false),
                    state      = 2,
                    SortBy     = "BuyTime",
                    IsPay      = -1
                };
                DbQueryResult        oneyuanPartInDataTable = OneyuanTaoHelp.GetOneyuanPartInDataTable(query);
                DataTable            data      = new DataTable();
                IsoDateTimeConverter converter = new IsoDateTimeConverter {
                    DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                };
                if (oneyuanPartInDataTable.Data != null)
                {
                    data = (DataTable)oneyuanPartInDataTable.Data;
                    data = (DataTable)oneyuanPartInDataTable.Data;
                    data.Columns.Add("LuckNumList");
                    data.Columns.Add("AState");
                    foreach (DataRow row in data.Rows)
                    {
                        IList <LuckInfo> list = OneyuanTaoHelp.getWinnerLuckInfoList(row["ActivityId"].ToString(), "");
                        if (list != null)
                        {
                            row["LuckNumList"] = JsonConvert.SerializeObject(list, new JsonConverter[] { converter });
                        }
                        OneyuanTaoInfo   info  = OneyuanTaoHelp.DataRowToOneyuanTaoInfo(row);
                        OneTaoPrizeState state = OneyuanTaoHelp.getPrizeState(info);
                        row["AState"] = state;
                        if (info.IsSuccess)
                        {
                            row["AState"] = "已开奖";
                        }
                        else if (info.HasCalculate)
                        {
                            row["AState"] = "已结束(开奖失败)";
                        }
                    }
                }
                string str2 = JsonConvert.SerializeObject(data, new JsonConverter[] { converter });
                s = "{\"state\":true,\"msg\":\"读取成功\",\"Data\":" + str2 + "}";
            }
            else
            {
                s = "{\"state\":false,\"msg\":\"参数不正确\"}";
            }
            this.Page.Response.ClearContent();
            this.Page.Response.ContentType = "application/json";
            this.Page.Response.Write(s);
            this.Page.Response.End();
        }
Exemplo n.º 2
0
        void BindData()
        {
            OneyuanTaoQuery query = new OneyuanTaoQuery();

            query.PageIndex = pager.PageIndex;
            query.PageSize  = pager.PageSize;
            query.title     = atitle;
            query.state     = state;
            query.ReachType = ReachType;
            DbQueryResult ListData = OneyuanTaoHelp.GetOneyuanTao(query);

            if (ListData.Data != null)
            {
                DataTable dt = (DataTable)ListData.Data;
                dt.Columns.Add("ActionBtn");  //显示的按钮
                dt.Columns.Add("ASate");      //当前状态
                dt.Columns.Add("PrizeState"); //开奖状态
                dt.Columns.Add("CanDel");     //开奖状态

                foreach (DataRow Item in dt.Rows)
                {
                    OneyuanTaoInfo   tempItem      = OneyuanTaoHelp.DataRowToOneyuanTaoInfo(Item);
                    OneTaoState      rowState      = OneyuanTaoHelp.getOneTaoState(tempItem);
                    OneTaoPrizeState rowPrizeState = OneyuanTaoHelp.getPrizeState(tempItem);

                    Item["ASate"]      = rowState;
                    Item["PrizeState"] = rowPrizeState;
                    Item["CanDel"]     = 0;

                    if (rowPrizeState == OneTaoPrizeState.成功开奖)
                    {
                        Item["PrizeState"] = "<span class='success'>" + rowPrizeState + "<span>";
                    }
                    else if (rowPrizeState == OneTaoPrizeState.已关闭)
                    {
                        Item["PrizeState"] = "<span class='normal'>" + rowPrizeState + "<span>";
                    }
                    else if (rowPrizeState == OneTaoPrizeState.待退款)
                    {
                        Item["PrizeState"] = "<span class='green'>" + rowPrizeState + "<span>";
                    }
                    else
                    {
                        Item["PrizeState"] = "<span class='errcss'>" + rowPrizeState + "<span>";
                    }


                    string btnstr = "<a class=\"btn btn-xs btn-primary\" onclick=\"AView('" + Item["ActivityId"] + "')\" >查看</a> ";

                    if (rowState == OneTaoState.进行中 || rowState == OneTaoState.未开始)
                    {
                        btnstr += "<a class=\"btn btn-xs btn-primary\" onclick=\"AEdit('" + Item["ActivityId"] + "')\"  >编辑</a> ";
                    }


                    if (rowState == OneTaoState.未开始)
                    {
                        btnstr += "<a class=\"btn btn-xs btn-success\" onclick=\"AStart('" + Item["ActivityId"] + "')\"  >开启</a> ";
                    }

                    if (rowState == OneTaoState.进行中)
                    {
                        btnstr += "<a class=\"btn btn-xs btn-danger\" onclick=\"AEnd('" + Item["ActivityId"] + "','" + Item["FinishedNum"] + "','" + Item["ReachType"] + "','" + Item["ReachNum"] + "')\"  >结束</a> ";
                    }


                    if ((rowState == OneTaoState.已结束 && (int)Item["FinishedNum"] == 0) || rowState == OneTaoState.未开始)
                    {
                        //可删除的活动,1未开始,2已结束且没有人参与的活动

                        btnstr        += "<a class=\"btn btn-xs btn-danger\" onclick=\"ADel('" + Item["ActivityId"] + "')\" >删除</a> ";
                        Item["CanDel"] = 1;
                    }


                    if (rowState == OneTaoState.开奖失败)
                    {
                        btnstr += "<a class=\"btn btn-xs btn-danger\" onclick=\"BatchRefund('" + Item["ActivityId"] + "')\" >批量退款</a> ";
                    }

                    Item["ActionBtn"] = btnstr;
                }


                Datalist.DataSource = dt;
                Datalist.DataBind();
                pager.TotalRecords = ListData.TotalRecords;

                int hasStart  = 0;
                int waitStart = 0;
                int Total     = 0;
                int hasEnd    = 0;

                Total = OneyuanTaoHelp.GetOneyuanTaoTotalNum(out hasStart, out waitStart, out hasEnd);

                ListTotal.Text = "所有夺宝(" + Total.ToString() + ")";
                ListStart.Text = "进行中(" + hasStart.ToString() + ")";
                ListWait.Text  = "未开始(" + waitStart.ToString() + ")";
                Listend.Text   = "已结束(" + hasEnd.ToString() + ")";
            }



            //DataTable dt = (DataTable)productSet.Data;
            //dt.Columns.Add("setStatus");

            pager.TotalRecords = ListData.TotalRecords;
        }
Exemplo n.º 3
0
        private void BindData()
        {
            OneyuanTaoQuery query = new OneyuanTaoQuery {
                PageIndex = this.pager.PageIndex,
                PageSize  = this.pager.PageSize,
                title     = this.atitle,
                state     = this.state,
                ReachType = this.ReachType
            };
            DbQueryResult oneyuanTao = OneyuanTaoHelp.GetOneyuanTao(query);

            if (oneyuanTao.Data != null)
            {
                DataTable data = (DataTable)oneyuanTao.Data;
                data.Columns.Add("ActionBtn");
                data.Columns.Add("ASate");
                data.Columns.Add("PrizeState");
                data.Columns.Add("CanDel");
                foreach (DataRow row in data.Rows)
                {
                    OneyuanTaoInfo   info  = OneyuanTaoHelp.DataRowToOneyuanTaoInfo(row);
                    OneTaoPrizeState state = OneyuanTaoHelp.getPrizeState(info);
                    row["PrizeState"] = state;
                    row["CanDel"]     = 0;
                    switch (state)
                    {
                    case OneTaoPrizeState.成功开奖:
                        row["PrizeState"] = "<span class='success'>" + state + "<span>";
                        break;

                    case OneTaoPrizeState.已关闭:
                        row["PrizeState"] = "<span class='normal'>" + state + "<span>";
                        break;

                    case OneTaoPrizeState.待退款:
                        if (OneyuanTaoHelp.CheckIsAll(row["ActivityId"].ToString()))
                        {
                            info.IsAllRefund  = true;
                            row["PrizeState"] = "<span class='errcss'>已退款<span>";
                        }
                        else
                        {
                            row["PrizeState"] = "<span class='green'>" + state + "<span>";
                        }
                        break;

                    default:
                        row["PrizeState"] = "<span class='errcss'>" + state + "<span>";
                        break;
                    }
                    OneTaoState state2 = OneyuanTaoHelp.getOneTaoState(info);
                    row["ASate"] = state2;
                    string str2 = "<a class=\"btn btn-xs btn-primary\" onclick=\"AView('" + row["ActivityId"] + "')\" >查看</a> ";
                    switch (state2)
                    {
                    case OneTaoState.进行中:
                    case OneTaoState.未开始:
                    {
                        object obj2 = str2;
                        str2 = string.Concat(new object[] { obj2, "<a class=\"btn btn-xs btn-primary\" onclick=\"AEdit('", row["ActivityId"], "')\"  >编辑</a> " });
                        break;
                    }
                    }
                    switch (state2)
                    {
                    case OneTaoState.未开始:
                    {
                        object obj3 = str2;
                        str2 = string.Concat(new object[] { obj3, "<a class=\"btn btn-xs btn-success\" onclick=\"AStart('", row["ActivityId"], "')\"  >开启</a> " });
                        break;
                    }

                    case OneTaoState.进行中:
                    {
                        object obj4 = str2;
                        str2 = string.Concat(new object[] { obj4, "<a class=\"btn btn-xs btn-danger\" onclick=\"AEnd('", row["ActivityId"], "','", row["FinishedNum"], "','", row["ReachType"], "','", row["ReachNum"], "')\"  >结束</a> " });
                        break;
                    }
                    }
                    if (((state2 == OneTaoState.已结束) && (((int)row["FinishedNum"]) == 0)) || ((state2 == OneTaoState.未开始) || (state2 == OneTaoState.退款完成)))
                    {
                        object obj5 = str2;
                        str2          = string.Concat(new object[] { obj5, "<a class=\"btn btn-xs btn-danger\" onclick=\"ADel('", row["ActivityId"], "')\" >删除</a> " });
                        row["CanDel"] = 1;
                    }
                    if (state2 == OneTaoState.开奖失败)
                    {
                        object obj6 = str2;
                        str2 = string.Concat(new object[] { obj6, "<a class=\"btn btn-xs btn-danger\" onclick=\"BatchRefund('", row["ActivityId"], "')\" >批量退款</a> " });
                    }
                    row["ActionBtn"] = str2;
                }
                this.Datalist.DataSource = data;
                this.Datalist.DataBind();
                this.pager.TotalRecords = oneyuanTao.TotalRecords;
                int hasStart  = 0;
                int waitStart = 0;
                int hasEnd    = 0;
                this.ListTotal.Text = "所有夺宝(" + OneyuanTaoHelp.GetOneyuanTaoTotalNum(out hasStart, out waitStart, out hasEnd).ToString() + ")";
                this.ListStart.Text = "进行中(" + hasStart.ToString() + ")";
                this.ListWait.Text  = "未开始(" + waitStart.ToString() + ")";
                this.Listend.Text   = "已结束(" + hasEnd.ToString() + ")";
            }
            this.pager.TotalRecords = oneyuanTao.TotalRecords;
        }
Exemplo n.º 4
0
        private void BindData()
        {
            DbQueryResult oneyuanTao = OneyuanTaoHelp.GetOneyuanTao(new OneyuanTaoQuery
            {
                PageIndex = this.pager.PageIndex,
                PageSize  = this.pager.PageSize,
                title     = this.atitle,
                state     = this.state,
                ReachType = this.ReachType
            });

            if (oneyuanTao.Data != null)
            {
                System.Data.DataTable dataTable = (System.Data.DataTable)oneyuanTao.Data;
                dataTable.Columns.Add("ActionBtn");
                dataTable.Columns.Add("ASate");
                dataTable.Columns.Add("PrizeState");
                dataTable.Columns.Add("CanDel");
                foreach (System.Data.DataRow dataRow in dataTable.Rows)
                {
                    OneyuanTaoInfo   info        = OneyuanTaoHelp.DataRowToOneyuanTaoInfo(dataRow);
                    OneTaoState      oneTaoState = OneyuanTaoHelp.getOneTaoState(info);
                    OneTaoPrizeState prizeState  = OneyuanTaoHelp.getPrizeState(info);
                    dataRow["ASate"]      = oneTaoState;
                    dataRow["PrizeState"] = prizeState;
                    dataRow["CanDel"]     = 0;
                    if (prizeState == OneTaoPrizeState.成功开奖)
                    {
                        dataRow["PrizeState"] = "<span class='success'>" + prizeState + "<span>";
                    }
                    else if (prizeState == OneTaoPrizeState.已关闭)
                    {
                        dataRow["PrizeState"] = "<span class='normal'>" + prizeState + "<span>";
                    }
                    else if (prizeState == OneTaoPrizeState.待退款)
                    {
                        dataRow["PrizeState"] = "<span class='green'>" + prizeState + "<span>";
                    }
                    else
                    {
                        dataRow["PrizeState"] = "<span class='errcss'>" + prizeState + "<span>";
                    }
                    string text = "<a class=\"btn btn-xs btn-primary\" onclick=\"AView('" + dataRow["ActivityId"] + "')\" >查看</a> ";
                    if (oneTaoState == OneTaoState.进行中 || oneTaoState == OneTaoState.未开始)
                    {
                        object obj = text;
                        text = string.Concat(new object[]
                        {
                            obj,
                            "<a class=\"btn btn-xs btn-primary\" onclick=\"AEdit('",
                            dataRow["ActivityId"],
                            "')\"  >编辑</a> "
                        });
                    }
                    if (oneTaoState == OneTaoState.未开始)
                    {
                        object obj2 = text;
                        text = string.Concat(new object[]
                        {
                            obj2,
                            "<a class=\"btn btn-xs btn-success\" onclick=\"AStart('",
                            dataRow["ActivityId"],
                            "')\"  >开启</a> "
                        });
                    }
                    if (oneTaoState == OneTaoState.进行中)
                    {
                        object obj3 = text;
                        text = string.Concat(new object[]
                        {
                            obj3,
                            "<a class=\"btn btn-xs btn-danger\" onclick=\"AEnd('",
                            dataRow["ActivityId"],
                            "','",
                            dataRow["FinishedNum"],
                            "','",
                            dataRow["ReachType"],
                            "','",
                            dataRow["ReachNum"],
                            "')\"  >结束</a> "
                        });
                    }
                    if ((oneTaoState == OneTaoState.已结束 && (int)dataRow["FinishedNum"] == 0) || oneTaoState == OneTaoState.未开始)
                    {
                        object obj4 = text;
                        text = string.Concat(new object[]
                        {
                            obj4,
                            "<a class=\"btn btn-xs btn-danger\" onclick=\"ADel('",
                            dataRow["ActivityId"],
                            "')\" >删除</a> "
                        });
                        dataRow["CanDel"] = 1;
                    }
                    if (oneTaoState == OneTaoState.开奖失败)
                    {
                        object obj5 = text;
                        text = string.Concat(new object[]
                        {
                            obj5,
                            "<a class=\"btn btn-xs btn-danger\" onclick=\"BatchRefund('",
                            dataRow["ActivityId"],
                            "')\" >批量退款</a> "
                        });
                    }
                    dataRow["ActionBtn"] = text;
                }
                this.Datalist.DataSource = dataTable;
                this.Datalist.DataBind();
                this.pager.TotalRecords = oneyuanTao.TotalRecords;
                int num  = 0;
                int num2 = 0;
                int num3 = 0;
                int oneyuanTaoTotalNum = OneyuanTaoHelp.GetOneyuanTaoTotalNum(out num, out num2, out num3);
                this.ListTotal.Text = "所有夺宝(" + oneyuanTaoTotalNum.ToString() + ")";
                this.ListStart.Text = "进行中(" + num.ToString() + ")";
                this.ListWait.Text  = "未开始(" + num2.ToString() + ")";
                this.Listend.Text   = "已结束(" + num3.ToString() + ")";
            }
            this.pager.TotalRecords = oneyuanTao.TotalRecords;
        }