Exemplo n.º 1
0
        protected void TwtProfileDetails(string twtid)
        {
            TwitterAccountRepository objtwtAccRepo = new TwitterAccountRepository();
            TwitterAccount           arrTwtAcc     = objtwtAccRepo.getUserInfo(twtid);

            twtProfileId            = arrTwtAcc.TwitterUserId;
            divnameId.InnerHtml     = arrTwtAcc.TwitterScreenName;
            profileImg.ImageUrl     = arrTwtAcc.ProfileImageUrl;
            spanFollowers.InnerHtml = arrTwtAcc.FollowersCount.ToString();
        }
Exemplo n.º 2
0
        public string ProfilesConnected(string UserId, string access_token)
        {
            //if (!User.Identity.IsAuthenticated)
            //{
            //    return "Unauthorized access";
            //}
            try
            {

                Guid userid = Guid.Parse(UserId);
                SocialProfilesRepository socialRepo = new SocialProfilesRepository();
                List<Domain.Socioboard.Domain.SocialProfile> lstsocioprofile = socialRepo.getAllSocialProfilesOfUser(userid);
                List<profileConnected> lstProfile = new List<profileConnected>();
                foreach (Domain.Socioboard.Domain.SocialProfile sp in lstsocioprofile)
                {
                    profileConnected pc = new profileConnected();
                    pc.Id = sp.Id;
                    pc.ProfileDate = sp.ProfileDate;
                    pc.ProfileId = sp.ProfileId;
                    pc.ProfileStatus = sp.ProfileStatus;
                    pc.ProfileType = sp.ProfileType;
                    pc.UserId = sp.UserId;
                    if (sp.ProfileType == "facebook")
                    {
                        try
                        {
                            FacebookAccountRepository objFbAccRepo = new FacebookAccountRepository();
                            Domain.Socioboard.Domain.FacebookAccount objFbAcc = objFbAccRepo.getUserDetails(sp.ProfileId);
                            pc.ProfileName = objFbAcc.FbUserName;
                            pc.ProfileImgUrl = "http://graph.facebook.com/" + sp.ProfileId + "/picture?type=small";
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "twitter")
                    {
                        try
                        {
                            TwitterAccountRepository objTwtAccRepo = new TwitterAccountRepository();
                            Domain.Socioboard.Domain.TwitterAccount objTwtAcc = objTwtAccRepo.getUserInfo(sp.ProfileId);
                            pc.ProfileName = objTwtAcc.TwitterScreenName;
                            pc.ProfileImgUrl = objTwtAcc.ProfileImageUrl;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "instagram")
                    {
                        try
                        {
                            InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                            Domain.Socioboard.Domain.InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountById(sp.ProfileId);
                            pc.ProfileName = objInsAcc.InsUserName;
                            pc.ProfileImgUrl = objInsAcc.ProfileUrl;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "linkedin")
                    {
                        try
                        {
                            LinkedInAccountRepository objLiAccRepo = new LinkedInAccountRepository();
                            Domain.Socioboard.Domain.LinkedInAccount objLiAcc = objLiAccRepo.getLinkedinAccountDetailsById(sp.ProfileId);
                            pc.ProfileName = objLiAcc.LinkedinUserName;
                            pc.ProfileImgUrl = objLiAcc.ProfileImageUrl;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "googleplus")
                    {
                        try
                        {
                            GooglePlusAccountRepository objGpAccRepo = new GooglePlusAccountRepository();
                            Domain.Socioboard.Domain.GooglePlusAccount objGpAcc = objGpAccRepo.getUserDetails(sp.ProfileId);
                            pc.ProfileName = objGpAcc.GpUserName;
                            pc.ProfileImgUrl = objGpAcc.GpProfileImage;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "tumblr")
                    {
                        try
                        {
                            TumblrAccountRepository objTumblrAccountRepository = new TumblrAccountRepository();
                            Domain.Socioboard.Domain.TumblrAccount objTumblrAccount = objTumblrAccountRepository.getTumblrAccountDetailsById(sp.ProfileId);
                            pc.ProfileName = objTumblrAccount.tblrUserName;
                            pc.ProfileImgUrl = objTumblrAccount.tblrProfilePicUrl;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "youtube")
                    {
                        try
                        {
                            YoutubeAccountRepository objYoutubeAccountRepository = new YoutubeAccountRepository();
                            Domain.Socioboard.Domain.YoutubeAccount objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(sp.ProfileId);
                            pc.ProfileName = objYoutubeAccount.Ytusername;
                            pc.ProfileImgUrl = objYoutubeAccount.Ytprofileimage;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    lstProfile.Add(pc);
                }
                return new JavaScriptSerializer().Serialize(lstProfile);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return new JavaScriptSerializer().Serialize("Please Try Again");
            }
        }
Exemplo n.º 3
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            User           user     = new User();
            UserRepository userrepo = new UserRepository();

            SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
            try
            {
                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    user.PaymentStatus = "unpaid";
                    user.AccountType   = Request.QueryString["type"];
                    if (user.AccountType == string.Empty)
                    {
                        user.AccountType = AccountType.Deluxe.ToString();
                    }
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Id         = Guid.NewGuid();
                    user.UserName   = txtFirstName.Text + " " + txtLastName.Text;
                    user.Password   = this.MD5Hash(txtPassword.Text);
                    user.EmailId    = txtEmail.Text;
                    user.UserStatus = 1;
                    if (!userrepo.IsUserExist(user.EmailId))
                    {
                        UserRepository.Add(user);
                        SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text);

                        TeamRepository teamRepo = new TeamRepository();
                        Team           team     = teamRepo.getTeamByEmailId(txtEmail.Text);
                        if (team != null)
                        {
                            Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                            teamRepo.updateTeamStatus(teamid);


                            TeamMemberProfileRepository teamMemRepo   = new TeamMemberProfileRepository();
                            List <TeamMemberProfile>    lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id);
                            foreach (TeamMemberProfile item in lstteammember)
                            {
                                try
                                {
                                    SocialProfilesRepository socialRepo   = new SocialProfilesRepository();
                                    SocialProfile            socioprofile = new SocialProfile();
                                    socioprofile.Id          = Guid.NewGuid();
                                    socioprofile.ProfileDate = DateTime.Now;
                                    socioprofile.ProfileId   = item.ProfileId;
                                    socioprofile.ProfileType = item.ProfileType;
                                    socioprofile.UserId      = user.Id;
                                    socialRepo.addNewProfileForUser(socioprofile);

                                    if (item.ProfileType == "facebook")
                                    {
                                        try
                                        {
                                            FacebookAccount           fbAccount     = new FacebookAccount();
                                            FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository();
                                            FacebookAccount           userAccount   = fbAccountRepo.getUserDetails(item.ProfileId);
                                            fbAccount.AccessToken = userAccount.AccessToken;
                                            fbAccount.EmailId     = userAccount.EmailId;
                                            fbAccount.FbUserId    = item.ProfileId;
                                            fbAccount.FbUserName  = userAccount.FbUserName;
                                            fbAccount.Friends     = userAccount.Friends;
                                            fbAccount.Id          = Guid.NewGuid();
                                            fbAccount.IsActive    = true;
                                            fbAccount.ProfileUrl  = userAccount.ProfileUrl;
                                            fbAccount.Type        = userAccount.Type;
                                            fbAccount.UserId      = user.Id;
                                            fbAccountRepo.addFacebookUser(fbAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "twitter")
                                    {
                                        try
                                        {
                                            TwitterAccount           twtAccount = new TwitterAccount();
                                            TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                            TwitterAccount           twtAcc     = twtAccRepo.getUserInfo(item.ProfileId);
                                            twtAccount.FollowersCount    = twtAcc.FollowersCount;
                                            twtAccount.FollowingCount    = twtAcc.FollowingCount;
                                            twtAccount.Id                = Guid.NewGuid();
                                            twtAccount.IsActive          = true;
                                            twtAccount.OAuthSecret       = twtAcc.OAuthSecret;
                                            twtAccount.OAuthToken        = twtAcc.OAuthToken;
                                            twtAccount.ProfileImageUrl   = twtAcc.ProfileImageUrl;
                                            twtAccount.ProfileUrl        = twtAcc.ProfileUrl;
                                            twtAccount.TwitterName       = twtAcc.TwitterName;
                                            twtAccount.TwitterScreenName = twtAcc.TwitterScreenName;
                                            twtAccount.TwitterUserId     = twtAcc.TwitterUserId;
                                            twtAccount.UserId            = user.Id;
                                            twtAccRepo.addTwitterkUser(twtAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "instagram")
                                    {
                                        try
                                        {
                                            InstagramAccount           insAccount = new InstagramAccount();
                                            InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                                            InstagramAccount           InsAcc     = insAccRepo.getInstagramAccountById(item.ProfileId);
                                            insAccount.AccessToken = InsAcc.AccessToken;
                                            insAccount.FollowedBy  = InsAcc.FollowedBy;
                                            insAccount.Followers   = InsAcc.Followers;
                                            insAccount.Id          = Guid.NewGuid();
                                            insAccount.InstagramId = item.ProfileId;
                                            insAccount.InsUserName = InsAcc.InsUserName;
                                            insAccount.IsActive    = true;
                                            insAccount.ProfileUrl  = InsAcc.ProfileUrl;
                                            insAccount.TotalImages = InsAcc.TotalImages;
                                            insAccount.UserId      = user.Id;
                                            insAccRepo.addInstagramUser(insAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "linkedin")
                                    {
                                        try
                                        {
                                            LinkedInAccount           linkAccount       = new LinkedInAccount();
                                            LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository();
                                            LinkedInAccount           linkAcc           = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId);
                                            linkAccount.Id               = Guid.NewGuid();
                                            linkAccount.IsActive         = true;
                                            linkAccount.LinkedinUserId   = item.ProfileId;
                                            linkAccount.LinkedinUserName = linkAcc.LinkedinUserName;
                                            linkAccount.OAuthSecret      = linkAcc.OAuthSecret;
                                            linkAccount.OAuthToken       = linkAcc.OAuthToken;
                                            linkAccount.OAuthVerifier    = linkAcc.OAuthVerifier;
                                            linkAccount.ProfileImageUrl  = linkAcc.ProfileImageUrl;
                                            linkAccount.ProfileUrl       = linkAcc.ProfileUrl;
                                            linkAccount.UserId           = user.Id;
                                            linkedAccountRepo.addLinkedinUser(linkAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                }
                            }
                        }


                        lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>";
                    }
                    else
                    {
                        lblerror.Text = "Email Already Exists " + "<a href=\"Default.aspx\">login</a>";
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                lblerror.Text = "Please Insert Correct Information";
                Console.WriteLine(ex.StackTrace);
            }
        }
Exemplo n.º 4
0
 public string ProfilesConnected(string UserId)
 {
     try
     {
         Guid userid = Guid.Parse(UserId);
         SocialProfilesRepository socialRepo      = new SocialProfilesRepository();
         List <SocialProfile>     lstsocioprofile = socialRepo.getAllSocialProfilesOfUser(userid);
         List <profileConnected>  lstProfile      = new List <profileConnected>();
         foreach (SocialProfile sp in lstsocioprofile)
         {
             profileConnected pc = new profileConnected();
             pc.Id            = sp.Id;
             pc.ProfileDate   = sp.ProfileDate;
             pc.ProfileId     = sp.ProfileId;
             pc.ProfileStatus = sp.ProfileStatus;
             pc.ProfileType   = sp.ProfileType;
             pc.UserId        = sp.UserId;
             if (sp.ProfileType == "facebook")
             {
                 try
                 {
                     FacebookAccountRepository objFbAccRepo = new FacebookAccountRepository();
                     FacebookAccount           objFbAcc     = objFbAccRepo.getUserDetails(sp.ProfileId);
                     pc.ProfileName   = objFbAcc.FbUserName;
                     pc.ProfileImgUrl = "http://graph.facebook.com/" + sp.ProfileId + "/picture?type=small";
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "twitter")
             {
                 try
                 {
                     TwitterAccountRepository objTwtAccRepo = new TwitterAccountRepository();
                     TwitterAccount           objTwtAcc     = objTwtAccRepo.getUserInfo(sp.ProfileId);
                     pc.ProfileName   = objTwtAcc.TwitterScreenName;
                     pc.ProfileImgUrl = objTwtAcc.ProfileImageUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "instagram")
             {
                 try
                 {
                     InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                     InstagramAccount           objInsAcc     = objInsAccRepo.getInstagramAccountById(sp.ProfileId);
                     pc.ProfileName   = objInsAcc.InsUserName;
                     pc.ProfileImgUrl = objInsAcc.ProfileUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "linkedin")
             {
                 try
                 {
                     LinkedInAccountRepository objLiAccRepo = new LinkedInAccountRepository();
                     LinkedInAccount           objLiAcc     = objLiAccRepo.getLinkedinAccountDetailsById(sp.ProfileId);
                     pc.ProfileName   = objLiAcc.LinkedinUserName;
                     pc.ProfileImgUrl = objLiAcc.ProfileImageUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "googleplus")
             {
                 try
                 {
                     GooglePlusAccountRepository objGpAccRepo = new GooglePlusAccountRepository();
                     GooglePlusAccount           objGpAcc     = objGpAccRepo.getUserDetails(sp.ProfileId);
                     pc.ProfileName   = objGpAcc.GpUserName;
                     pc.ProfileImgUrl = objGpAcc.GpProfileImage;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             lstProfile.Add(pc);
         }
         return(new JavaScriptSerializer().Serialize(lstProfile));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(new JavaScriptSerializer().Serialize("Please Try Again"));
     }
 }
Exemplo n.º 5
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                User             user                = new User();
                UserRepository   userrepo            = new UserRepository();
                UserActivation   objUserActivation   = new UserActivation();
                Coupon           objCoupon           = new Coupon();
                CouponRepository objCouponRepository = new CouponRepository();
                Groups           groups              = new Groups();
                GroupRepository  objGroupRepository  = new GroupRepository();
                Team             teams               = new Team();
                TeamRepository   objTeamRepository   = new TeamRepository();


                SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                try
                {
                    if (DropDownList1.SelectedValue == "Free" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium" || DropDownList1.SelectedValue == "SocioBasic" || DropDownList1.SelectedValue == "SocioStandard" || DropDownList1.SelectedValue == "SocioPremium" || DropDownList1.SelectedValue == "SocioDeluxe")


                    {
                        if (TextBox1.Text.Trim() != "")
                        {
                            string resp = SBUtils.GetCouponStatus(TextBox1.Text).ToString();
                            if (resp != "valid")
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + resp + "');", true);
                                return;
                            }
                        }



                        if (txtPassword.Text == txtConfirmPassword.Text)
                        {
                            user.PaymentStatus = "unpaid";
                            user.AccountType   = DropDownList1.SelectedValue.ToString();
                            if (string.IsNullOrEmpty(user.AccountType))
                            {
                                user.AccountType = AccountType.Free.ToString();
                            }


                            user.CreateDate       = DateTime.Now;
                            user.ExpiryDate       = DateTime.Now.AddDays(30);
                            user.Id               = Guid.NewGuid();
                            user.UserName         = txtFirstName.Text + " " + txtLastName.Text;
                            user.Password         = this.MD5Hash(txtPassword.Text);
                            user.EmailId          = txtEmail.Text;
                            user.UserStatus       = 1;
                            user.ActivationStatus = "0";

                            if (TextBox1.Text.Trim() != "")
                            {
                                user.CouponCode = TextBox1.Text.Trim().ToString();
                            }


                            if (!userrepo.IsUserExist(user.EmailId))
                            {
                                logger.Error("Before User reg");
                                UserRepository.Add(user);



                                try
                                {
                                    groups.Id        = Guid.NewGuid();
                                    groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"];
                                    groups.UserId    = user.Id;
                                    groups.EntryDate = DateTime.Now;

                                    objGroupRepository.AddGroup(groups);


                                    teams.Id      = Guid.NewGuid();
                                    teams.GroupId = groups.Id;
                                    teams.UserId  = user.Id;
                                    teams.EmailId = user.EmailId;

                                    objTeamRepository.addNewTeam(teams);



                                    BusinessSettingRepository busnrepo = new BusinessSettingRepository();

                                    SocioBoard.Domain.BusinessSetting objbsnssetting = new SocioBoard.Domain.BusinessSetting();

                                    if (!busnrepo.checkBusinessExists(user.Id, groups.GroupName))
                                    {
                                        objbsnssetting.Id               = Guid.NewGuid();
                                        objbsnssetting.BusinessName     = groups.GroupName;
                                        objbsnssetting.GroupId          = groups.Id;
                                        objbsnssetting.AssigningTasks   = false;
                                        objbsnssetting.AssigningTasks   = false;
                                        objbsnssetting.TaskNotification = false;
                                        objbsnssetting.TaskNotification = false;
                                        objbsnssetting.FbPhotoUpload    = 0;
                                        objbsnssetting.UserId           = user.Id;
                                        objbsnssetting.EntryDate        = DateTime.Now;
                                        busnrepo.AddBusinessSetting(objbsnssetting);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("Error : " + ex.Message);
                                    logger.Error("Error : " + ex.StackTrace);
                                }


                                try
                                {
                                    logger.Error("1 Request.QueryString[refid]");
                                    if (Request.QueryString["refid"] != null)
                                    {
                                        logger.Error("3 Request.QueryString[refid]");
                                        User UserValid = null;
                                        if (IsUserValid(Request.QueryString["refid"].ToString(), ref UserValid))
                                        {
                                            logger.Error("Inside IsUserValid");
                                            user.RefereeStatus = "1";
                                            UpdateUserReference(UserValid);
                                            AddUserRefreeRelation(user, UserValid);

                                            logger.Error("IsUserValid");
                                        }
                                        else
                                        {
                                            user.RefereeStatus = "0";
                                        }
                                    }
                                    logger.Error("2 Request.QueryString[refid]");
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("btnRegister_Click" + ex.Message);
                                    logger.Error("btnRegister_Click" + ex.StackTrace);
                                }



                                if (TextBox1.Text.Trim() != "")
                                {
                                    objCoupon.CouponCode = TextBox1.Text.Trim();
                                    List <Coupon> lstCoupon = objCouponRepository.GetCouponByCouponCode(objCoupon);
                                    objCoupon.Id = lstCoupon[0].Id;
                                    objCoupon.EntryCouponDate = lstCoupon[0].EntryCouponDate;
                                    objCoupon.ExpCouponDate   = lstCoupon[0].ExpCouponDate;
                                    objCoupon.Status          = "1";
                                    objCouponRepository.SetCouponById(objCoupon);
                                }

                                Session["LoggedUser"]              = user;
                                objUserActivation.Id               = Guid.NewGuid();
                                objUserActivation.UserId           = user.Id;
                                objUserActivation.ActivationStatus = "0";
                                UserActivationRepository.Add(objUserActivation);

                                //add package start

                                UserPackageRelation           objUserPackageRelation           = new UserPackageRelation();
                                UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();
                                PackageRepository             objPackageRepository             = new PackageRepository();

                                try
                                {
                                    Package objPackage = objPackageRepository.getPackageDetails(user.AccountType);
                                    objUserPackageRelation.Id            = Guid.NewGuid();
                                    objUserPackageRelation.PackageId     = objPackage.Id;
                                    objUserPackageRelation.UserId        = user.Id;
                                    objUserPackageRelation.ModifiedDate  = DateTime.Now;
                                    objUserPackageRelation.PackageStatus = true;

                                    objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }

                                //end package

                                SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString());
                                TeamRepository teamRepo = new TeamRepository();
                                try
                                {
                                    Team team = teamRepo.getTeamByEmailId(txtEmail.Text);
                                    if (team != null)
                                    {
                                        Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                                        teamRepo.updateTeamStatus(teamid);
                                        TeamMemberProfileRepository teamMemRepo   = new TeamMemberProfileRepository();
                                        List <TeamMemberProfile>    lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id);
                                        foreach (TeamMemberProfile item in lstteammember)
                                        {
                                            try
                                            {
                                                SocialProfilesRepository socialRepo   = new SocialProfilesRepository();
                                                SocialProfile            socioprofile = new SocialProfile();
                                                socioprofile.Id          = Guid.NewGuid();
                                                socioprofile.ProfileDate = DateTime.Now;
                                                socioprofile.ProfileId   = item.ProfileId;
                                                socioprofile.ProfileType = item.ProfileType;
                                                socioprofile.UserId      = user.Id;
                                                socialRepo.addNewProfileForUser(socioprofile);

                                                if (item.ProfileType == "facebook")
                                                {
                                                    try
                                                    {
                                                        FacebookAccount           fbAccount     = new FacebookAccount();
                                                        FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository();
                                                        FacebookAccount           userAccount   = fbAccountRepo.getUserDetails(item.ProfileId);
                                                        fbAccount.AccessToken = userAccount.AccessToken;
                                                        fbAccount.EmailId     = userAccount.EmailId;
                                                        fbAccount.FbUserId    = item.ProfileId;
                                                        fbAccount.FbUserName  = userAccount.FbUserName;
                                                        fbAccount.Friends     = userAccount.Friends;
                                                        fbAccount.Id          = Guid.NewGuid();
                                                        fbAccount.IsActive    = 1;
                                                        fbAccount.ProfileUrl  = userAccount.ProfileUrl;
                                                        fbAccount.Type        = userAccount.Type;
                                                        fbAccount.UserId      = user.Id;
                                                        fbAccountRepo.addFacebookUser(fbAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.Message);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "twitter")
                                                {
                                                    try
                                                    {
                                                        TwitterAccount           twtAccount = new TwitterAccount();
                                                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                                        TwitterAccount           twtAcc     = twtAccRepo.getUserInfo(item.ProfileId);
                                                        twtAccount.FollowersCount    = twtAcc.FollowersCount;
                                                        twtAccount.FollowingCount    = twtAcc.FollowingCount;
                                                        twtAccount.Id                = Guid.NewGuid();
                                                        twtAccount.IsActive          = true;
                                                        twtAccount.OAuthSecret       = twtAcc.OAuthSecret;
                                                        twtAccount.OAuthToken        = twtAcc.OAuthToken;
                                                        twtAccount.ProfileImageUrl   = twtAcc.ProfileImageUrl;
                                                        twtAccount.ProfileUrl        = twtAcc.ProfileUrl;
                                                        twtAccount.TwitterName       = twtAcc.TwitterName;
                                                        twtAccount.TwitterScreenName = twtAcc.TwitterScreenName;
                                                        twtAccount.TwitterUserId     = twtAcc.TwitterUserId;
                                                        twtAccount.UserId            = user.Id;
                                                        twtAccRepo.addTwitterkUser(twtAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "instagram")
                                                {
                                                    try
                                                    {
                                                        InstagramAccount           insAccount = new InstagramAccount();
                                                        InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                                                        InstagramAccount           InsAcc     = insAccRepo.getInstagramAccountById(item.ProfileId);
                                                        insAccount.AccessToken = InsAcc.AccessToken;
                                                        insAccount.FollowedBy  = InsAcc.FollowedBy;
                                                        insAccount.Followers   = InsAcc.Followers;
                                                        insAccount.Id          = Guid.NewGuid();
                                                        insAccount.InstagramId = item.ProfileId;
                                                        insAccount.InsUserName = InsAcc.InsUserName;
                                                        insAccount.IsActive    = true;
                                                        insAccount.ProfileUrl  = InsAcc.ProfileUrl;
                                                        insAccount.TotalImages = InsAcc.TotalImages;
                                                        insAccount.UserId      = user.Id;
                                                        insAccRepo.addInstagramUser(insAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "linkedin")
                                                {
                                                    try
                                                    {
                                                        LinkedInAccount           linkAccount       = new LinkedInAccount();
                                                        LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository();
                                                        LinkedInAccount           linkAcc           = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId);
                                                        linkAccount.Id               = Guid.NewGuid();
                                                        linkAccount.IsActive         = true;
                                                        linkAccount.LinkedinUserId   = item.ProfileId;
                                                        linkAccount.LinkedinUserName = linkAcc.LinkedinUserName;
                                                        linkAccount.OAuthSecret      = linkAcc.OAuthSecret;
                                                        linkAccount.OAuthToken       = linkAcc.OAuthToken;
                                                        linkAccount.OAuthVerifier    = linkAcc.OAuthVerifier;
                                                        linkAccount.ProfileImageUrl  = linkAcc.ProfileImageUrl;
                                                        linkAccount.ProfileUrl       = linkAcc.ProfileUrl;
                                                        linkAccount.UserId           = user.Id;
                                                        linkedAccountRepo.addLinkedinUser(linkAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                logger.Error(ex.Message);
                                            }
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }

                                #region SetInvitationStatusAfterSuccessfulRegistration
                                try
                                {
                                    if (Request.QueryString["refid"] != null)
                                    {
                                        string refid = Request.QueryString["refid"];

                                        int res = SetInvitationStatusAfterSuccessfulRegistration(refid, txtEmail.Text);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                }
                                #endregion


                                try
                                {
                                    lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>";
                                    Response.Redirect("~/Home.aspx");
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                            else
                            {
                                lblerror.Text = "Email Already Exists " + "<a id=\"loginlink\"  href=\"#\">login</a>";
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true);
                    }
                }

                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    lblerror.Text = "Success!";
                    Console.WriteLine(ex.StackTrace);
                    //Response.Redirect("Home.aspx");
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);

                Console.WriteLine(ex.StackTrace);
                //Response.Redirect("Home.aspx");
            }
        }