⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pointlog.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.Controls
{
    using PowerEasy.Common;
    using PowerEasy.Components;
    using PowerEasy.Controls;
    using PowerEasy.Model.UserManage;
    using PowerEasy.UserManage;
    using PowerEasy.Web.UI;
    using System;
    using System.Collections;
    using System.Text;
    using System.Web.UI.WebControls;

    public class PointLog : BaseUserControl
    {
        protected ExtendedGridView EgvUserPoint;
        protected HiddenField HdnField;
        protected HiddenField HdnKeyword;
        protected HiddenField HdnSearchType;
        private string m_AdminName = PEContext.Current.Admin.AdminName;
        private float m_CurrentPageIncome;
        private float m_CurrentPagePayout;
        private string m_PointName = SiteConfig.UserConfig.PointName;
        protected ObjectDataSource OdsUserPoint;

        private static Table CreateTable(string rowOneText, string rowTwoText, string align)
        {
            Table table = new Table();
            table.Width = Unit.Percentage(100.0);
            TableRow row = new TableRow();
            TableCell cell = new TableCell();
            cell.Attributes.Add("align", align);
            row.Cells.Add(cell);
            TableRow row2 = new TableRow();
            TableCell cell2 = new TableCell();
            cell2.Attributes.Add("align", align);
            row2.Cells.Add(cell2);
            table.Rows.Add(row);
            table.Rows.Add(row2);
            table.Rows[0].Cells[0].Text = rowOneText;
            table.Rows[1].Cells[0].Text = rowTwoText;
            return table;
        }

        protected void DropCurrentPage_DataBind()
        {
            ArrayList list = new ArrayList();
            for (int i = 1; i <= this.EgvUserPoint.PageCount; i++)
            {
                list.Add(i);
            }
            DropDownList list2 = this.EgvUserPoint.BottomPagerRow.FindControl("DropCurrentPage") as DropDownList;
            list2.DataSource = list;
            list2.DataBind();
            if (this.EgvUserPoint.PageIndex > 0)
            {
                list2.SelectedIndex = this.EgvUserPoint.PageIndex;
            }
        }

        protected void EgvUserPoint_DataBound(object sender, EventArgs e)
        {
            if (this.EgvUserPoint.Rows.Count > 0)
            {
                float num2;
                float num3;
                GridViewRow footerRow = this.EgvUserPoint.FooterRow;
                int num = 3;
                while (footerRow.Cells.Count != num)
                {
                    footerRow.Cells.RemoveAt(0);
                }
                footerRow.CssClass = this.EgvUserPoint.RowStyle.CssClass;
                if (string.IsNullOrEmpty(this.m_AdminName))
                {
                    footerRow.Cells[1].ColumnSpan = 3;
                    footerRow.Cells[2].ColumnSpan = 3;
                    ArrayList totalInComeAndPayOutAll = UserPointLog.GetTotalInComeAndPayOutAll(PEContext.Current.User.UserName);
                    num2 = DataConverter.CFloat(totalInComeAndPayOutAll[0]);
                    num3 = DataConverter.CFloat(totalInComeAndPayOutAll[1]);
                    string[] strArray = new string[] { "本页合计 收入:", ((int) this.m_CurrentPageIncome).ToString("D"), "&nbsp;&nbsp;支出:", ((int) Math.Abs(this.m_CurrentPagePayout)).ToString("D"), "" };
                    string[] strArray2 = new string[7];
                    strArray2[0] = "总计";
                    strArray2[1] = this.m_PointName;
                    strArray2[2] = " 收入:";
                    strArray2[3] = ((int) Math.Abs(num2)).ToString("D");
                    strArray2[4] = "&nbsp;&nbsp;支出:";
                    strArray2[5] = ((int) Math.Abs(num3)).ToString("D");
                    strArray2[6] = "";
                    footerRow.Cells[1].Controls.Add(CreateTable(string.Concat(strArray), string.Concat(strArray2), "right"));
                    Table child = CreateTable("&nbsp;&nbsp;", string.Format(this.m_PointName + "余额:{0:0}", num2 - num3), "right");
                    child.Rows[1].Cells[0].Attributes.Add("align", "center");
                    footerRow.Cells[2].Controls.Add(child);
                }
                else
                {
                    footerRow.Cells[0].ColumnSpan = 3;
                    footerRow.Cells[1].ColumnSpan = 3;
                    footerRow.Cells[2].ColumnSpan = 2;
                    ArrayList list2 = UserPointLog.GetTotalInComeAndPayOutAll();
                    num2 = DataConverter.CFloat(list2[0]);
                    num3 = DataConverter.CFloat(list2[1]);
                    footerRow.Cells[0].Controls.Add(CreateTable("本页合计", "总计" + this.m_PointName, "right"));
                    string[] strArray3 = new string[] { "收入:", ((int) this.m_CurrentPageIncome).ToString("D"), "&nbsp;&nbsp;支出:", ((int) Math.Abs(this.m_CurrentPagePayout)).ToString("D"), "" };
                    string[] strArray4 = new string[5];
                    strArray4[0] = "收入:";
                    strArray4[1] = ((int) Math.Abs(num2)).ToString("D");
                    strArray4[2] = "&nbsp;&nbsp;支出:";
                    strArray4[3] = ((int) Math.Abs(num3)).ToString("D");
                    strArray4[4] = "";
                    footerRow.Cells[1].Controls.Add(CreateTable(string.Concat(strArray3), string.Concat(strArray4), "left"));
                    Table table2 = CreateTable("&nbsp;&nbsp;", string.Format(this.m_PointName + "余额:{0:0}", num2 - num3), "right");
                    table2.Rows[1].Cells[0].Attributes.Add("align", "center");
                    footerRow.Cells[2].Controls.Add(table2);
                }
            }
        }

        protected void EgvUserPoint_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                UserPointLogInfo dataItem = (UserPointLogInfo) e.Row.DataItem;
                if (dataItem != null)
                {
                    HyperLink link = (HyperLink) e.Row.FindControl("HypUserName");
                    if (string.IsNullOrEmpty(this.m_AdminName))
                    {
                        link.NavigateUrl = "~/User/Default.aspx?UserName=" + dataItem.UserName;
                    }
                    else
                    {
                        link.NavigateUrl = "~/Admin/User/UserShow.aspx?UserName=" + dataItem.UserName;
                    }
                    link.Text = dataItem.UserName;
                    Label label = (Label) e.Row.FindControl("LblIncomePayOut");
                    label.Text = this.GetIncomePayOut((float) dataItem.Point, dataItem.IncomePayOut);
                }
            }
        }

        public string GetIncomePayOut(float point, int incomePayOut)
        {
            StringBuilder builder = new StringBuilder();
            if (incomePayOut == 1)
            {
                builder.Append(" <span style='color:blue'> +" + ((int) point).ToString("D") + "</span>");
                this.m_CurrentPageIncome += point;
            }
            else
            {
                string str = ((int) point).ToString("D");
                builder.Append(" <span style='color:red'>");
                if (str == "0")
                {
                    builder.Append(str);
                }
                else
                {
                    builder.Append("-" + str);
                }
                builder.Append("</span>");
                this.m_CurrentPagePayout += point;
            }
            return builder.ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.EgvUserPoint.Columns[3].HeaderText = SiteConfig.UserConfig.PointName + "数";
            if (string.IsNullOrEmpty(this.HdnField.Value))
            {
                this.HdnField.Value = BaseUserControl.RequestInt32("Field").ToString();
            }
            if (string.IsNullOrEmpty(this.HdnKeyword.Value))
            {
                this.HdnKeyword.Value = BaseUserControl.RequestString("KeyWord");
            }
            if (string.IsNullOrEmpty(this.HdnSearchType.Value))
            {
                this.HdnSearchType.Value = BaseUserControl.RequestInt32("SearchType").ToString();
            }
            if (string.IsNullOrEmpty(this.m_AdminName))
            {
                this.EgvUserPoint.Columns[1].Visible = false;
                this.EgvUserPoint.Columns[5].Visible = false;
            }
        }

        public int Field
        {
            get
            {
                return DataConverter.CLng(this.HdnField.Value);
            }
            set
            {
                this.HdnField.Value = value.ToString();
            }
        }

        public string Keyword
        {
            get
            {
                return this.HdnKeyword.Value;
            }
            set
            {
                this.HdnKeyword.Value = value;
            }
        }

        public int SearchType
        {
            get
            {
                return DataConverter.CLng(this.HdnSearchType.Value);
            }
            set
            {
                this.HdnSearchType.Value = value.ToString();
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -