Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string msg = string.Empty;
            if (!IsPostBack)
            {

                if (Session["AdminProfile"] == null)
                {
                    Response.Redirect("Default.aspx");
                }

                try
                {
                    //User user = new User();
                    PackageRepository objPgeRepo = new PackageRepository();

                    // ddlPackage.Items.Insert();
                    int aa = objUerRepo.DeleteUser(Guid.Parse(Request.QueryString["id"]));
                    if (aa > 0)
                    {
                        msg = "success";
                    }
                    else
                    {
                        msg = "Not Deleted";
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    msg = ex.Message;
                }
            }
            Response.Write(msg);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                User user = (User)Session["LoggedUser"];

                if (user == null)
                    Response.Redirect("/Default.aspx");
                PackageRepository packageRepo = new PackageRepository();
                divcreatedate.InnerHtml = "Subscription begins - " + user.CreateDate.ToString();
                plantype.InnerHtml = user.AccountType;
                if (user.AccountType.ToLower() == AccountType.Standard.ToString().ToLower())
                {
                    Package pack = packageRepo.getPackageDetails(AccountType.Standard.ToString());
                    priceofplan.InnerHtml = "$" + pack.Pricing;
                    rateExtra.InnerHtml = "$" + pack.Pricing;
                    monthly.InnerHtml = "$" + pack.Pricing;
                }
                else if (user.AccountType.ToLower() == AccountType.Deluxe.ToString().ToLower())
                {
                    Package pack = packageRepo.getPackageDetails(AccountType.Deluxe.ToString());
                    priceofplan.InnerHtml = "$" + pack.Pricing;
                    rateExtra.InnerHtml = "$" + pack.Pricing;
                    monthly.InnerHtml = "$" + pack.Pricing;
                }
                else if (user.AccountType.ToLower() == AccountType.Premium.ToString().ToLower())
                {
                    Package pack = packageRepo.getPackageDetails(AccountType.Premium.ToString());
                    priceofplan.InnerHtml = "$" + pack.Pricing;
                    rateExtra.InnerHtml = "$" + pack.Pricing;
                    monthly.InnerHtml = "$" + pack.Pricing;

                }
            }
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             User user = new User();
             PackageRepository objPgeRepo = new PackageRepository();
             ddlPackage.DataSource = objPgeRepo.getAllPackage();
             ddlPackage.DataTextField = "PackageName";
             ddlPackage.DataValueField = "PackageName";
             ddlPackage.DataBind();
             // ddlPackage.Items.Insert();
             user = objUerRepo.getUsersById(Guid.Parse(Request.QueryString["id"].ToString()));
             if (user != null)
             {
                 txtName.Text = user.UserName;
                 txtEmail.Text = user.EmailId;
                 // txtdatepicker.Text = user.ExpiryDate.ToString();
                 datepicker.Text = user.ExpiryDate.ToString();
                 ddlPackage.SelectedValue = user.AccountType.ToString(); //user.PaymentStatus;
                 ddlStatus.SelectedValue = user.UserStatus.ToString();
             }
         }
         catch (Exception ex)
         {
             logger.Error(ex.StackTrace);
         }
     }
 }
Exemplo n.º 4
0
        public void Payment(object sender, EventArgs e)
        {
            User user = (User)Session["LoggedUser"];
            SocioBoard.Helper.Payment payme = new SocioBoard.Helper.Payment();
            string amount = string.Empty;
            string plantype = string.Empty;

            PackageRepository packRepo = new PackageRepository();
            if (user.AccountType.ToLower() == AccountType.Standard.ToString().ToLower())
            {
               Package pack = packRepo.getPackageDetails(AccountType.Standard.ToString());
                plantype = "StandardPlan of blackSheep";
                amount = pack.Pricing.ToString();
            }
            else if (user.AccountType.ToLower() == AccountType.Deluxe.ToString().ToLower())
            {
                Package pack = packRepo.getPackageDetails(AccountType.Deluxe.ToString());
                plantype = "DeluxePlan of blackSheep";
                amount = pack.Pricing.ToString();
            }
            else if (user.AccountType.ToLower() == AccountType.Premium.ToString().ToLower())
            {
                Package pack = packRepo.getPackageDetails(AccountType.Premium.ToString());
                plantype = "PremiumPlan of blackSheep";
                amount = pack.Pricing.ToString();
            }

            string pay = payme.PayWithPayPal(amount, plantype, user.UserName, "", user.EmailId, "USD", ConfigurationManager.AppSettings["paypalemail"], ConfigurationManager.AppSettings["SuccessURL"],
                                  ConfigurationManager.AppSettings["FailedURL"], ConfigurationManager.AppSettings["SuccessURL"], ConfigurationManager.AppSettings["cancelurl"], ConfigurationManager.AppSettings["notifyurl"], user.Id.ToString());
            Response.Redirect(pay);
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                if (Session["AdminProfile"] == null)
                {
                    Response.Redirect("Default.aspx");
                }

                try
                {
                    PackageRepository objPkgRepo = new PackageRepository();
                    List<Package> lstPkg = objPkgRepo.getAllPackage();
                    string strPackage = string.Empty;
                    foreach (var item in lstPkg)
                    {
                        strPackage += "<tr class=\"gradeX\"><td><a href=\"AddPackage.aspx?id=" + item.Id + "\">Edit</a></td><td>" + item.PackageName + "</td><td>" + item.Pricing + "</td><td>" + item.EntryDate + "</td><td class=\"center\">" + item.Status + "</td></tr>";
                    }
                    divPackage.InnerHtml = strPackage;
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
        }
Exemplo n.º 6
0
        public void Payment()
        {
            User user = (User)Session["LoggedUser"];
            SocioBoard.Helper.Payment payme = new SocioBoard.Helper.Payment();
            string amount = string.Empty;
            string plantype = string.Empty;
            if (type == "Standard")
            {
                plantype = lstPackage[0].PackageName;
                amount = Convert.ToString(lstPackage[0].Pricing);
            }
            else if (type == "Deluxe")
            {
                plantype = lstPackage[1].PackageName;
                amount = Convert.ToString(lstPackage[1].Pricing);
            }
            else if (type == "Premium")
            {
                plantype = lstPackage[2].PackageName;
                amount = Convert.ToString(lstPackage[2].Pricing);
            }

            PackageRepository objPackageRepository = new PackageRepository();

            Package objPackage = objPackageRepository.getPackageDetails(plantype);

            if (objPackage != null)
            {
                HttpContext.Current.Session["PackageDetails"] = objPackage;
            }

            string pay = string.Empty;

            //#region DirectPaymentWithPayPal
            //pay = payme.PayWithPayPal(amount, plantype, user.UserName, "", user.EmailId, "USD", ConfigurationManager.AppSettings["paypalemail"], ConfigurationManager.AppSettings["SuccessURL"],
            //              ConfigurationManager.AppSettings["FailedURL"], ConfigurationManager.AppSettings["SuccessURL"], ConfigurationManager.AppSettings["cancelurl"], ConfigurationManager.AppSettings["notifyurl"], user.Id.ToString());

            //#endregion

            #region RecurringPaymentWithPayPal

            pay = payme.RecurringPaymentWithPayPal(amount, plantype, user.UserName, "", user.EmailId, "USD", ConfigurationManager.AppSettings["paypalemail"], ConfigurationManager.AppSettings["SuccessURL"],
                                 ConfigurationManager.AppSettings["FailedURL"], ConfigurationManager.AppSettings["SuccessURL"], ConfigurationManager.AppSettings["cancelurl"], ConfigurationManager.AppSettings["notifyurl"], user.Id.ToString());
            #endregion
            Response.Redirect(pay);
        }
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            User user = new User();
            UserRepository userrepo = new UserRepository();
            UserActivation objUserActivation = new UserActivation();
            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 = "INDIVIDUAL";
                    }
                    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);

                        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();

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

                        objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);

                        //end package

                        SocialSuitePro.Helper.MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text, objUserActivation.UserId.ToString());

                        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, Please check your email to activate your account !" + "<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.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                User user = (User)Session["LoggedUser"];

                if (user == null)
                    Response.Redirect("/Default.aspx");
                if (Request.QueryString != null)
                {
                    type = Request.QueryString["type"];
                }

                #region check for 30 days
                chkdate = user.CreateDate;
                DateTime curDate = DateTime.Now;
                TimeSpan ts = curDate - chkdate;
                datediff = ts.TotalDays;

                if (datediff > 30)
                {
                    //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your 30 Days trial period Over Please Upgrade your Package');", true);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Script", "MyJavascriptFunction();", true);

                    // System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "MyJavascriptFunction();", true);
                }

                #endregion

                PackageRepository packageRepo = new PackageRepository();

                lstPackage = packageRepo.getAllPackage();

                heading1.InnerHtml = lstPackage[0].PackageName.ToString();
                if (user.AccountType == lstPackage[0].PackageName.ToString())
                {
                    price1.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[0].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_standardplan.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    ContentPlaceHolder1_standardplan.Attributes.Add("href", "#");
                }
                else
                {
                    //price1.InnerHtml = "$" + lstPackage[0].Pricing.ToString() + " Per User/Month";
                    price1.InnerHtml = "<h3> $ " + lstPackage[0].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_standardplan.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }

                heading2.InnerHtml = lstPackage[1].PackageName.ToString();
                if (user.AccountType == lstPackage[1].PackageName.ToString())
                {
                    price2.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[1].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_deluxeplan.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    ContentPlaceHolder1_deluxeplan.Attributes.Add("href", "#");
                }
                else
                {
                    price2.InnerHtml = "<h3> $ " + lstPackage[1].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_deluxeplan.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }

                heading3.InnerHtml = lstPackage[2].PackageName.ToString();
                if (user.AccountType == lstPackage[2].PackageName.ToString())
                {
                    price3.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[2].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_premiumplan.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    ContentPlaceHolder1_premiumplan.Attributes.Add("href", "#");
                }
                else

                {
                    price3.InnerHtml = "<h3> $ " + lstPackage[2].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_premiumplan.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }

                if (type == "Standard"||type == "Deluxe"||type == "Premium")
                {
                    Payment();
                }
            }
        }
