Exemple #1
0
        public void updateWalletBalance(int CurrentUserID)
        {
            int        ActiveCount = 0, ChildID = 0;
            TreeLevel3 t              = new TreeLevel3();
            Array      TotalChildList = t.GetLevel123TotalNodeList(CurrentUserID);

            //Convert Array Object to int Array
            int[] ChildList = TotalChildList.Cast <int>().ToArray();
            foreach (int i in ChildList)
            {
                ChildID = ChildList[i];
                if (db.CheckByQuery("select * from Member where ID=" + ChildID + " and Active='True'"))
                {
                    ActiveCount++;
                }
            }
            if (ActiveCount > 0)
            {
                int Amount = ActiveCount * db.getIntByQuery("select * from DollarRate where ID=1", "Rate");
                db.ChangeByQuery("update Wallet set Balance = Balance + " + Amount + " where MemberID=" + CurrentUserID);
            }
        }
Exemple #2
0
        public void updateWalletBalance(int MemberID)
        {
            DBBase     db             = new DBBase();
            TreeLevel3 t              = new TreeLevel3();
            Array      TotalChildList = t.GetLevel123TotalNodeList(MemberID);

            //Convert Array Object to int Array
            int[] ChildList = TotalChildList.Cast <int>().ToArray();
            for (int i = 0; i < ChildList.Length; i++)
            {
                ChildID = ChildList[i];
                //Check ChildID is Active
                if (db.CheckByQuery("select * from Member where ID=" + ChildID + " and Active='True'"))
                {
                    ActiveCount++;
                }
            }
            if (ActiveCount > 0)
            {
                int Amount = ActiveCount * db.getIntByQuery("select * from DollarRate where ID=1", "Rate");
                db.ChangeByQuery("update Wallet set Balance = Balance + " + Amount + " where MemberID=" + MemberID);
            }
        }
Exemple #3
0
        public void updateWalletBalance(int CurrentUserID)
        {
            int ActiveCount = 0, ChildID = 0; int Period = 0;
            int day = DateTime.Now.Day;

            if (day > 14 || day < 29)
            {
                Period = 1;
            }
            if (day == 30 || day == 31 || day < 14)
            {
                Period = 2;
            }
            TreeLevel3 t = new TreeLevel3();
            Array      TotalChildList = t.GetLevel123TotalNodeList(CurrentUserID);

            //Convert Array Object to int Array
            int[] ChildList = TotalChildList.Cast <int>().ToArray();
            for (int i = 0; i < ChildList.Length; i++)
            {
                ChildID = ChildList[i];
                if (db.CheckByQuery("select * from Member where ID=" + ChildID + " and Active='True'") && !(db.CheckByQuery("select * from Payment where MemberID=" + CurrentUserID + " and Child=" + ChildID + " and Period=" + Period)))
                {
                    db.ChangeByQuery("insert into Payment values(" + CurrentUserID + "," + ChildID + "," + Period + ")");
                    ActiveCount++;
                }
            }
            if (ActiveCount > 0)
            {
                int Amount = ActiveCount * db.getIntByQuery("select * from DollarRate where ID=1", "Rate");
                db.ChangeByQuery("update Wallet set Balance = Balance + " + Amount + " where MemberID=" + CurrentUserID);
            }
            if (day == 14 || day == 29)
            {
                db.ChangeByQuery("delete From Payment");
            }
        }