コード例 #1
0
ファイル: LinkBonusScale.aspx.cs プロジェクト: ichari/ichari
    private void BindData()
    {
        DataTable dt = new DAL.Tables.T_UnionLinkScale().Open("ID,UnionID,SiteLinkPID,BonusScale", "UnionID=" + _User.ID, "SiteLinkPID");

        DataTable dtLink = new DAL.Tables.T_Users().Open("distinct [Memo]", "Memo<>'' and CpsID=" + _User.cps.ID, "[Memo]");
       
        double scale = _Site.SiteOptions["BonusScale"].ToDouble(0.02);
       
        for (int i = 0; i < dtLink.Rows.Count; i++)
        {
            string pid = dtLink.Rows[i][0].ToString();
            DataRow[] drList = dt.Select("SiteLinkPID='" + pid + "'");
            if (drList.Length == 0)
            {
                DataRow dr = dt.NewRow();
                dr["ID"] = 0;
                dr["UnionID"] = _User.cps.ID;
                dr["SiteLinkPID"] = pid;
                dr["BonusScale"] = scale;
                dt.Rows.Add(dr);
            }
        }

        DataTable dtTemp = GetNewDataTable(dt, "SiteLinkPID like '%" + tbPID.Text.Trim() + "%'");

        PF.DataGridBindData(g, dtTemp, gPager);
    }
コード例 #2
0
ファイル: LinkList.aspx.cs プロジェクト: ichari/ichari
    protected DataTable GetTotal(DataTable dt)
    {
        if (dt.Columns.IndexOf("SiteMoney") == -1)
            dt.Columns.Add(new DataColumn("SiteMoney", typeof(decimal)));

        double scale = _Site.SiteOptions["BonusScale"].ToDouble(0.02);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string pid = dt.Rows[i]["PID"].ToString();
            DataTable dtSite = new DAL.Tables.T_UnionLinkScale().Open("BonusScale", "UnionID=" + _User.ID + " and SiteLinkPID='" + pid + "'", "BonusScale");
            
            if (dtSite != null && dtSite.Rows.Count > 0)
                scale = Shove._Convert.StrToDouble(dtSite.Rows[0][0].ToString(), 0);

            double tradeMoney = 0;
            if (!double.TryParse(dt.Rows[i]["TradeMoney"].ToString(), out tradeMoney))
            {
                tradeMoney = 0;
            }

            dt.Rows[i]["SiteMoney"] = tradeMoney * scale;
        }

        return dt;
    }