Пример #1
0
        public void CalculateMatchingCommission(string UserId, decimal LeftAmount, decimal rightAmount)
        {
            DataTable dt = new DataTable();
            genologyDAL genology = new genologyDAL();
            try
            {
                LumexDBPlayer db = LumexDBPlayer.Start(true);
                dt = genology.CalculateMatchingCommission(UserId, LeftAmount, rightAmount, db);
                db.Stop();
                //return dt;
            }
            catch (Exception)
            {

                throw;
            }
        }
Пример #2
0
        public DataTable find(string UserId)
        {
            DataTable dt = new DataTable();
            genologyDAL genology = new genologyDAL();
            try
            {
                LumexDBPlayer db = LumexDBPlayer.Start(true);
                dt = genology.find(UserId, db);
                db.Stop();
                return dt;
            }
            catch (Exception)
            {

                throw;
            }
        }
Пример #3
0
        public bool generateBainaryMatchData()
        {
            DataTable dt = new DataTable();
            genologyDAL genology = new genologyDAL();
            string LeftChild = "";
            string RightChild = "";
            bool status = false;
            DataRow dr = null;
            try
            {
                dt = getStakeJoiningList();
                DataTable dtnode = getMatchingNodeList();
                DataTable dtParent = getStakeJoiningParentList();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    InserNode = new DataTable();

                    InserNode.Columns.Add(new DataColumn("NodeId"));
                    InserNode.Columns.Add(new DataColumn("ChildId"));
                    InserNode.Columns.Add(new DataColumn("Amount"));
                    InserNode.Columns.Add(new DataColumn("Position"));
                    LeftChild = "";
                    RightChild = "";

                    findLeftRight(dt.Rows[i]["PleacementId"].ToString(), out LeftChild, out RightChild);
                    if (LeftChild != "")
                    {
                        viststack.Push(LeftChild);
                        DataView view = new DataView(dt);
                        view.RowFilter = "UserId = '" + LeftChild + "'";
                        DataView viewNode = new DataView(dtnode);
                        viewNode.Sort = "ChildId";
                        viewNode.RowFilter = "NodeID = '" + dt.Rows[i]["PleacementId"].ToString() + "'";
                        if (viewNode.Count > 0)
                        {
                            int index = viewNode.Find(view[0]["UserId"].ToString());
                            if (index == -1)
                            {
                                if (Convert.ToDecimal(view[0]["StakeAmount"].ToString()) > 0)
                                {
                                    dr = InserNode.NewRow();
                                    dr["NodeId"] = dt.Rows[i]["PleacementId"].ToString();
                                    dr["ChildId"] = view[0]["UserId"].ToString();
                                    dr["Amount"] = view[0]["StakeAmount"].ToString();
                                    dr["Position"] = "L";
                                    InserNode.Rows.Add(dr);
                                }

                            }
                        }
                        else
                        {
                            if (Convert.ToDecimal(view[0]["StakeAmount"].ToString()) > 0)
                            {
                                dr = InserNode.NewRow();
                                dr["NodeId"] = dt.Rows[i]["PleacementId"].ToString();
                                dr["ChildId"] = view[0]["UserId"].ToString();
                                dr["Amount"] = view[0]["StakeAmount"].ToString();
                                dr["Position"] = "L";
                                InserNode.Rows.Add(dr);
                            }

                        }

                        VisitChildrenByParentId(dt.Rows[i]["PleacementId"].ToString(), dt, dtnode, "L");
                    }

                    if (RightChild != "")
                    {
                        viststack.Push(RightChild);
                        DataView view = new DataView(dt);
                        view.RowFilter = "UserId = '" + RightChild + "'";
                        DataView viewNode = new DataView(dtnode);
                        viewNode.Sort = "ChildId";
                        viewNode.RowFilter = "NodeID = '" + dt.Rows[i]["PleacementId"].ToString() + "'";
                        if (viewNode.Count > 0)
                        {
                            int index = viewNode.Find(view[0]["UserId"].ToString());
                            if (index == -1)
                            {
                                if (Convert.ToDecimal(view[0]["StakeAmount"].ToString()) > 0)
                                {
                                    dr = InserNode.NewRow();
                                    dr["NodeId"] = dt.Rows[i]["PleacementId"].ToString();
                                    dr["ChildId"] = view[0]["UserId"].ToString();
                                    dr["Amount"] = view[0]["StakeAmount"].ToString();
                                    dr["Position"] = "R";
                                    InserNode.Rows.Add(dr);
                                }

                            }
                        }
                        else
                        {
                            if (Convert.ToDecimal(view[0]["StakeAmount"].ToString()) > 0)
                            {
                                dr = InserNode.NewRow();
                                dr["NodeId"] = dt.Rows[i]["PleacementId"].ToString();
                                dr["ChildId"] = view[0]["UserId"].ToString();
                                dr["Amount"] = view[0]["StakeAmount"].ToString();
                                dr["Position"] = "R";
                                InserNode.Rows.Add(dr);
                            }

                        }

                        VisitChildrenByParentId(dt.Rows[i]["PleacementId"].ToString(), dt, dtnode, "R");
                    }
                    if (InserNode.Rows.Count > 0)
                    {
                        insertIntoNodeList(InserNode);
                        status = true;
                    }

                }
                //LumexDBPlayer db = LumexDBPlayer.Start(true);
                //dt = genology.getStakeJoiningList(db);
                //db.Stop();
                // return dt;
                return status;
            }
            catch (Exception)
            {

                throw;
            }
        }
