예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            CommissionBLL _cBLL  = new CommissionBLL();
            var           _cList = _cBLL.GetByReceivedUserId(BitcoinSession.LoginMemberId);

            rptMyBonus.DataSource = _cList;
            rptMyBonus.DataBind();
        }
    }
예제 #2
0
    // Compute commission after confirmed PH
    private void SetCommission(int LevelID, float AmountReceived, int CTypeIndex)
    {
        UserBLL _userBLL = new UserBLL();

        //Lấy ID người cho
        int FromUserId = LevelID;//ID người cho
        var _FromUser  = _userBLL.GetByUserID(FromUserId);

        if (_FromUser == null)
        {
            return;
        }

        //Lấy ID người nhận tiền hoa hồng gioi thieu truc tiep
        int ToUserId = 0;
        var _ToUser  = _userBLL.GetByEmailID(_FromUser.SponsorID);

        if (_ToUser == null)
        {
            return;
        }
        ToUserId = _ToUser.UserID;

        float CommissionPrice = (AmountReceived * Convert.ToInt32(_ToUser.Level.Rate)) / 100;

        Commission _c = new Commission();

        _c.FromUserId      = FromUserId;
        _c.ToUserId        = ToUserId;
        _c.CommissionPrice = CommissionPrice;
        _c.CommissionDate  = DateTime.Now;
        _c.CommissionType  = CTypeIndex;//Nhận tiền hoa hồng giới thiệu tu cap duoi

        CommissionBLL _cBLL = new CommissionBLL();

        _cBLL.Insert(_c);

        SetCommission(_ToUser.UserID, CommissionPrice, CTypeIndex + 1);
    }