Exemplo n.º 9
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                Session["login"] = null;
                Registration regpage = new Registration();
                User user = (User)Session["LoggedUser"];

                if (DropDownList1.SelectedValue == "Basic" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium")
                {

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

                    if (user != null)
                    {
                        user.EmailId = txtEmail.Text;
                        user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                        UserActivation objUserActivation = new UserActivation();
                        UserRepository userrepo = new UserRepository();
                        Coupon objCoupon = new Coupon();
                        CouponRepository objCouponRepository = new CouponRepository();
                        if (userrepo.IsUserExist(user.EmailId))
                        {

                            try
                            {
                                string acctype = string.Empty;
                                if (Request.QueryString["type"] != null)
                                {
                                    if (Request.QueryString["type"] == "INDIVIDUAL" || Request.QueryString["type"] == "CORPORATION" || Request.QueryString["type"] == "SMALL BUSINESS")
                                    {
                                        acctype = Request.QueryString["type"];
                                    }
                                    else
                                    {
                                        acctype = "INDIVIDUAL";
                                    }
                                }
                                else
                                {
                                    acctype = "INDIVIDUAL";
                                }

                                user.AccountType = Request.QueryString["type"];
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.StackTrace);
                                Console.WriteLine(ex.StackTrace);
                            }

                            user.AccountType = DropDownList1.SelectedValue.ToString();
                            if (string.IsNullOrEmpty(user.AccountType))
                            {
                                user.AccountType = AccountType.Free.ToString();
                            }

                            if (string.IsNullOrEmpty(user.Password))
                            {
                                user.Password = regpage.MD5Hash(txtPassword.Text);
                                // userrepo.UpdatePassword(user.EmailId, user.Password, user.Id, user.UserName, user.AccountType);
                                string couponcode = TextBox1.Text.Trim();
                                userrepo.SetUserByUserId(user.EmailId, user.Password, user.Id, user.UserName, user.AccountType, couponcode);

                                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);
                                }

                                //add userActivation

                                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();

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

                                objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);

                                //end package

                                MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString());
                            }
                        }
                        Session["LoggedUser"] = user;

                        Response.Redirect("Home.aspx");
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true);
                }
            }
            catch (Exception ex)
            {

                logger.Error(ex.StackTrace);
                Console.WriteLine(ex.StackTrace);
            }
        }
Exemplo n.º 10
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            Session["login"] = null;
            Registration regpage = new Registration();
            User user = (User)Session["LoggedUser"];

            if (user != null)
            {
                user.EmailId = txtEmail.Text;
                user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                UserActivation objUserActivation = new UserActivation();
                UserRepository userrepo = new UserRepository();
                if (userrepo.IsUserExist(user.EmailId))
                {

                    try
                    {
                        string acctype = string.Empty;
                        if (Request.QueryString["type"] != null)
                        {
                            if (Request.QueryString["type"] == "INDIVIDUAL" || Request.QueryString["type"] == "CORPORATION" || Request.QueryString["type"] == "SMALL BUSINESS")
                            {
                                acctype = Request.QueryString["type"];
                            }
                            else
                            {
                                acctype = "INDIVIDUAL";
                            }
                        }
                        else
                        {
                            acctype = "INDIVIDUAL";
                        }

                        user.AccountType = Request.QueryString["type"];
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }
                    if (string.IsNullOrEmpty(user.Password))
                    {
                        user.Password = regpage.MD5Hash(txtPassword.Text);
                        userrepo.UpdatePassword(user.EmailId, user.Password, user.Id, user.UserName,user.AccountType);

                        //add userActivation

                        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();

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

                        objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);

                        //end package

                        MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text,user.Id.ToString());
                    }
                }
                Session["LoggedUser"] = user;

                Response.Redirect("Home.aspx");
            }
        }
