public static ClsBuddy GetByBuddyID(int ID)
        {
            ClsBuddy obj = new ClsBuddy();

            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 = "BigInt";
                objInfo.PSize = 200;

                clsSqlParametersInfo objInfo2 = new clsSqlParametersInfo();
                objInfo2.Direction = "Input";
                objInfo2.PName = "@pUserID";
                objInfo2.PValue = -1;
                objInfo2.PDBType = "BigInt";
                objInfo2.PSize = 200;

                lstSP.Add(objInfo);
                lstSP.Add(objInfo2);

                clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                CSqlInfo.objParam = lstSP;
                DataSet ds;
                try
                {
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.EndpointNotFoundException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyID(int ID)", "clsBuddyReq.s");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.CommunicationException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyID(int ID)", "clsBuddyReq.s");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                if (!obj.MapData(ds.Tables[0])) obj = null;
            }
            else
            {

            if (VMuktiAPI.VMuktiInfo.CurrentPeer.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 = "BigInt";
                objInfo.PSize = 200;

                clsSqlParametersInfo objInfo2 = new clsSqlParametersInfo();
                objInfo2.Direction = "Input";
                objInfo2.PName = "@pUserID";
                objInfo2.PValue = -1;
                objInfo2.PDBType = "BigInt";
                objInfo2.PSize = 200;

                lstSP.Add(objInfo);
                lstSP.Add(objInfo2);

                clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                CSqlInfo.objParam = lstSP;
                DataSet ds;
                try
                {
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.EndpointNotFoundException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyID(int ID)", "clsBuddyReq.s");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                     ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.CommunicationException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyID(int ID)", "clsBuddyReq.s");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                     ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                if (!obj.MapData(ds.Tables[0])) obj = null;
            }
            else
            {
                DataSet ds = new VMukti.DataAccess.ClsBuddyReqDataService().BuddyReq_GetByID(ID);

                if (!obj.MapData(ds.Tables[0])) obj = null;
            }
            }
            return obj;
        }
Beispiel #2
0
        public static ClsBuddy GetByBuddyID(int ID)
        {
            ClsBuddy obj = new ClsBuddy();

            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   = "BigInt";
                objInfo.PSize     = 200;

                clsSqlParametersInfo objInfo2 = new clsSqlParametersInfo();
                objInfo2.Direction = "Input";
                objInfo2.PName     = "@pUserID";
                objInfo2.PValue    = -1;
                objInfo2.PDBType   = "BigInt";
                objInfo2.PSize     = 200;

                lstSP.Add(objInfo);
                lstSP.Add(objInfo2);

                clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                CSqlInfo.objParam = lstSP;
                DataSet ds;
                try
                {
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.EndpointNotFoundException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyID(int ID)", "clsBuddyReq.s");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                catch (System.ServiceModel.CommunicationException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "GetByBuddyID(int ID)", "clsBuddyReq.s");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                    ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                }
                if (!obj.MapData(ds.Tables[0]))
                {
                    obj = null;
                }
            }
            else
            {
                if (VMuktiAPI.VMuktiInfo.CurrentPeer.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   = "BigInt";
                    objInfo.PSize     = 200;

                    clsSqlParametersInfo objInfo2 = new clsSqlParametersInfo();
                    objInfo2.Direction = "Input";
                    objInfo2.PName     = "@pUserID";
                    objInfo2.PValue    = -1;
                    objInfo2.PDBType   = "BigInt";
                    objInfo2.PSize     = 200;

                    lstSP.Add(objInfo);
                    lstSP.Add(objInfo2);

                    clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                    CSqlInfo.objParam = lstSP;
                    DataSet ds;
                    try
                    {
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.EndpointNotFoundException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByBuddyID(int ID)", "clsBuddyReq.s");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.CommunicationException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByBuddyID(int ID)", "clsBuddyReq.s");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGBuddyRequest", CSqlInfo).dsInfo;
                    }
                    if (!obj.MapData(ds.Tables[0]))
                    {
                        obj = null;
                    }
                }
                else
                {
                    DataSet ds = new VMukti.DataAccess.ClsBuddyReqDataService().BuddyReq_GetByID(ID);

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