コード例 #1
0
ファイル: OneyuanList.cs プロジェクト: yunchenglk/wechat
        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;
        }
コード例 #2
0
ファイル: OneyuanList.cs プロジェクト: llenroc/kangaroo
        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   oneyuanTaoInfo = OneyuanTaoHelp.DataRowToOneyuanTaoInfo(dataRow);
                    OneTaoPrizeState prizeState     = OneyuanTaoHelp.getPrizeState(oneyuanTaoInfo);
                    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.待退款)
                    {
                        string aid  = dataRow["ActivityId"].ToString();
                        bool   flag = OneyuanTaoHelp.CheckIsAll(aid);
                        if (flag)
                        {
                            oneyuanTaoInfo.IsAllRefund = true;
                            dataRow["PrizeState"]      = "<span class='errcss'>已退款<span>";
                        }
                        else
                        {
                            dataRow["PrizeState"] = "<span class='green'>" + prizeState + "<span>";
                        }
                    }
                    else
                    {
                        dataRow["PrizeState"] = "<span class='errcss'>" + prizeState + "<span>";
                    }
                    OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfo);
                    dataRow["ASate"] = oneTaoState;
                    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> "
                        });
                    }
                    else 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.未开始 || 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;
        }