• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UserDetails类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UserDetails的典型用法代码示例。如果您正苦于以下问题:C# UserDetails类的具体用法?C# UserDetails怎么用?C# UserDetails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UserDetails类属于命名空间,在下文中一共展示了UserDetails类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Index

        //
        // GET: /Manage/Index
        public async Task<ActionResult> Index(ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess
                    ? "Your password has been changed."
                    : message == ManageMessageId.SetPasswordSuccess
                        ? "Your password has been set."
                        : message == ManageMessageId.SetTwoFactorSuccess
                            ? "Your two-factor authentication provider has been set."
                            : message == ManageMessageId.Error
                                ? "An error has occurred."
                                : message == ManageMessageId.AddPhoneSuccess
                                    ? "Your phone number was added."
                                    : message == ManageMessageId.RemovePhoneSuccess
                                        ? "Your phone number was removed."
                                        : "";

            var userId = User.Identity.GetUserId();
            var model = new UserDetails
            {
                UserName = User.Identity.GetUserName(),
                PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),

            };
            return View(model);
        }
开发者ID:SoftUni-GRIP,项目名称:PhotoContest,代码行数:28,代码来源:ManageController.cs


示例2: EnterToSite

    public int EnterToSite(UserDetails userDetails)//בודק על פי האימייל והסיסמא האם המשתשמש שמנסה להיכנס לאתר קיים או לא
    {
        OleDbCommand myCmd = new OleDbCommand("CheckIfUserExist", myConnection);
        myCmd.CommandType = CommandType.StoredProcedure;

        OleDbParameter objParam;

        objParam = myCmd.Parameters.Add("@Email", OleDbType.BSTR);
        objParam.Direction = ParameterDirection.Input;
        objParam.Value = userDetails.email;

        objParam = myCmd.Parameters.Add("@Password", OleDbType.BSTR);
        objParam.Direction = ParameterDirection.Input;
        objParam.Value = userDetails.password;

        int x = 0;
        try
        {
            myConnection.Open();
            x = (int)myCmd.ExecuteScalar();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            myConnection.Close();
        }
        return x;

    }
开发者ID:yanoovoni,项目名称:Rdroid,代码行数:32,代码来源:UserService.cs


示例3: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        Album objAlbum=new Album();
        Membership ObjMembership =new Membership();
        UserDetails ObjUser = new UserDetails();
          if (Session["uid_gender"] == null)
            {
                Response.Redirect("~/Default.aspx?refPage=" + Page.AppRelativeVirtualPath);
            }
            else
            {
                if (!IsPostBack)
                {
                    ObjUser.User_Id = Session["uid_gender"].ToString().Split('_')[0];
                    lblUser.Text= ObjUser.GetName();
                    lblProfileID.Text = Session["uid_gender"].ToString().Split('_')[0];
                    imgProfileImage.ImageUrl = "~/ProfileImages/" + objAlbum.GetProfilePicture(Session["uid_gender"].ToString().Split('_')[0]);
                    
                 ObjMembership = ObjMembership.GetMembershipDetail();
                 if (ObjMembership != null)
                 {
                     lblPlane.Text = ObjMembership.PlaneName;
                 }
                 else
                 {
                     lblPlane.Text = "Free Plan";
                 }
                }
            }

    }
开发者ID:vivek0tiwari,项目名称:shaadisaagai,代码行数:31,代码来源:UserHome.aspx.cs


示例4: Index

        public async Task<ActionResult> Index(ManageController.ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageController.ManageMessageId.ChangePasswordSuccess
                    ? "Your password has been changed."
                    : message == ManageController.ManageMessageId.SetPasswordSuccess
                        ? "Your password has been set."
                        : message == ManageController.ManageMessageId.SetTwoFactorSuccess
                            ? "Your two-factor authentication provider has been set."
                            : message == ManageController.ManageMessageId.Error
                                ? "An error has occurred."
                                : message == ManageController.ManageMessageId.AddPhoneSuccess
                                    ? "Your phone number was added."
                                    : message == ManageController.ManageMessageId.RemovePhoneSuccess
                                        ? "Your phone number was removed."
                                        : "";

            var user = this.Data.Users.Find(User.Identity.GetUserId());
            var model = new UserDetails
            {
                Id = user.Id,
                UserName = user.UserName,
                PhoneNumber = user.PhoneNumber,
                Email = user.Email

            };
            return View(model);
        }
开发者ID:SoftUni-GRIP,项目名称:PhotoContest,代码行数:28,代码来源:UserController.cs


