예제 #1
0
        public static ClsBuddy GetByBuddyID(int ID)
        {
            ClsBuddy obj = new ClsBuddy();
            ClsPeer _Peer = VMuktiAPI.VMuktiInfo.CurrentPeer;

            if (bool.Parse(VMuktiAPI.VMuktiInfo.Port80) && VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType != PeerType.BootStrap)
            {
                List<clsSqlParametersInfo> lstSP = new List<clsSqlParametersInfo>();

                clsSqlParametersInfo objInfo = new clsSqlParametersInfo();
                objInfo.Direction = "Input";
                objInfo.PName = "@pID";
                objInfo.PValue = ID;
                objInfo.PDBType = "Int";
                objInfo.PSize = 200;
                lstSP.Add(objInfo);

                clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                CSqlInfo.objParam = lstSP;


                //super node checking
                DataSet ds;
                try
                {
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;

                }
                catch (System.ServiceModel.EndpointNotFoundException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyId(int ID)", "clsBuddy.cs");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.CommunicationException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyId(int ID)", "clsBuddy.cs");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                }


                if (!obj.MapData(ds.Tables[0])) obj = null;
            }
            else
            {

            if (_Peer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
            {                
                List<clsSqlParametersInfo> lstSP = new List<clsSqlParametersInfo>();

                clsSqlParametersInfo objInfo = new clsSqlParametersInfo();
                objInfo.Direction = "Input";
                objInfo.PName = "@pID";
                objInfo.PValue = ID;                
                objInfo.PDBType = "Int";
                objInfo.PSize = 200;
                lstSP.Add(objInfo);

                clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                CSqlInfo.objParam = lstSP;

              
                //super node checking
                DataSet ds;
                try
                {
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                    
                }
                catch (System.ServiceModel.EndpointNotFoundException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyId(int ID)", "clsBuddy.cs");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.CommunicationException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyId(int ID)", "clsBuddy.cs");                 
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;  
                }
               
                
                if (!obj.MapData(ds.Tables[0])) obj = null;                
            }
            else
            {
                DataSet ds = new VMukti.DataAccess.ClsBuddyDataService().Buddy_GetByID(ID);
                if (!obj.MapData(ds.Tables[0])) obj = null;
            }
            }
            return obj;
        }
예제 #2
0
        public static ClsBuddy GetByBuddyID(int ID)
        {
            ClsBuddy obj   = new ClsBuddy();
            ClsPeer  _Peer = VMuktiAPI.VMuktiInfo.CurrentPeer;

            if (bool.Parse(VMuktiAPI.VMuktiInfo.Port80) && VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType != PeerType.BootStrap)
            {
                List <clsSqlParametersInfo> lstSP = new List <clsSqlParametersInfo>();

                clsSqlParametersInfo objInfo = new clsSqlParametersInfo();
                objInfo.Direction = "Input";
                objInfo.PName     = "@pID";
                objInfo.PValue    = ID;
                objInfo.PDBType   = "Int";
                objInfo.PSize     = 200;
                lstSP.Add(objInfo);

                clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                CSqlInfo.objParam = lstSP;


                //super node checking
                DataSet ds;
                try
                {
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.EndpointNotFoundException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyId(int ID)", "clsBuddy.cs");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.CommunicationException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyId(int ID)", "clsBuddy.cs");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                }


                if (!obj.MapData(ds.Tables[0]))
                {
                    obj = null;
                }
            }
            else
            {
                if (_Peer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
                {
                    List <clsSqlParametersInfo> lstSP = new List <clsSqlParametersInfo>();

                    clsSqlParametersInfo objInfo = new clsSqlParametersInfo();
                    objInfo.Direction = "Input";
                    objInfo.PName     = "@pID";
                    objInfo.PValue    = ID;
                    objInfo.PDBType   = "Int";
                    objInfo.PSize     = 200;
                    lstSP.Add(objInfo);

                    clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                    CSqlInfo.objParam = lstSP;


                    //super node checking
                    DataSet ds;
                    try
                    {
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.EndpointNotFoundException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByBuddyId(int ID)", "clsBuddy.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.CommunicationException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByBuddyId(int ID)", "clsBuddy.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGMyBuddy", CSqlInfo).dsInfo;
                    }


                    if (!obj.MapData(ds.Tables[0]))
                    {
                        obj = null;
                    }
                }
                else
                {
                    DataSet ds = new VMukti.DataAccess.ClsBuddyDataService().Buddy_GetByID(ID);
                    if (!obj.MapData(ds.Tables[0]))
                    {
                        obj = null;
                    }
                }
            }
            return(obj);
        }