Пример #4
0
        private void insertIntoNodeList(DataTable dt)
        {
            genologyDAL genology = new genologyDAL();
            try
            {
                LumexDBPlayer db = LumexDBPlayer.Start(true);
                dt = genology.insertIntoNodeList(dt, db);
                db.Stop();

            }
            catch (Exception)
            {

                throw;
            }
        }
Пример #5
0
        private DataTable getStakeJoiningParentList()
        {
            DataTable dt = new DataTable();
            genologyDAL genology = new genologyDAL();
            try
            {
                LumexDBPlayer db = LumexDBPlayer.Start(true);
                dt = genology.getStakeJoiningParentList(db);
                db.Stop();
                return dt;
            }
            catch (Exception)
            {

                throw;
            }
        }
Пример #6
0
        public DataTable getNodeList()
        {
            DataTable dt = new DataTable();
            genologyDAL genology = new genologyDAL();
            try
            {
                LumexDBPlayer db = LumexDBPlayer.Start(true);
                dt = genology.getNodeList(db);
                db.Stop();
                return dt;
            }
            catch (Exception)
            {

                throw;
            }
        }
Пример #7
0
        public void getNodeLeftRightAmount(string UserId, out decimal LeftAmount, out decimal RightAmount)
        {
            LeftAmount = 0;
            RightAmount = 0;
            DataTable dt = new DataTable();
            genologyDAL genology = new genologyDAL();
            try
            {
                LumexDBPlayer db = LumexDBPlayer.Start(true);
                dt = genology.getNodeLeftRightAmount(UserId, db);
                db.Stop();
                if (dt.Rows.Count > 0)
                {
                    decimal.TryParse(dt.Rows[0][0].ToString(), out LeftAmount);
                    decimal.TryParse(dt.Rows[0][1].ToString(), out RightAmount);
                }
                //  return dt;
            }
            catch (Exception)
            {

                throw;
            }
        }
Пример #8
0
        public bool GenerateBinaryNodeByChileId(string UserId,string Amount)
        {
            bool status = false;
            DataTable dt = new DataTable();
            genologyDAL genology = new genologyDAL();

            DataRow dr = null;
            try
            {
                dt = getStakeJoiningList();
                InserNode = new DataTable();

                InserNode.Columns.Add(new DataColumn("NodeId"));
                InserNode.Columns.Add(new DataColumn("ChildId"));
                InserNode.Columns.Add(new DataColumn("Amount"));
                InserNode.Columns.Add(new DataColumn("Position"));
                viststack.Push(UserId);

                while (viststack.Count>0)
                {
                    string childId = viststack.Pop();
                     DataView view = new DataView(dt);
                     view.RowFilter = "UserId = '" + childId + "'";
                     if (view.Count > 0)
                     {
                           dr = InserNode.NewRow();
                           dr["NodeId"] = view[0]["PleacementId"].ToString();
                           dr["ChildId"] = UserId;
                           dr["Amount"] = Amount.ToString();
                           dr["Position"] =view[0]["PlacePosition"].ToString();
                           InserNode.Rows.Add(dr);

                            viststack.Push(view[0]["PleacementId"].ToString());
                     }

                }

                if (InserNode.Rows.Count > 0)
                {
                   insertIntoNodeList(InserNode);
                    status = true;
                }

                //LumexDBPlayer db = LumexDBPlayer.Start(true);
                //dt = genology.getStakeJoiningList(db);
                //db.Stop();
                // return dt;
                return status;
            }
            catch (Exception)
            {

                throw;
            }
        }