示例5: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     user = (UserDetails)Session["LoggedUser"];
     if (user == null)
         Response.Redirect("Login.aspx");
     if (Request.QueryString["id"] == null)
         Response.Redirect("DashboardHome.aspx");
     dashboardID = int.Parse(Request.QueryString["id"]);
     Dashboard currentDashboard = new Dashboard();
     List<Dashboard> dashboardlist = new List<Dashboard>();
     UserLoginClient client=new UserLoginClient();
     if (Request.UrlReferrer.AbsolutePath.Equals("/CreateNewDashboard.aspx"))
     {
         user.UserDashboards = client.GetUserDashboards(user.UserId);
     }
     dashboardlist = user.UserDashboards.ToList();
     currentDashboard = dashboardlist.Find(dash => dash.DashboardId == dashboardID);
     dashboardName.Text = currentDashboard.DashboardName;
     startMonth.Text =currentDashboard.StartMonth.ToString();
     endMonth.Text = currentDashboard.EndMonth.ToString();
     startYear.Text = currentDashboard.StartYear.ToString();
     endYear.Text = currentDashboard.EndYear.ToString();
     Description.Text = currentDashboard.Description;
     AccessRight = currentDashboard.UserAccessRight.AccessRightName;
 }
开发者ID:rutukulkarni,项目名称:PMD,代码行数:25,代码来源:EditDashboard.aspx.cs


示例6: UpdatePersionalDetail

    public bool UpdatePersionalDetail(UserDetails user)
    {
        try
        {
            SqlCommand com = new SqlCommand();
            com.Connection = DbManager.Con;
            com.CommandType = CommandType.StoredProcedure;
            com.CommandText = "SP_Update_Persional_Details";



            com.Parameters.AddWithValue("@Bride_Id", user.Id);
            com.Parameters.AddWithValue("@Groom_Id", user.Id);
            com.Parameters.AddWithValue("@Height", Convert.ToInt32( user.Height));
            com.Parameters.AddWithValue("@About_Me", user.About_Me);
            com.Parameters.AddWithValue("@About_My_Patner", user.About_My_Patner);
            com.Parameters.AddWithValue("@Physical_Status", user.Physical_Status);
            com.Parameters.AddWithValue("@Weight", user.Weight);
            com.Parameters.AddWithValue("@Gender", user.Gender);

            
            DbManager.Open();
            com.ExecuteNonQuery();
            return Convert.ToBoolean(com.ExecuteNonQuery());

        }
        catch { throw; }
        finally
        {
            DbManager.Close();

        }

    }
开发者ID:vivek0tiwari,项目名称:shaadisaagai,代码行数:34,代码来源:DALProfile.cs


示例7: AuthenticateUser

 public static ValidationResult AuthenticateUser(string userName, string password)
 {
     var client = new AuthenticationServiceClient("WSHttpBinding_IAuthenticationService");
     var userDetails = new UserDetails() { UserName = userName, Password = password };
     var authenticationResult = client.AuthenticateUser(userDetails);
     return authenticationResult;
 }
开发者ID:Kingston-Wharves,项目名称:TestProjects,代码行数:7,代码来源:Authenticator.cs


示例8: Impersonate

 public void Impersonate(UserDetails userDetails)
 {
     //try
     {
         // Use the unmanaged LogonUser function to get the user token for
         // the specified user, domain, and password.
         const int LOGON32_PROVIDER_DEFAULT = 0;
         // Passing this parameter causes LogonUser to create a primary token.
         const int LOGON32_LOGON_INTERACTIVE = 2;
         tokenHandle = IntPtr.Zero;
         
         // ---- Step - 1
         // Call LogonUser to obtain a handle to an access token.
         bool returnValue = LogonUser(
         userDetails.UserName,
         userDetails.Domain,
         userDetails.Password,
         LOGON32_LOGON_INTERACTIVE,
         LOGON32_PROVIDER_DEFAULT,
         ref tokenHandle); // tokenHandle - new security token
         if (false == returnValue)
         {
             int ret = Marshal.GetLastWin32Error();
             throw new System.ComponentModel.Win32Exception(ret);
         }
         
         // ---- Step - 2
         WindowsIdentity newId = new WindowsIdentity(tokenHandle);
         // ---- Step - 3
         {
             impersonatedUser = newId.Impersonate();
         }
     }
 }
开发者ID:bedford603067,项目名称:Augment,代码行数:34,代码来源:Impersonation.cs


