当前位置: 首页>>代码示例>>C#>>正文


C# UserRepository.IsUserExist方法代码示例

本文整理汇总了C#中SocioBoard.Model.UserRepository.IsUserExist方法的典型用法代码示例。如果您正苦于以下问题:C# UserRepository.IsUserExist方法的具体用法?C# UserRepository.IsUserExist怎么用?C# UserRepository.IsUserExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SocioBoard.Model.UserRepository的用法示例。


在下文中一共展示了UserRepository.IsUserExist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Register

        public string Register(string EmailId, string Password, string AccountType, string FirstName, string LastName)
        {

            try
            {
                UserRepository userrepo = new UserRepository();
                if (!userrepo.IsUserExist(EmailId))
                {
                    Registration regObject = new Registration();
                    User user = new User();
                    user.AccountType = AccountType;
                    user.EmailId = EmailId;
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Password = regObject.MD5Hash(Password);
                    user.PaymentStatus = "unpaid";
                    user.ProfileUrl = string.Empty;
                    user.TimeZone = string.Empty;
                    user.UserName = FirstName + " " + LastName;
                    user.UserStatus = 1;
                    user.Id = Guid.NewGuid();
                    UserRepository.Add(user);
                    MailSender.SendEMail(user.UserName,Password, EmailId);
                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Email Already Exists";
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Something Went Wrong";
            }



        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:40,代码来源:UserService.asmx.cs

示例2: btnRegister_Click

        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;
              
                UserRepository userrepo = new UserRepository();
                if (userrepo.IsUserExist(user.EmailId))
                {

                    try
                    {
                        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);
                        MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text);
                    }
                }
                Session["LoggedUser"] = user;

                Response.Redirect("Home.aspx");
            }
        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:36,代码来源:SNL.aspx.cs

示例3: btnSignup_Click

        protected void btnSignup_Click(object sender, ImageClickEventArgs e)
        {
            User user = new User();
            UserRepository userrepo = new UserRepository();

            try
            {
                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    user.AccountType = "free";
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Id = Guid.NewGuid();
                    user.UserName = txtUserName.Text;
                    user.Password = this.MD5Hash(txtPassword.Text);
                    user.EmailId = txtEmail.Text;
                    user.UserStatus = 1;
                    if (!userrepo.IsUserExist(user.EmailId))
                    {
                        UserRepository.Add(user);
                        MailSender.SendEMail(txtUserName.Text, txtPassword.Text, txtEmail.Text);
                        lblerror.Text = "registered successfully !" + "<a href=\"login.aspx\">login</a>";
                    }
                    else
                    {
                        lblerror.Text = "email already exists " + "<a href=\"login.aspx\">login</a>";
                    }
                }

            }
            catch (Exception ex)
            {
                lblerror.Text = "Please Insert Correct Information";
                Console.WriteLine(ex.StackTrace);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:36,代码来源:Registration.aspx.cs

示例4: btnRegister_Click

        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

//.........这里部分代码省略.........
开发者ID:utkarshx,项目名称:socioboard,代码行数:101,代码来源:NetworkLogin.aspx.cs

示例5: btnRegister_Click

        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            User user = new User();
            UserRepository userrepo = new UserRepository();
            SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
            try
            {
                if (txtPassword.Text == txtConfirmPassword.Text)
                {

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

                        TeamRepository teamRepo = new TeamRepository();
                        Team team = teamRepo.getTeamByEmailId(txtEmail.Text);
                        if (team != null)
                        {

                            Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                            teamRepo.updateTeamStatus(teamid);

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

                                    if (item.ProfileType == "facebook")
                                    {
                                        try
                                        {
                                            FacebookAccount fbAccount = new FacebookAccount();
                                            FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository();
                                            FacebookAccount userAccount = fbAccountRepo.getUserDetails(item.ProfileId);
                                            fbAccount.AccessToken = userAccount.AccessToken;
                                            fbAccount.EmailId = userAccount.EmailId;
                                            fbAccount.FbUserId = item.ProfileId;
                                            fbAccount.FbUserName = userAccount.FbUserName;
                                            fbAccount.Friends = userAccount.Friends;
                                            fbAccount.Id = Guid.NewGuid();
                                            fbAccount.IsActive = true;
                                            fbAccount.ProfileUrl = userAccount.ProfileUrl;
                                            fbAccount.Type = userAccount.Type;
                                            fbAccount.UserId = user.Id;
                                            fbAccountRepo.addFacebookUser(fbAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "twitter")
                                    {
                                        try
                                        {
                                            TwitterAccount twtAccount = new TwitterAccount();
                                            TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                            TwitterAccount twtAcc = twtAccRepo.getUserInfo(item.ProfileId);
                                            twtAccount.FollowersCount = twtAcc.FollowersCount;
                                            twtAccount.FollowingCount = twtAcc.FollowingCount;
                                            twtAccount.Id = Guid.NewGuid();
                                            twtAccount.IsActive = true;
                                            twtAccount.OAuthSecret = twtAcc.OAuthSecret;
                                            twtAccount.OAuthToken = twtAcc.OAuthToken;
                                            twtAccount.ProfileImageUrl = twtAcc.ProfileImageUrl;
                                            twtAccount.ProfileUrl = twtAcc.ProfileUrl;
                                            twtAccount.TwitterName = twtAcc.TwitterName;
                                            twtAccount.TwitterScreenName = twtAcc.TwitterScreenName;
                                            twtAccount.TwitterUserId = twtAcc.TwitterUserId;
                                            twtAccount.UserId = user.Id;
                                            twtAccRepo.addTwitterkUser(twtAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
//.........这里部分代码省略.........
开发者ID:utkarshx,项目名称:socioboard,代码行数:101,代码来源:SocialRegisterPage.aspx.cs

示例6: GetAccessToken

        //Getting AccessToken,FacebookMessages,FacebookFeeds and UserProfile for  Authenticated user.
        private void GetAccessToken()
        {
            string code = Request.QueryString["code"];
            User user = null;
            if (Session["login"] != null)
            {
                if (Session["login"].ToString() == "facebook")
                {
                    user = new User();

                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Id = Guid.NewGuid();
                    user.PaymentStatus = "unpaid";

                }

            }
            else
            {
                /*User class in SocioBoard.Domain to check authenticated user*/
                 user = (User)Session["LoggedUser"];

            }
                /*Replacing Code With AccessToken*/
                // Facebook.dll using for
                FacebookHelper fbhelper = new FacebookHelper();

            FacebookClient fb = new FacebookClient();
                string profileId = string.Empty;
                Dictionary<string, object> parameters = new Dictionary<string, object>();
                parameters.Add("client_id", ConfigurationManager.AppSettings["ClientId"]);
                parameters.Add("redirect_uri", ConfigurationManager.AppSettings["RedirectUrl"]);
                parameters.Add("client_secret", ConfigurationManager.AppSettings["ClientSecretKey"]);
                parameters.Add("code", code);

                JsonObject result = (JsonObject)fb.Get("/oauth/access_token", parameters);
                string accessToken = result["access_token"].ToString();
                fb.AccessToken = accessToken;

               dynamic profile = fb.Get("me");
            if (Session["login"] != null)
            {
                    if (Session["login"].ToString() == "facebook")
                    {
                        try
                        {
                            user.EmailId = profile["email"].ToString();
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {

                            user.UserName = profile["name"].ToString();
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            user.ProfileUrl = "https://www.facebook.com/" + profile["id"] + "/picture?type=small";
                            profileId = profile["id"];
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            Console.WriteLine(ex.StackTrace);
                        }
                        user.UserStatus = 1;

                        UserRepository userrepo = new UserRepository();

                        if (userrepo.IsUserExist(user.EmailId))
                        {
                            string emailid = user.EmailId;
                            user = null;

                            user = userrepo.getUserInfoByEmail(emailid);

                        }
                        else
                        {
                            UserRepository.Add(user);
                        }

                        Session["LoggedUser"] = user;
                    }

                }

                var feeds = fb.Get("/me/feed");

                var home = fb.Get("/me/home");
//.........这里部分代码省略.........
开发者ID:utkarshx,项目名称:socioboard,代码行数:101,代码来源:FacebookManager.aspx.cs

示例7: getTwitterUserProfile


//.........这里部分代码省略.........
                }

                try
                {
                    twitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                twitterAccount.UserId = user.Id;

                socioprofile.Id = Guid.NewGuid();
                socioprofile.ProfileDate = DateTime.Now;
                socioprofile.ProfileId = twitterAccount.TwitterUserId;
                socioprofile.ProfileType = "twitter";
                socioprofile.UserId = user.Id;

                if (HttpContext.Current.Session["login"] != null)
                {
                    if (HttpContext.Current.Session["login"].ToString().Equals("twitter"))
                    {
                        User usr = new User();
                        UserRepository userrepo = new UserRepository();
                        Registration regObject = new Registration();
                        usr.AccountType = "free";
                        usr.CreateDate = DateTime.Now;
                        usr.ExpiryDate = DateTime.Now.AddMonths(1);
                        usr.Id = Guid.NewGuid();
                        usr.UserName = twitterAccount.TwitterName;
                        usr.Password = regObject.MD5Hash(twitterAccount.TwitterName);
                        usr.EmailId = "";
                        usr.UserStatus = 1;
                        if (!userrepo.IsUserExist(usr.EmailId))
                        {
                            UserRepository.Add(usr);
                        }
                    }
                }

                TwitterStatsRepository objTwtstats = new TwitterStatsRepository();
                TwitterStats objStats = new TwitterStats();
                Random rNum = new Random();
                objStats.Id = Guid.NewGuid();
                objStats.TwitterId = twitterAccount.TwitterUserId;
                objStats.UserId = user.Id;
                objStats.FollowingCount = twitterAccount.FollowingCount;
                objStats.FollowerCount = twitterAccount.FollowersCount;
                objStats.Age1820 = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age2124 = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age2534 = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age3544 = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age4554 = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age5564 = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age65 = rNum.Next(twitterAccount.FollowersCount);
                objStats.EntryDate = DateTime.Now;
                if (!objTwtstats.checkTwitterStatsExists(twitterAccount.TwitterUserId, user.Id))
                    objTwtstats.addTwitterStats(objStats);
                if (!twtrepo.checkTwitterUserExists(twitterAccount.TwitterUserId, user.Id))
                {
                    twtrepo.addTwitterkUser(twitterAccount);
                    if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                    {
                        socioprofilerepo.addNewProfileForUser(socioprofile);
                    }
                    else
开发者ID:NALSS,项目名称:socioboard,代码行数:67,代码来源:TwitterManager.aspx.cs

示例8: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            oAuthToken objToken = new oAuthToken();
            GplusHelper objGpHelper = new GplusHelper();
            UserRepository objUserRepo = new UserRepository();
            PeopleController obj = new PeopleController();
            GooglePlusAccount objgpAcc = new GooglePlusAccount();
            User user = new User();
            try
            {
                string objRefresh = objToken.GetRefreshToken(Request.QueryString["code"]);
                if (!objRefresh.StartsWith("["))
                    objRefresh = "[" + objRefresh + "]";
                JArray objArray = JArray.Parse(objRefresh);
                if (Session["login"] != null)
                {
                    if (Session["login"].ToString() == "googleplus")
                    {
                        user = new User();
                        user.CreateDate = DateTime.Now;
                        user.ExpiryDate = DateTime.Now.AddMonths(1);
                        user.Id = Guid.NewGuid();
                        user.PaymentStatus = "unpaid";
                    }

                }
                else
                {
                    /*User class in SocioBoard.Domain to check authenticated user*/
                    user = (User)Session["LoggedUser"];
                }
                foreach (var item in objArray)
                {
                    try
                    {
                        JArray objEmail = objToken.GetUserInfo("me", item["access_token"].ToString());
                        JArray objProfile = obj.GetPeopleProfile("me", item["access_token"].ToString());
                        // user = (User)HttpContext.Current.Session["LoggedUser"];
                        foreach (var itemEmail in objEmail)
                        {
                            objgpAcc.EmailId = itemEmail["email"].ToString();

                        }
                        foreach (var itemProfile in objProfile)
                        {
                            objgpAcc.GpUserId = itemProfile["id"].ToString();
                            objgpAcc.AccessToken = item["access_token"].ToString();
                            objgpAcc.EntryDate = DateTime.Now;
                            objgpAcc.GpProfileImage = itemProfile["image"]["url"].ToString();
                            objgpAcc.GpUserName = itemProfile["displayName"].ToString();
                            objgpAcc.Id =Guid.NewGuid();
                            objgpAcc.IsActive = 1;
                            objgpAcc.RefreshToken = item["refresh_token"].ToString();
                            objgpAcc.UserId = user.Id;

                        }

                        if (Session["login"] != null)
                        {
                            if (string.IsNullOrEmpty(user.Password))
                            {
                                if (Session["login"].ToString() == "googleplus")
                                {
                                    if (objUserRepo.IsUserExist(user.EmailId))
                                    {
                                        // user = null;
                                        user = objUserRepo.getUserInfoByEmail(user.EmailId);
                                    }
                                    else
                                    {
                                        user.EmailId = objgpAcc.EmailId;
                                        user.UserName = objgpAcc.GpUserName;
                                        user.ProfileUrl = objgpAcc.GpProfileImage;
                                        UserRepository.Add(user);
                                    }
                                    Session["LoggedUser"] = user;
                                    objgpAcc.UserId = user.Id;
                                }
                            }
                        }
                        objGpHelper.GetUerProfile(objgpAcc, item["access_token"].ToString(), item["refresh_token"].ToString(), user.Id);

                        if (Session["login"] != null)
                        {
                            if (string.IsNullOrEmpty(user.Password))
                            {
                                if (Session["login"].ToString() == "googleplus")
                                {
                                    Response.Redirect("Plans.aspx");
                                }
                            }
                            else
                            {
                                Response.Redirect("Home.aspx");
                            }
                        }
                        else
                        {
                            Response.Redirect("Home.aspx");
                        }
//.........这里部分代码省略.........
开发者ID:utkarshx,项目名称:socioboard,代码行数:101,代码来源:GplusManager.aspx.cs

示例9: btnRegister_Click

        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;
//.........这里部分代码省略.........
开发者ID:Kiranub313,项目名称:socioboard,代码行数:101,代码来源:NetworkLogin.aspx.cs

示例10: btnRegister_Click

        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");
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:78,代码来源:SocialNetworkLogin.aspx.cs

示例11: ProcessRequest

        public void ProcessRequest()
        {
            if (Request.QueryString["op"] == "login")
            {
                try
                {
                    string email = Request.QueryString["username"];
                    string password = Request.QueryString["password"];
                    SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                    UserRepository userrepo = new UserRepository();
                    User user = userrepo.GetUserInfo(email, password);
                    if (user == null)
                    {
                        Response.Write("Invalid Email or Password");
                    }
                    else
                    {

                        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;
                        }
                        Response.Write("user");
                    }
                }
                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();
                UserRepository userrepo = new UserRepository();
                SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                Session["AjaxLogin"] = "register";

                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 (jo["plantype"].ToString() == "standard")
                    {
                        user.AccountType = AccountType.Standard.ToString();
                    }
                    else if (jo["plantype"].ToString() == "deluxe")
                    {
                        user.AccountType = AccountType.Deluxe.ToString();
                    }
                    else if (jo["plantype"].ToString() == "premium")
                    {
                        user.AccountType = AccountType.Premium.ToString();
                    }

                    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");
                        blackSheep.Helper.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")
            {
                SocioBoard.Helper.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"] = "facebook";
                Response.Write(redi);

            }
//.........这里部分代码省略.........
开发者ID:utkarshx,项目名称:socioboard,代码行数:101,代码来源:AjaxLogin.aspx.cs

示例12: InviteMember

        private string InviteMember(string fname,string lname, string email)
        {
            SocioBoard.Domain.User user = (User)Session["LoggedUser"];
            UserRepository objUserRepository = new UserRepository();
            string res = "";
            try
            {
               

                Registration reg = new Registration();
                string tid = reg.MD5Hash(email);
                MailHelper mailhelper = new MailHelper();
                string mailpath = HttpContext.Current.Server.MapPath("~/Layouts/Mails/FriendInvitation.htm");
                string html = File.ReadAllText(mailpath);


                string fromemail = ConfigurationManager.AppSettings["fromemail"];
                string usernameSend = ConfigurationManager.AppSettings["username"];
                string host = ConfigurationManager.AppSettings["host"];
                string port = ConfigurationManager.AppSettings["port"];
                string pass = ConfigurationManager.AppSettings["password"];
                string website = ConfigurationManager.AppSettings["MailSenderDomain"];
                string urllogin = website + "Default.aspx";
               // string registrationurl = "http://dev.socioboard.com/Registration.aspx?refid=256f9c69-6b6a-4409-a309-b1f6d1f8e43b";
                string registrationurl = website+"Registration.aspx?refid=" + user.Id;

                html = html.Replace("%replink%", registrationurl);
             

               // string Body = mailhelper.InvitationMailByCloudSponge(html, fname+" "+lname, "[email protected]", "", urllogin, registrationurl);

                string Body = mailhelper.InvitationMailByCloudSponge(html, fname + " " + lname, user.EmailId, "", urllogin, registrationurl);

                string Subject = "You have been invited to Socioboard by " + user.EmailId;
                //   MailHelper.SendMailMessage(host, int.Parse(port.ToString()), fromemail, pass, email, string.Empty, string.Empty, Subject, Body);
                MailHelper objMailHelper = new MailHelper();
                if (!objUserRepository.IsUserExist(email))
                {
                    res = objMailHelper.SendMailByMandrill(host, Convert.ToInt32(port), fromemail, "", email, "", "", Subject, Body, usernameSend, pass);
                    if (res == "Success")
                    {
                        res = "Mail sent successfully!";
                    }
                }
                else
                {
                    res = "EmailId Already Exist!";
                }
                    //MailHelper.SendSendGridMail(host, Convert.ToInt32(port), fromemail, "", email, "", "", Subject, Body, usernameSend, pass);

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

        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:58,代码来源:AjaxInviteFrndsByCloudSponge.aspx.cs

示例13: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            UserRepository objUserRepository = new UserRepository();
            try
            {
                User user = (User)Session["LoggedUser"];
                if (imgfileupload.HasFile)
                {
                    if (imgfileupload.FileName != null)
                    {
                        //string[] strarr = imgfileupload.FileName.Split('.');
                        ////imgfileupload.FileName
                        string strarr = Path.GetExtension(imgfileupload.FileName);

                        if (strarr.ToLower() == ".png" || strarr.ToLower() == ".jpeg" || strarr.ToLower() == ".jpg")
                        {

                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please use jpeg ,jpg or png format image');", true);
                            return;
                        }

                    }

                    string path = Server.MapPath("~/Contents/img/user_img/" + imgfileupload.FileName);
                    imgfileupload.SaveAs(path);
                    user.ProfileUrl = "../Contents/img/user_img/" + imgfileupload.FileName;
                }
                if (txtEmail.Text != null || txtEmail.Text != "")
                {
                    bool isEmail = Regex.IsMatch(txtEmail.Text.Trim(), @"\A(?:[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)\Z");
                    if (isEmail)
                    {

                        if (txtEmail.Text.Trim()!=user.EmailId)
                        {
                             bool useremailcheck = objUserRepository.IsUserExist(txtEmail.Text.Trim());
                             if (useremailcheck != true)
                             {
                                 try
                                 {
                                     user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                                     user.TimeZone = ddlTimeZone.SelectedItem.Value;
                                     user.EmailId = txtEmail.Text;
                                     UserRepository.Update(user);
                                     Session["LoggedUser"] = user;
                                 }
                                 catch (Exception ex)
                                 {

                                     Console.WriteLine(ex.Message);
                                 }
                             }
                             else
                             {

                                 ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('EmailId already Exist');", true);
                                 return;

                             }
                    }
                    else
                        {
                            try
                            {
                                user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                                user.TimeZone = ddlTimeZone.SelectedItem.Value;
                                user.EmailId = txtEmail.Text;
                                UserRepository.Update(user);
                                Session["LoggedUser"] = user;
                            }
                            catch (Exception ex)
                            {

                                Console.WriteLine(ex.Message);
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please enter a valid emailId');", true);
                        return;

                    }

                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please enter a emailId');", true);
                    return;

                }
                //Response.Redirect(Request.RawUrl);
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
//.........这里部分代码省略.........
开发者ID:utkarshx,项目名称:socioboard,代码行数:101,代码来源:PersonalSettings.aspx.cs

示例14: GetAccessToken


//.........这里部分代码省略.........
                        isfbemailexist = true;
                        logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }
                    if (isfbemailexist)
                    {
                        Session["isemailexist"] = "emailnotexist";
                        Response.Redirect("Default.aspx");
                    }
                    try
                    {

                        user.UserName = profile["name"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        user.ProfileUrl = "https://graph.facebook.com/" + profile["id"] + "/picture?type=small";
                        profileId = profile["id"];
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }
                    user.UserStatus = 1;

                    UserRepository userrepo = new UserRepository();

                    if (userrepo.IsUserExist(user.EmailId))
                    {
                        string emailid = user.EmailId;
                        user = null;

                        user = userrepo.getUserInfoByEmail(emailid);

                    }
                    else
                    {
                        UserRepository.Add(user);
                    }

                    Session["LoggedUser"] = user;
                }

            }




            var feeds = fb.Get("/me/feed");

            var home = fb.Get("/me/home");
            var messages = fb.Get("/me/inbox");

            long friendscount = 0;
            try
            {
                fbhelper.getInboxMessages(messages, profile, user.Id);
            }
            catch (Exception ex)
            {
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:67,代码来源:FacebookManager.aspx.cs

示例15: btnRegister_Click

        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();
//.........这里部分代码省略.........
开发者ID:Kiranub313,项目名称:socioboard,代码行数:101,代码来源:RegisterPage.aspx.cs


注:本文中的SocioBoard.Model.UserRepository.IsUserExist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。