Exemplo n.º 11
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            User user = new User();
            UserRepository userrepo = new UserRepository();
            UserActivation objUserActivation = new UserActivation();
            Coupon objCoupon = new Coupon();
            CouponRepository objCouponRepository = new CouponRepository();
            SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
            try
            {

                if (DropDownList1.SelectedValue == "Basic" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium")
                {

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

                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    user.PaymentStatus = "unpaid";
                    //user.AccountType = Request.QueryString["type"];
                    user.AccountType = DropDownList1.SelectedValue.ToString();
                    if (string.IsNullOrEmpty(user.AccountType))
                    {
                        user.AccountType = AccountType.Free.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;
                    user.ActivationStatus = "0";
                    if (TextBox1.Text.Trim() != "")
                    {
                        user.CouponCode = TextBox1.Text.Trim().ToString();
                    }

                    if (!userrepo.IsUserExist(user.EmailId))
                    {
                        UserRepository.Add(user);

                        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();

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

                        objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);

                        //end package

                        SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(),user.Id.ToString());
                        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>";
                        Response.Redirect("~/Home.aspx");
                    }
                    else
                    {
                        lblerror.Text = "Email Already Exists " + "<a href=\"Default.aspx\">login</a>";
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true);
            }
            }

            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                lblerror.Text = "Please Insert Correct Information";
                Console.WriteLine(ex.StackTrace);
                //Response.Redirect("Home.aspx");
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// to check user reference and update user expiry , userrefrencerelation status
        /// created by Abhay Kr 5-3-2014
        /// </summary>
        /// <param name="RefereeId"></param>
        /// <returns></returns>
        public bool IsUserReferenceActivated(string RefereeId)
        {
            //testing
            Console.WriteLine("Inside " + RefereeId);

            bool ret = false;
            try
            {
                User objUser = new User();
                Package objPackage=new Package ();
                UserPackageRelation objUserPackageRelation=new UserPackageRelation ();
                UserRepository objUserRepository = new UserRepository();
                UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();
                UserRefRelation objUserRefRelation = new UserRefRelation();
                UserRefRelationRepository objUserRefRelationRepository = new UserRefRelationRepository();
                PackageRepository objPackageRepository = new PackageRepository();
                objUserRefRelation.ReferenceUserId = (Guid.Parse(RefereeId));

                //testing
                List<UserRefRelation> check =objUserRefRelationRepository.GetUserRefRelationInfo();
                //testing

                List<UserRefRelation> lstUserRefRelation = objUserRefRelationRepository.GetUserRefRelationInfoByRefreeId(objUserRefRelation);
                if (lstUserRefRelation.Count > 0)
                {
                    if (lstUserRefRelation[0].Status == "0")
                    {
                        objUserRefRelation = lstUserRefRelation[0];
                        objUserRefRelation.Status = "1";
                        objUser = objUserRepository.getUsersById(lstUserRefRelation[0].ReferenceUserId);
                        objUser.ExpiryDate = objUser.ExpiryDate.AddDays(30);
                        objUser.AccountType = "Premium";
                        objPackage = objPackageRepository.getPackageDetails("Premium");

                        objUserPackageRelation.Id=Guid.NewGuid();
                        objUserPackageRelation.UserId=objUser.Id;
                        objUserPackageRelation.PackageId=objPackage.Id;
                        objUserPackageRelation.ModifiedDate=DateTime.Now;
                        objUserPackageRelation.PackageStatus=true;
                        objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);
                        int objUserRepositoryresponse = objUserRepository.UpdateUserExpiryDateById(objUser);
                        int objUserRefRelationRepositoryresponse = objUserRefRelationRepository.UpdateStatusById(objUserRefRelation);
                    }
                }

            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
            return ret;
        }