示例9: UpdateEducationlDetail

    public bool UpdateEducationlDetail(UserDetails user)
    {
        try
        {
            SqlCommand com = new SqlCommand();
            com.Connection = DbManager.Con;
            com.CommandType = CommandType.StoredProcedure;
            com.CommandText = "SP_Update_Education_And_Profession";



            com.Parameters.AddWithValue("@Bride_Id", user.Id);
            com.Parameters.AddWithValue("@Groom_Id", user.Id);


            com.Parameters.AddWithValue("@Occupation", user.Occupation);
            com.Parameters.AddWithValue("@Profession_Id", user.Profession_Id);
            com.Parameters.AddWithValue("@Anual_Incom", user.Anual_Incom);
            com.Parameters.AddWithValue("@Educational_Qualification", user.Education);
            com.Parameters.AddWithValue("@Gender", user.Gender);

            DbManager.Open();
            com.ExecuteNonQuery();
            return Convert.ToBoolean(com.ExecuteNonQuery());

        }
        catch { throw; }
        finally
        {
            DbManager.Close();

        }

    }
开发者ID:vivek0tiwari,项目名称:shaadisaagai,代码行数:34,代码来源:DALProfile.cs


示例10: GridView1_RowUpdating

    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            UserDetails userDetails = new UserDetails();

            userDetails.userID = GridView1.Rows[e.RowIndex].Cells[0].Text;
            userDetails.firstName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text;
            userDetails.lastName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text;
            userDetails.phone = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text;
            userDetails.cityID = int.Parse(((DropDownList)(GridView1.Rows[e.RowIndex].Cells[3].FindControl("DropDownList1"))).SelectedValue);
            userDetails.address = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox1"))).Text;
            userDetails.state = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox3"))).Text;
            userDetails.zipCode = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox2"))).Text;
            

            UserService userService = new UserService();
            userService.UpdateUserDetails(userDetails);

            GridView1.EditIndex = -1;
            populateGrid();
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }
开发者ID:yanoovoni,项目名称:Rdroid,代码行数:27,代码来源:UserManagmnent.aspx.cs


示例11: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            string ServerAddress = ConfigurationManager.AppSettings["ServerAddress"];
            ScriptManager.RegisterStartupScript(this, this.GetType(), new Guid().ToString(), string.Format("ServerAddress = \"{0}\";", ServerAddress), true);
            bool checkSessionPage = false;
            UserDetails user = new UserDetails();
            user = (UserDetails)Session["LoggedUser"];
            if (user != null)
            {
                Name.Text = user.FirstName + " " + user.LastName;
                Company.Text = user.CompanyName;
                pageName = this.MainContent.Page.GetType().FullName;

                if ((pageName.Equals("ASP.dashboardhome_aspx")))
                    checkSessionPage = true;
                if (pageName.Equals("ASP.createnewdashboard_aspx"))
                    checkSessionPage = true;
                if (pageName.Equals("ASP.teams_aspx"))
                    checkSessionPage = true;
                if (pageName.Equals("ASP.changepassword_aspx"))
                    checkSessionPage = true;
                if (checkSessionPage == false)
                {
                    if (Session["CurrentDasboardID"] !=null)
                        currentDashboardID = (int)Session["CurrentDasboardID"];
                }
            }
        }
开发者ID:rutukulkarni,项目名称:PMD,代码行数:28,代码来源:Main.Master.cs


示例12: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     UserDetails user = new UserDetails();
     user = (UserDetails)Session["LoggedUser"];
     if (user == null)
         Response.Redirect("Login.aspx");
 }
开发者ID:rutukulkarni,项目名称:PMD,代码行数:7,代码来源:DashboardItemTeams.aspx.cs


示例13: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     UserDetails BAL = new UserDetails();
     this.Page.Title = "ShaadiSaagai.com";
     if (Session["uid_gender"] == null)
     {
         Response.Redirect("~/Default.aspx?refPage=" + Page.AppRelativeVirtualPath);
     }
     else 
     {
         if (!IsPostBack)
         {
             try
             {
                 objIntrest.User_Id = Session["uid_gender"].ToString().Split('_')[0];
                 BAL.User_Id = Session["uid_gender"].ToString().Split('_')[0];
                 lblUser.Text = BAL.GetName();
                 SetAllMsgCount();
             }
             catch (Exception ex)
             {
                 WebMsgBox.Show(ex.Message);
             }
         }
     }
 }
开发者ID:vivek0tiwari,项目名称:shaadisaagai,代码行数:26,代码来源:MasterPage.master.cs


