本文整理汇总了C#中UserDetails类的典型用法代码示例。如果您正苦于以下问题:C# UserDetails类的具体用法?C# UserDetails怎么用?C# UserDetails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserDetails类属于命名空间,在下文中一共展示了UserDetails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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";
}
}
}
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
}
示例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"];
}
}
}
示例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");
}
示例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);
}
}
}
}
示例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;
}
示例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");
}
}