Example #1
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);
        }
Example #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;
        }
        void ctlBuddyGrid_btnAcceptClicked(object sender, RoutedEventArgs e)
        {
            try
            {
                ClsBuddy objBuddy = new ClsBuddy();
                objBuddy.ID = -1;
                objBuddy.UserID = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
                objBuddy.MyUserID = objBuddyReqCollection[int.Parse(((Button)sender).Tag.ToString())].ReqUserID;
                objBuddy.Save();

                objBuddyReqCollection[int.Parse(((Button)sender).Tag.ToString())].Delete();

                ClsBuddyCollection MyBuddies = ClsBuddyCollection.GetByMyUserID(VMuktiAPI.VMuktiInfo.CurrentPeer.ID);
                if (MyBuddies != null)
                {
                    lstBuddies.Items.Clear();
                    for (int i = 0; i < MyBuddies.Count; i++)
                    {
                        CtlExpanderItem objExpanderItem = new CtlExpanderItem();
                        objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                        objExpanderItem.VerticalAlignment = VerticalAlignment.Stretch;
                        objExpanderItem.Image = @"\Images\Buddy.Png";
                        objExpanderItem.Caption = MyBuddies[i].DisplayName;

                        ListBoxItem lstiBuddy = new ListBoxItem();
                        lstiBuddy.Content = objExpanderItem;
                        lstiBuddy.AllowDrop = true;
                        lstiBuddy.Tag = MyBuddies[i].ID.ToString() + "," + MyBuddies[i].DisplayName;

                        lstiBuddy.PreviewMouseDown += new MouseButtonEventHandler(lstiBuddy_PreviewMouseDown);
                        lstBuddies.Items.Add(lstiBuddy);
                    }
                }

                lstBuddies.Items.Remove(((Canvas)((Button)sender).Parent).Parent);
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "ctlBuddyGrid_btnAcceptClicked()", "Controls\\CtlBuddyList.xaml.cs");
            }
        }