Exemplo n.º 13
0
        //List<Package> lstPackage = new List<Package>();
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    User user = (User)Session["LoggedUser"];
                    #region for You can use only 30 days as Unpaid User

                    try
                    {
                        if (user.PaymentStatus.ToLower() == "unpaid")
                        {
                            if (!SBUtils.IsUserWorkingDaysValid(user.CreateDate))
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('You can use only 30 days as Unpaid User !');", true);

                                Session["GreaterThan30Days"] = "GreaterThan30Days";
                                // Response.Redirect("/Settings/Billing.aspx");
                            }
                        }

                        Session["GreaterThan30Days"] = null;
                    }
                    catch (Exception ex)
                    {

                        Console.WriteLine(ex.Message);
                    }
                    #endregion

                    if (user == null)
                        Response.Redirect("/Default.aspx");

                    PackageRepository packageRepo = new PackageRepository();

                    divcreatedate.InnerHtml = "Subscription begins - " + user.CreateDate.ToString();
                    plantype.InnerHtml = user.AccountType;
                    if (user.AccountType.ToLower() == AccountType.Standard.ToString().ToLower())
                    {
                        Package pack = packageRepo.getPackageDetails(AccountType.Standard.ToString());
                        if (pack != null)
                        {
                            priceofplan.InnerHtml = "$" + pack.Pricing;
                            // rateExtra.InnerHtml = "$" + pack.Pricing;
                            monthly.InnerHtml = "$" + pack.Pricing;
                        }
                    }
                    else if (user.AccountType.ToLower() == AccountType.Deluxe.ToString().ToLower())
                    {
                        Package pack = packageRepo.getPackageDetails(AccountType.Deluxe.ToString());
                        if (pack != null)
                        {
                            priceofplan.InnerHtml = "$" + pack.Pricing;
                            //  rateExtra.InnerHtml = "$" + pack.Pricing;
                            monthly.InnerHtml = "$" + pack.Pricing;
                        }
                    }
                    else if (user.AccountType.ToLower() == AccountType.Premium.ToString().ToLower())
                    {
                        Package pack = packageRepo.getPackageDetails(AccountType.Premium.ToString());
                        if (pack != null)
                        {
                            priceofplan.InnerHtml = "$" + pack.Pricing;
                            //  rateExtra.InnerHtml = "$" + pack.Pricing;
                            monthly.InnerHtml = "$" + pack.Pricing;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
        }
Exemplo n.º 14
0
        public void Payment(object sender, EventArgs e)
        {
            try
            {
                PackageRepository packageRepo = new PackageRepository();

                List<Package> lstPackage = packageRepo.getAllPackage();
                User user = (User)Session["LoggedUser"];
                SocioBoard.Helper.Payment payme = new SocioBoard.Helper.Payment();
                string amount = string.Empty;
                string plantype = string.Empty;
                if (lstPackage.Count > 0)
                {
                    if (user.AccountType.ToLower() == "standard")
                    {
                        plantype = lstPackage[0].PackageName;
                        amount = Convert.ToString(lstPackage[0].Pricing);
                    }
                    else if (user.AccountType.ToLower() == "deluxe")
                    {
                        plantype = lstPackage[1].PackageName;
                        amount = Convert.ToString(lstPackage[1].Pricing);
                    }
                    else if (user.AccountType.ToLower() == "premium")
                    {
                        plantype = lstPackage[2].PackageName;
                        amount = Convert.ToString(lstPackage[2].Pricing);
                    }
                }
                else
                {
                    if (user.AccountType.ToLower() == "standard")
                    {
                        plantype = "StandardPlan of Socioboard";
                        amount = "39";
                    }
                    else if (user.AccountType.ToLower() == "deluxe")
                    {
                        plantype = "DeluxePlan of Socioboard";
                        amount = "59";
                    }
                    else if (user.AccountType.ToLower() == "premium")
                    {
                        plantype = "PremiumPlan of Socioboard";
                        amount = "99";
                    }
                }

                string pay = string.Empty;

                #region DirectPaymentWithPayPal
                pay = payme.PayWithPayPal(amount, plantype, user.UserName, "", user.EmailId, "USD", ConfigurationManager.AppSettings["paypalemail"], ConfigurationManager.AppSettings["SuccessURL"],
                              ConfigurationManager.AppSettings["FailedURL"], ConfigurationManager.AppSettings["SuccessURL"], ConfigurationManager.AppSettings["cancelurl"], ConfigurationManager.AppSettings["notifyurl"], user.Id.ToString());

                #endregion

                //#region RecurringPaymentWithPayPal

                //pay = payme.RecurringPaymentWithPayPal(amount, plantype, user.UserName, "", user.EmailId, "USD", ConfigurationManager.AppSettings["paypalemail"], ConfigurationManager.AppSettings["SuccessURL"],
                //                     ConfigurationManager.AppSettings["FailedURL"], ConfigurationManager.AppSettings["SuccessURL"], ConfigurationManager.AppSettings["cancelurl"], ConfigurationManager.AppSettings["notifyurl"], user.Id.ToString());
                //#endregion

                Response.Redirect(pay);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = (User)Session["LoggedUser"];

            if (!IsPostBack)
            {

                if (user == null)
                    Response.Redirect("/Default.aspx");
                else
                {

                    #region for You can use only 30 days as Unpaid User

                    if (user.PaymentStatus.ToLower() == "unpaid")
                    {
                        if (!SBUtils.IsUserWorkingDaysValid(user.CreateDate))
                        {
                            //cmposecontainer.Attributes.Add("display", "none");
                            cmposecontainer.Attributes.CssStyle.Add("display", "none");
                            topbtn.Attributes.CssStyle.Add("display", "none");
                        }
                    }
                    #endregion

                    //List<Package> lstPackage = new List<Package>();
                    //PackageRepository packageRepo = new PackageRepository();
                    //lstPackage = packageRepo.getAllPackage();

                    //chkdate = user.CreateDate;
                    //DateTime curDate = DateTime.Now;
                    //TimeSpan ts = curDate - chkdate;
                    //datediff = ts.TotalDays;
                    //if (datediff > 30)
                    //{
                    //    Response.Redirect("Settings/Billing.aspx");
                    //}

                    //UserPackageRelation obj = new UserPackageRelation();
                    //obj.Id = new Guid();
                    //obj.UserId = user.Id;
                    //obj.PackageId = lstPackage[1].Id;
                    //obj.PackageStatus = true;
                    //repo.AddUserPackageRelation(obj);

                    //This Code is used for showing user current package
                    UserPackageRelationRepository repoUserPackageRelationRepository = new UserPackageRelationRepository();
                    List<UserPackageRelation> lstUserPackageRelationRepository = new List<UserPackageRelation>();
                    PackageRepository objPackageRepository = new PackageRepository();
                    Package objPackage = new Package();

                    lstUserPackageRelationRepository = repoUserPackageRelationRepository.getUserPackageRelationByUserId(user);

                    if (lstUserPackageRelationRepository.Count > 0)
                    {
                        objPackage = objPackageRepository.getPackageDetailsbyId(lstUserPackageRelationRepository[0].PackageId);
                    }

                    //if (user.PaymentStatus == "unpaid")
                    //{
                    //    daysremaining.InnerHtml = "free " + objPackage.PackageName + " " + datediff + " Days Remaining";
                    //}
                    //else if (user.PaymentStatus == "paid")
                    //{
                    //    daysremaining.InnerHtml = objPackage.PackageName + " Last" + datediff + " Days";
                    //}

                    //End This Code is used for showing user current package

                    try
                    {
                        //if (Session["IncomingTasks"] != null)
                        //{
                        //    incom_tasks.InnerHtml = Convert.ToString((int)Session["IncomingTasks"]);
                        //    incomTasks.InnerHtml = Convert.ToString((int)Session["IncomingTasks"]);
                        //}
                        //else
                        //{
                        //    TaskRepository taskRepo = new TaskRepository();
                        //    ArrayList alst = taskRepo.getAllIncompleteTasksOfUser(user.Id);
                        //    Session["IncomingTasks"] = alst.Count;
                        //}

                        TaskRepository taskRepo = new TaskRepository();
                        ArrayList alst = taskRepo.getAllIncompleteTasksOfUser(user.Id);
                        Session["IncomingTasks"] = alst.Count;
                        incom_tasks.InnerHtml = Convert.ToString((int)Session["IncomingTasks"]);
                        incomTasks.InnerHtml = Convert.ToString((int)Session["IncomingTasks"]);

                    }
                    catch (Exception es)
                    {
                        logger.Error(es.Message);
                        Console.WriteLine(es.Message);
                    }
                    try
                    {
                        if (Session["CountMessages"] != null)
                        {
                            incom_messages.InnerHtml = Convert.ToString((int)Session["CountMessages"]);
                            incomMessages.InnerHtml = Convert.ToString((int)Session["CountMessages"]);
                        }
                        else
                        {
                            incom_messages.InnerHtml = "0";
                            incomMessages.InnerHtml = "0";
                        }
                    }
                    catch (Exception sx)
                    {
                        logger.Error(sx.Message);
                        Console.WriteLine(sx.Message);
                    }

                    usernm.InnerHtml = "Hello, <a href=\"../Settings/PersonalSettings.aspx\"> " + user.UserName + "</a> ";
                    if (!string.IsNullOrEmpty(user.ProfileUrl))
                    {
                        //Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                        userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\" height=\"100\" width=\"100\"/></a></a>";
                        //userinf.InnerHtml = Datetime;
                        //{
                        //    userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\" height=\"100\" width=\"100\"/></a></a>";
                        if (user.TimeZone != null)
                        {
                            Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                            userinf.InnerHtml = Datetime;
                        }
                        //if (user.TimeZone == null)
                        //{
                        //    Datetime = DateTime.Now.ToString();
                        //    userinf.InnerHtml = Datetime;
                        //}
                        else
                        {
                            Datetime = DateTime.Now.ToString();
                            userinf.InnerHtml = Datetime;
                        }
                    }
                    else
                    {
                        //Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                        userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"../Contents/img/blank_img.png\" alt=\"" + user.UserName + "\"/></a>";

                        //userinf.InnerHtml = Datetime;
                        if (user.TimeZone != null)
                        {
                            Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                            userinf.InnerHtml = Datetime;
                        }
                        if (user.TimeZone == null)
                        {
                            Datetime = DateTime.Now.ToString();
                            userinf.InnerHtml = Datetime;
                        }
                    }

                    try
                    {

                        GroupRepository grouprepo = new GroupRepository();
                        List<Groups> lstgroups = grouprepo.getAllGroups(user.Id);
                        string totgroups = string.Empty;
                        if (lstgroups.Count != 0)
                        {
                            foreach (Groups item in lstgroups)
                            {
                                totgroups += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\" id=\"group_" + item.Id + "\"><img src=\"../Contents/img/groups_.png\"  alt=\"\"  style=\" margin-right:5px;\"/>" + item.GroupName + "</a></li>";
                            }
                            inviteRedirect.InnerHtml = totgroups;
                        }
                        if (user.AccountType == "SMALL BUSINESS")
                            tot_acc = 10;
                        else if (user.AccountType == "CORPORATION")
                            tot_acc = 20;
                        else if (user.AccountType == "INDIVIDUAL")
                            tot_acc = 50;
                        profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count;

                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Varibles Initialize
            UserRepository userrepo = new UserRepository();
            Registration regObject = new Registration();
            TeamRepository objTeamRepo = new TeamRepository();
            NewsRepository objNewsRepo = new NewsRepository();
            AdsRepository objAdsRepo = new AdsRepository();
            SocialProfilesRepository objSocioRepo = new SocialProfilesRepository();
            #endregion
            SocioBoard.Domain.User user = (User)Session["LoggedUser"];
            if (!IsPostBack)
            {
                try
                {
                   if (user == null)
                        Response.Redirect("Default.aspx");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    logger.Error(ex.StackTrace);
                }

                if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                {
                    try
                    {
                        userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]);

                        User newUser = (User)Session["LoggedUser"];
                        newUser.Id = user.Id;
                        newUser.Password = user.Password;
                        newUser.PaymentStatus = user.PaymentStatus;
                        newUser.ProfileUrl = user.ProfileUrl;
                        newUser.TimeZone = user.TimeZone;
                        newUser.UserName = user.UserName;
                        newUser.UserStatus = user.UserStatus;
                        newUser.AccountType = Request.QueryString["type"];
                        newUser.CreateDate = user.CreateDate;
                        newUser.ExpiryDate = user.ExpiryDate;
                        newUser.EmailId = user.EmailId;
                        Session["LoggedUser"] = null;
                        Session["LoggedUser"] = newUser;
                        user.AccountType  = newUser.AccountType;

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        logger.Error(ex.StackTrace);
                    }
                }
                #region Count Used Accounts
                try
                {

                    PackageRepository packageRepo = new PackageRepository();
                    List<Package> lstPackage = packageRepo.getAllPackage();

                    foreach (Package item in lstPackage)
                    {
                        if (user.AccountType.ToLower() == item.PackageName.ToLower())
                        {
                            tot_acc = item.TotalProfiles;
                            break;
                        }
                    }

                    profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count;
                    Session["ProfileCount"] = profileCount;
                    Session["TotalAccount"] = tot_acc;
                    usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc;
                }
                catch(Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion
                #region News

                acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts";
                teamMem.InnerHtml = "managing " + user.UserName;
                try
                {
                    News nws = objNewsRepo.getNewsForHome();
                    divNews.InnerHtml = nws.NewsDetail;
                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                    logger.Error(Err.StackTrace);
                }
                try
                {
                    ArrayList lstads = objAdsRepo.getAdsForHome();
                    foreach (var item in lstads)
                    {
                        Array temp = (Array)item;
                        imgAds.ImageUrl = temp.GetValue(2).ToString();
                        break;
                        // ads.ImageUrl;
                    }
                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                    logger.Error(Err.StackTrace);
                }
                #endregion
                #region Team Member Count
                try
                {

                    GroupRepository grouprepo = new GroupRepository();
                    string groupsofhome = string.Empty;
                    List<Groups> lstgroups = grouprepo.getAllGroups(user.Id);
                    if (lstgroups.Count != 0)
                    {
                        foreach (Groups item in lstgroups)
                        {
                            groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>";
                        }
                        getAllGroupsOnHome.InnerHtml = groupsofhome;
                    }
                }
                catch(Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion

                try
                {
                     string strTeam = string.Empty;
                        List<Team> team = objTeamRepo.getAllTeamsOfUser(user.Id);
                        foreach (Team item in team)
                        {
                            strTeam +=  "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">"+
                                        "<img width=\"48\" height=\"48\" title=\""+ item.FirstName +"\" alt=\"\" src=\"../Contents/img/blank_img.png\">" +
                                        "</a></div>";
                        }
                        team_member.InnerHtml = strTeam;

                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                }

                #region Add Fan Page
                try
                {
                    if (Session["fbSocial"] != null)
                    {
                        if (Session["fbSocial"] == "p")
                        {
                            FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"];

                            //    string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts";
                            // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"];
                            //    string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token);
                            //    JObject output = objWebRequest.FacebookRequest(strData, "Get");
                            FacebookClient fb = new FacebookClient();
                            fb.AccessToken = objFacebookAccount.AccessToken;
                            dynamic output = fb.Get("/me/accounts");
                            //  JArray data = (JArray)output["data"];
                            DataTable dtFbPage = new DataTable();
                            dtFbPage.Columns.Add("Email");
                            dtFbPage.Columns.Add("PageId");
                            dtFbPage.Columns.Add("PageName");
                            dtFbPage.Columns.Add("status");
                            dtFbPage.Columns.Add("customer_id");
                            string strPageDiv = string.Empty;
                            if (output != null)
                            {
                                foreach (var item in output["data"])
                                {
                                    if (item.category.ToString() != "Application")
                                    {
                                        strPageDiv += "<div><a id=\"A1\"  onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>";
                                        fbpage.InnerHtml = strPageDiv;
                                    }
                                }
                            }
                            else
                            {
                                strPageDiv += "<div>No Pages Found</div>";
                            }
                            Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true);
                            Session["fbSocial"] = null;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    logger.Error(ex.StackTrace);
                }
                #endregion
                #region InsightsData
                try
                {
                    decimal malecount = 0, femalecount = 0, cnt = 0;

                    FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository();
                    double daysSub = (DateTime.Now - user.CreateDate).TotalDays;
                    int userdays = (int)daysSub;
                    ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays);
                    Random rNum = new Random();
                    foreach (var item in arrFbStats)
                    {
                        Array temp = (Array)item;
                        cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString());
                        malecount += int.Parse(temp.GetValue(3).ToString());
                        femalecount += int.Parse(temp.GetValue(4).ToString());
                    }
                    try
                    {
                        decimal mc = (malecount / cnt) * 100;
                        male = Convert.ToInt16(mc);
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    try
                    {
                        decimal fc = (femalecount / cnt) * 100;
                        female = Convert.ToInt16(fc);
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    int twtAccCount=objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count;
                    if (twtAccCount > 1)
                    {
                        twtmale = rNum.Next(100);
                        twtfemale = 100 - twtmale;
                    }
                    else if (twtAccCount == 1)
                    {
                        twtmale = 100;
                        twtfemale = 0;
                    }
                    Session["twtGender"] = twtmale + "," + twtfemale;
                }
                catch (Exception Err)
                {
                    Console.Write(Err.Message.ToString());
                    logger.Error(Err.StackTrace);
                }
                getgrphData();
                getNewFriends(7);
                getNewFollowers(7);
                #endregion
                #region IncomingMessages
                try
                {
                    FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository();
                    int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id);
                    TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository();
                    int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id);
                    Session["CountMessages"] = fbmessagescout + twtcount;
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion

            }
        }
Exemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                User user = (User)Session["LoggedUser"];


                #region for You can use only 30 days as Unpaid User
                try
                {

                    if (user.PaymentStatus.ToLower() == "unpaid")
                    {
                        if (!SBUtils.IsUserWorkingDaysValid(user.ExpiryDate))
                        {
                            Session["GreaterThan30Days"] = "GreaterThan30Days";
                            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your 30 Days trial period Over Please Upgrade your Package!');", true);
                        }
                    }
                    Session["GreaterThan30Days"] = null;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                #endregion




                if (user == null)
                    Response.Redirect("/Default.aspx");
                if (Request.QueryString != null)
                {
                    type = Request.QueryString["type"];
                }



                PackageRepository packageRepo = new PackageRepository();

                lstPackage = packageRepo.getAllPackage();

                if (user.AccountType == "Free")
                {
                    freediv.Attributes.CssStyle.Add("display", "block");
                    heading1.InnerHtml = lstPackage[0].PackageName.ToString();
                   

                }


                heading2.InnerHtml = lstPackage[1].PackageName.ToString();
                if (user.AccountType == lstPackage[1].PackageName.ToString())
                {
                    price2.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[1].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_standardplan.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    //  ContentPlaceHolder1_deluxeplan.Attributes.Add("href", "#");
                }
                else
                {
                    price2.InnerHtml = "<h3> $ " + lstPackage[1].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_standardplan.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }


                heading3.InnerHtml = lstPackage[2].PackageName.ToString();
                if (user.AccountType == lstPackage[2].PackageName.ToString())
                {
                    price3.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[2].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_premiumplan.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    // ContentPlaceHolder1_premiumplan.Attributes.Add("href", "#");
                }
                else
                {
                    price3.InnerHtml = "<h3> $ " + lstPackage[2].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_premiumplan.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }
              
                
                heading4.InnerHtml = lstPackage[3].PackageName.ToString();
                if (user.AccountType == lstPackage[3].PackageName.ToString())
                {
                    price4.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[3].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_deluxeplan.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    // ContentPlaceHolder1_premiumplan.Attributes.Add("href", "#");
                }
                else
                {
                    price4.InnerHtml = "<h3> $ " + lstPackage[3].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_deluxeplan.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }

                heading5.InnerHtml = lstPackage[4].PackageName.ToString();
                if (user.AccountType == lstPackage[4].PackageName.ToString())
                {
                    price5.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[4].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_SocioBasic.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    // ContentPlaceHolder1_premiumplan.Attributes.Add("href", "#");
                }
                else
                {
                    price5.InnerHtml = "<h3> $ " + lstPackage[4].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_SocioBasic.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }


                heading6.InnerHtml = lstPackage[5].PackageName.ToString();
                if (user.AccountType == lstPackage[5].PackageName.ToString())
                {
                    price6.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[5].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_SocioStandard.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    // ContentPlaceHolder1_premiumplan.Attributes.Add("href", "#");
                }
                else
                {
                    price6.InnerHtml = "<h3> $ " + lstPackage[5].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_SocioStandard.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }

                heading7.InnerHtml = lstPackage[6].PackageName.ToString();
                if (user.AccountType == lstPackage[6].PackageName.ToString())
                {
                    price7.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[6].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_SocioPremium.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    // ContentPlaceHolder1_premiumplan.Attributes.Add("href", "#");
                }
                else
                {
                    price7.InnerHtml = "<h3> $ " + lstPackage[6].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_SocioPremium.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }

                heading8.InnerHtml = lstPackage[7].PackageName.ToString();
                if (user.AccountType == lstPackage[7].PackageName.ToString())
                {
                    price8.InnerHtml = "<h3 style=\"color: #F4594F;\"> $ " + lstPackage[7].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_SocioDeluxe.InnerHtml = "<span class=\"trail_btn active\">Current Package!</span>";
                    // ContentPlaceHolder1_premiumplan.Attributes.Add("href", "#");
                }
                else
                {
                    price8.InnerHtml = "<h3> $ " + lstPackage[7].Pricing.ToString() + " Per User/Month</h3>";
                    ContentPlaceHolder1_SocioDeluxe.InnerHtml = "<span class=\"trail_btn\">Upgrade</span>";
                }


                if (type == "Standard" || type == "Premium" || type == "Deluxe" || type == "SocioBasic" || type == "SocioPremium" || type == "SocioStandard" || type == "SocioDeluxe")
                {
                    Payment();
                }
            }
        }
Exemplo n.º 18
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            Groups groups = new Groups();
            GroupRepository objGroupRepository = new GroupRepository();
            Team teams = new Team();
            TeamRepository objTeamRepository = new TeamRepository();

            try
            {
                Session["login"] = null;
                Registration regpage = new Registration();
                User user = (User)Session["LoggedUser"];

                if (DropDownList1.SelectedValue == "Free" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium")
                {

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

                    if (user != null)
                    {
                        user.EmailId = txtEmail.Text;
                        user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                        UserActivation objUserActivation = new UserActivation();
                        UserRepository userrepo = new UserRepository();
                        Coupon objCoupon = new Coupon();
                        CouponRepository objCouponRepository = new CouponRepository();
                        if (userrepo.IsUserExist(user.EmailId))
                        {

                            try
                            {
                                string acctype = string.Empty;
                                if (Request.QueryString["type"] != null)
                                {
                                    if (Request.QueryString["type"] == "INDIVIDUAL" || Request.QueryString["type"] == "CORPORATION" || Request.QueryString["type"] == "SMALL BUSINESS")
                                    {
                                        acctype = Request.QueryString["type"];
                                    }
                                    else
                                    {
                                        acctype = "INDIVIDUAL";
                                    }
                                }
                                else
                                {
                                    acctype = "INDIVIDUAL";
                                }

                                user.AccountType = Request.QueryString["type"];
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.StackTrace);
                                Console.WriteLine(ex.StackTrace);
                            }

                            user.AccountType = DropDownList1.SelectedValue.ToString();
                            if (string.IsNullOrEmpty(user.AccountType))
                            {
                                user.AccountType = AccountType.Free.ToString();
                            }

                            if (string.IsNullOrEmpty(user.Password))
                            {
                                user.Password = regpage.MD5Hash(txtPassword.Text);
                                // userrepo.UpdatePassword(user.EmailId, user.Password, user.Id, user.UserName, user.AccountType);
                                string couponcode = TextBox1.Text.Trim();
                                userrepo.SetUserByUserId(user.EmailId, user.Password, user.Id, user.UserName, user.AccountType, couponcode);

                                try
                                {
                                    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);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("Error : " + ex.Message);
                                    logger.Error("Error : " + ex.StackTrace);
                                }

                                //add userActivation

                                try
                                {
                                    objUserActivation.Id = Guid.NewGuid();
                                    objUserActivation.UserId = user.Id;
                                    objUserActivation.ActivationStatus = "0";
                                    UserActivationRepository.Add(objUserActivation);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("Error : " + ex.Message);
                                    logger.Error("Error : " + ex.StackTrace);
                                }

                                //add package start

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

                                    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);

                                    //end package

                                    MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString());

                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("Error : " + ex.Message);
                                    logger.Error("Error : " + ex.StackTrace);
                                }

                                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;
                                    // teams.FirstName = user.UserName;
                                    objTeamRepository.addNewTeam(teams);

                                    BusinessSettingRepository busnrepo = new BusinessSettingRepository();
                                    //SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];
                                    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 = team.GroupId;
                                        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);
                                }

                            }
                        }
                        Session["LoggedUser"] = user;

                        Response.Redirect("Home.aspx");
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true);
                }
            }
            catch (Exception ex)
            {

                logger.Error(ex.StackTrace);
                Console.WriteLine(ex.StackTrace);
            }
        }