示例14: RegisterButton_Click

 protected void RegisterButton_Click(object sender, EventArgs e)
 {
     UserDetails NewUser = new UserDetails();
     UserRegistrationClient ClientCompany = new UserRegistrationClient();
     Company[] Companynames = ClientCompany.RetriveCompanyNames();
     string companyName = CompanyID.Text;
     int i = 0;
     for (i = 0; i < Companynames.Length; i++)
     {
         int res = string.Compare(Companynames[i].Name, companyName, true);
         if (res == 0)
         {
             NewUser.CompanyId = Companynames[i].CompanyID;
             break;
         }
     }
     if (i == Companynames.Length)
     {
         ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('Enter correct company name or Register your Company.');", true);
         return;
     }
     NewUser.FirstName = FirstName.Text;
     NewUser.LastName = LastName.Text;
     NewUser.UserEmail = Email.Text;
     NewUser.EncryptedPassword = Password.Text;
     NewUser.IsOwner = false;
     UserRegistrationClient client = new UserRegistrationClient();
     bool success = client.UserRegistration(NewUser);
     if (success)
         ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('You are registered');window.location='Login.aspx'", true);
     else
         ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('error');", true);
     return;
 }
开发者ID:rutukulkarni,项目名称:PMD,代码行数:34,代码来源:Registration.aspx.cs


示例15: DoLogin

        public ActionResult DoLogin(UserDetails u)
        {
            if (ModelState.IsValid)
            {
                EmployeeBusinessLayer bal = new EmployeeBusinessLayer();

                //New Code Start
                UserStatus status = bal.GetUserValidity(u);
                bool IsAdmin = false;
                if (status==UserStatus.AuthenticatedAdmin)
                {
                    IsAdmin = true;
                }
                else if (status == UserStatus.AuthentucatedUser)
                {
                    IsAdmin = false;
                }
                else
                {
                    ModelState.AddModelError("CredentialError", "Invalid Username or Password");
                    return View("Login");
                }
                FormsAuthentication.SetAuthCookie(u.UserName, false);
                Session["IsAdmin"] = IsAdmin;
                return RedirectToAction("Index", "Employee");

                //New Code End
            }
            else
            {
                return View("Login");
            }
        }
开发者ID:EricCode1983,项目名称:MvcCodeFirst,代码行数:33,代码来源:AuthenticationController.cs


示例16: SearchUserTest

 public void SearchUserTest()
 {
     TestData.TestData.PopulateUserData();
     var user = new UserDetails();
     var searchResults = user.Search(new UserDetailsSearch() { ID = 2 });
     Assert.AreEqual(1, searchResults.Items.Count);
 }
开发者ID:piyushostwal,项目名称:BulevoltPOC,代码行数:7,代码来源:UserDetailsTests.cs


示例17: RemoveUserTest

 public void RemoveUserTest()
 {
     TestData.TestData.PopulateUserData();
     var user = new UserDetails();
     var result = user.Remove(new UserDetails { ID = 2 });
     Assert.AreEqual(true, result);
 }
开发者ID:piyushostwal,项目名称:BulevoltPOC,代码行数:7,代码来源:UserDetailsTests.cs


示例18: FindByEmailAsync

 public async Task<ApplicationUserExtended> FindByEmailAsync(string email, UserDetails detailsLevel)
 {
     using (var userManager = _userManagerFactory())
     {
         var user = await userManager.FindByEmailAsync(email);
         return GetUserExtended(user, detailsLevel);
     }
 }
开发者ID:sameerkattel,项目名称:vc-community,代码行数:8,代码来源:SecurityService.cs


示例19: FindByLoginAsync

 public async Task<ApplicationUserExtended> FindByLoginAsync(string loginProvider, string providerKey, UserDetails detailsLevel)
 {
     using (var userManager = _userManagerFactory())
     {
         var user = await userManager.FindAsync(new UserLoginInfo(loginProvider, providerKey));
         return GetUserExtended(user, detailsLevel);
     }
 }
开发者ID:sameerkattel,项目名称:vc-community,代码行数:8,代码来源:SecurityService.cs


示例20: Page_Load

 public void Page_Load(object sender, EventArgs e)
 {
     UserDetails user = new UserDetails();
     user = (UserDetails)Session["LoggedUser"];
     if (user == null)
         Response.Redirect("Login.aspx");
     UserLoginClient client = new UserLoginClient();
     UserId = user.UserId;
 }
开发者ID:rutukulkarni,项目名称:PMD,代码行数:9,代码来源:CreateNewDashboard.aspx.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UserForAuditing类代码示例发布时间:2022-05-24
下一篇:
C# UserDefinedVector类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap