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


C# UserRepository.GetUserInfo方法代码示例

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


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

示例1: Login

        public string Login(string EmailId, string Password)
        {
            //
            try
            {
                UserRepository userrepo = new UserRepository();
                Registration regObject = new Registration();
                User user = userrepo.GetUserInfo(EmailId, regObject.MD5Hash(Password));

                if (user != null)
                {
                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Invalid user name or password";
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return null;
            }
        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:25,代码来源:UserService.asmx.cs

示例2: btnLogin_Click

        protected void btnLogin_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtPassword.Text))
                {
                    SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                          UserRepository userrepo = new UserRepository();
                    Registration regObject = new Registration();
                    User user = userrepo.GetUserInfo(txtEmail.Text, regObject.MD5Hash(txtPassword.Text));
                    if (user == null)
                    {
                        Response.Write("user is null");
                    }

                    if (user.PaymentStatus == "unpaid")
                    {
                        if (DateTime.Compare(DateTime.Now, user.ExpiryDate) < 0)
                        {
                            if (user != null)
                            {
                                Session["LoggedUser"] = user;
                                FormsAuthentication.SetAuthCookie(user.UserName, true);
                                Response.Redirect("/Home.aspx", false);
                            }
                            else
                            {
                                //  txterror.Text = "Invalid UserName Or Password";
                            }
                        }
                        else
                        {
                            Response.Redirect("Settings/Billing.aspx");
                        }
                    }
                    else
                    {
                        Session["LoggedUser"] = user;
                        FormsAuthentication.SetAuthCookie(user.UserName, true);
                        Response.Redirect("/Home.aspx", false);

                    }

                }
            }
            catch (Exception ex)
            {

                logger.Error(ex.StackTrace);

                Console.WriteLine(ex.StackTrace);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:53,代码来源:Login.aspx.cs

示例3: ProcessRequest

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

示例4: 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


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