Exemplo n.º 19
0
        protected void btnRegister_Click(string email,string username)
        {
            try
            {
                User user = new User();
                UserRepository userrepo = new UserRepository();
                UserActivation objUserActivation = new UserActivation();
                Coupon objCoupon = new Coupon();
                CouponRepository objCouponRepository = new CouponRepository();
                SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                try
                {

                            user.PaymentStatus = "unpaid";
                            user.AccountType = AccountType.Premium.ToString();
                            user.CreateDate = DateTime.Now;
                            user.ExpiryDate = DateTime.Now.AddMonths(1);
                            user.Id = Guid.NewGuid();
                            user.UserName = username;
                            user.Password = this.MD5Hash("Sb1234!@#$");
                            user.EmailId = email;
                            user.UserStatus = 1;
                            user.ActivationStatus = "1";

                            if (!userrepo.IsUserExist(user.EmailId))
                            {

                                UserRepository.Add(user);

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

                                //add package start

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

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

                                objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);

                                //end package

                                //SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString());
                            }
                            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);
                    //Response.Redirect("Home.aspx");
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);

                Console.WriteLine(ex.StackTrace);
                //Response.Redirect("Home.aspx");
            }
        }
Exemplo n.º 20
0
        public void ProcessRequest()
        {
            if (Request.QueryString["op"] == "login")
            {
                try
                {
                    string email = Request.QueryString["username"];
                    string password = Request.QueryString["password"];
                    Registration regpage = new Registration();
                    password = regpage.MD5Hash(password);
                    SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                    UserRepository userrepo = new UserRepository();
                    LoginLogs objLoginLogs = new LoginLogs();
                    LoginLogsRepository objLoginLogsRepository = new LoginLogsRepository();
                    User user = userrepo.GetUserInfo(email, password);
                    if (user == null)
                    {
                        Response.Write("Invalid Email or Password");
                    }
                    else
                    {
                        if (user.UserStatus == 1)
                        {
                            Session["LoggedUser"] = user;
                            // List<User> lstUser = new List<User>();
                            if (Session["LoggedUser"] != null)
                            {
                                //SocioBoard.Domain.User.lstUser.Add((User)Session["LoggedUser"]);
                                //Application["OnlineUsers"] = SocioBoard.Domain.User.lstUser;
                                //objLoginLogs.Id = new Guid();
                                //objLoginLogs.UserId = user.Id;
                                //objLoginLogs.UserName = user.UserName;
                                //objLoginLogs.LoginTime = DateTime.Now.AddHours(11.50);
                                //objLoginLogsRepository.Add(objLoginLogs);
                                Groups objGroups = new Groups();
                                GroupRepository objGroupRepository = new GroupRepository();
                                Team objteam = new Team();
                                TeamRepository objTeamRepository = new TeamRepository();
                                objGroups = objGroupRepository.getGroupDetail(user.Id);
                                if (objGroups == null)
                                {
                                    //================================================================================
                                    //Insert into group

                                    try
                                    {
                                        objGroups = new Groups();
                                        objGroups.Id = Guid.NewGuid();
                                        objGroups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"];
                                        objGroups.UserId = user.Id;
                                        objGroups.EntryDate = DateTime.Now;
                                        objGroupRepository.AddGroup(objGroups);

                                        objteam.Id = Guid.NewGuid();
                                        objteam.GroupId = objGroups.Id;
                                        objteam.UserId = user.Id;
                                        objteam.EmailId = user.EmailId;
                                        // teams.FirstName = user.UserName;
                                        objTeamRepository.addNewTeam(objteam);

                                        SocialProfile objSocialProfile = new SocialProfile();
                                        SocialProfilesRepository objSocialProfilesRepository = new SocialProfilesRepository();

                                        List<SocialProfile> lstSocialProfile = objSocialProfilesRepository.getAllSocialProfilesOfUser(user.Id);
                                        if (lstSocialProfile != null)
                                        {
                                            if (lstSocialProfile.Count > 0)
                                            {
                                                foreach (SocialProfile item in lstSocialProfile)
                                                {
                                                    try
                                                    {
                                                        TeamMemberProfile objTeamMemberProfile = new TeamMemberProfile();
                                                        TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
                                                        objTeamMemberProfile.Id = Guid.NewGuid();
                                                        objTeamMemberProfile.TeamId = objteam.Id;
                                                        objTeamMemberProfile.ProfileId = item.ProfileId;
                                                        objTeamMemberProfile.ProfileType = item.ProfileType;
                                                        objTeamMemberProfile.Status = item.ProfileStatus;
                                                        objTeamMemberProfile.StatusUpdateDate = DateTime.Now;
                                                        objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.Message);
                                                    }

                                                }
                                            }
                                        }



                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                        logger.Error("Error : " + ex.Message);
                                        logger.Error("Error : " + ex.StackTrace);
                                    }

                                    //==========================================================================================================

                                }

                                BusinessSetting objBusinessSetting = new BusinessSetting();
                                BusinessSettingRepository objBusinessSettingRepository = new BusinessSettingRepository();
                                List<BusinessSetting> lstBusinessSetting = objBusinessSettingRepository.GetBusinessSettingByUserId(user.Id);
                                if (lstBusinessSetting.Count == 0)
                                {
                                    try
                                    {
                                        List<Groups> lstGroups = objGroupRepository.getAllGroups(user.Id);
                                        foreach (Groups item in lstGroups)
                                        {
                                            objBusinessSetting = new BusinessSetting();
                                            objBusinessSetting.Id = Guid.NewGuid();
                                            objBusinessSetting.BusinessName = item.GroupName;
                                            //objbsnssetting.GroupId = team.GroupId;
                                            objBusinessSetting.GroupId = item.Id;
                                            objBusinessSetting.AssigningTasks = false;
                                            objBusinessSetting.AssigningTasks = false;
                                            objBusinessSetting.TaskNotification = false;
                                            objBusinessSetting.TaskNotification = false;
                                            objBusinessSetting.FbPhotoUpload = 0;
                                            objBusinessSetting.UserId = user.Id;
                                            objBusinessSetting.EntryDate = DateTime.Now;
                                            objBusinessSettingRepository.AddBusinessSetting(objBusinessSetting);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.StackTrace);
                                    }
                                }

                            }
                            Response.Write("user");
                        }

                        else
                        {
                            Response.Write("You are Blocked by Admin Please contact Admin!");
                        }


                    }
                }
                catch (Exception ex)
                {
                    Response.Write("Error: " + ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    logger.Error(ex.StackTrace);
                }
            }
            else if (Request.QueryString["op"] == "register")
            {
                User user = new User();
                UserActivation objUserActivation = new UserActivation();
                UserRepository userrepo = new UserRepository();
                SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                Session["AjaxLogin"] = "******";
                try
                {
                    System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                    string line = "";
                    line = sr.ReadToEnd();
                    JObject jo = JObject.Parse(line);
                    user.PaymentStatus = "unpaid";
                    if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                    {
                        user.AccountType = Request.QueryString["type"];
                    }
                    else
                    {
                        user.AccountType = "deluxe";
                    }
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Id = Guid.NewGuid();
                    user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]);
                    user.EmailId = Server.UrlDecode((string)jo["email"]);
                    user.Password = Server.UrlDecode((string)jo["password"]);
                    user.UserStatus = 1;
                    if (!userrepo.IsUserExist(user.EmailId))
                    {
                        UserRepository.Add(user);
                        Session["LoggedUser"] = user;
                        Response.Write("user");

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

                        //add value in userpackage
                        UserPackageRelation objUserPackageRelation = new UserPackageRelation();
                        UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();
                        PackageRepository objPackageRepository = new PackageRepository();

                        Package objPackage = objPackageRepository.getPackageDetails(user.AccountType);
                        objUserPackageRelation.Id = new Guid();
                        objUserPackageRelation.PackageId = objPackage.Id;
                        objUserPackageRelation.UserId = user.Id;
                        objUserPackageRelation.PackageStatus = true;

                        objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);


                        SocioBoard.Helper.MailSender.SendEMail(user.UserName, user.Password, user.EmailId, user.AccountType.ToString(), user.Id.ToString());




                        //MailSender.SendEMail(user.UserName, user.Password, user.EmailId);
                        // lblerror.Text = "Registered Successfully !" + "<a href=\"login.aspx\">Login</a>";
                    }
                    else
                    {
                        Response.Write("Email Already Exists !");
                    }
                }


                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);


                    Console.WriteLine(ex.StackTrace);
                }


            }
            else if (Request.QueryString["op"] == "facebooklogin")
            {
                SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");

                string redi = "http://www.facebook.com/dialog/oauth/?scope=publish_stream,read_stream,read_insights,manage_pages,user_checkins,user_photos,read_mailbox,manage_notifications,read_page_mailboxes,email,user_videos,offline_access&client_id=" + ConfigurationManager.AppSettings["ClientId"] + "&redirect_uri=" + ConfigurationManager.AppSettings["RedirectUrl"] + "&response_type=code";
                Session["login"] = "******";
                Response.Write(redi);



            }
            else if (Request.QueryString["op"] == "googlepluslogin")
            {
                Session["login"] = "******";
                oAuthToken objToken = new oAuthToken();
                Response.Write(objToken.GetAutherizationLink("https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+https://www.googleapis.com/auth/plus.me+https://www.googleapis.com/auth/plus.login"));
            }
            else if (Request.QueryString["op"] == "removeuser")
            {
                try
                {
                    if (Session["LoggedUser"] != null)
                    {
                        SocioBoard.Domain.User.lstUser.Remove((User)Session["LoggedUser"]);
                    }
                }
                catch (Exception Err)
                {
                    logger.Error(Err.StackTrace);
                    Response.Write(Err.StackTrace);
                }
            }


        }
Exemplo n.º 21
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");
            }
        }