Beispiel #1
0
 //Level 0 is Total. Level 123
 public int GetTotalNode(int Parent, int level)
 {
     Tree t = new Tree();
     int result = 0;
     if (level == 0)
     {
         if (t.CheckRootIsChilden(Parent))
         {
             Array Child = t.GetTotalNode(Parent);
             result= Child.Length;
         }
     }
     else if(level == 1)
     {
         if (t.CheckRootIsChilden(Parent))
         {
             Array Child = t.GetLevel1(Parent);
             result = Child.Length;
         }
     }
     else if(level == 2)
     {
         TreeLevel2 t1 = new TreeLevel2();
         if (t1.CheckRootIsChilden(Parent))
         {
             Array Child = t1.GetLevel2(Parent);
             foreach (int i in Child)
             {
                 result = Child.Length;
             }
         }
     }
     else if (level == 3)
     {
         TreeLevel3 t2 = new TreeLevel3();
         if (t.CheckRootIsChilden(Parent))
         {
             Array Child = t2.GetLevel3(Parent);
             foreach (int i in Child)
             {
                 result = Child.Length;
             }
         }
     }
     else if (level == 123)
     {
         TreeLevel3 t2 = new TreeLevel3();
         if (t.CheckRootIsChilden(Parent))
         {
             result = t2.GetLevel123TotalNode(Parent);
         }
     }
     return result;
 }
Beispiel #2
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);
            }
        }
Beispiel #3
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);
            }
        }
Beispiel #4
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");
            }
        }
Beispiel #5
0
 public Array GetTotalNodeList(int Parent, int level)
 {
     Tree t = new Tree();
     Array Result = new Array[0];
     if (level == 0)
     {
         if (t.CheckRootIsChilden(Parent))
         {
             Result = t.GetTotalNode(Parent);
         }
     }
     else if (level == 1)
     {
         if (t.CheckRootIsChilden(Parent))
         {
             Result = t.GetLevel1(Parent);
         }
     }
     else if (level == 2)
     {
         TreeLevel2 t1 = new TreeLevel2();
         if (t1.CheckRootIsChilden(Parent))
         {
             Result = t1.GetLevel2(Parent);
         }
     }
     else if (level == 3)
     {
         TreeLevel3 t2 = new TreeLevel3();
         if (t.CheckRootIsChilden(Parent))
         {
             Result = t2.GetLevel3(Parent);
         }
     }
     return Result;
 }