本文整理汇总了C#中User.GetUserInformation方法的典型用法代码示例。如果您正苦于以下问题:C# User.GetUserInformation方法的具体用法?C# User.GetUserInformation怎么用?C# User.GetUserInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User.GetUserInformation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button1_Click
private void button1_Click(object sender, EventArgs e)
{
string empId = textBox1.Text;
string password = textBox2.Text;
User aOldUser = new User(empId, password);
User findUser = aOldUser.GetUserInformation(empId);
bool login = aOldUser.CheckUser(aOldUser);
if (login)
{
string newPw1 = textBox3.Text;
string newPw2 = textBox4.Text;
if (newPw1==newPw2)
{
User aNewUser = new User(empId,newPw1,findUser.UserType);
aNewUser.UpdateInformation(aOldUser,aNewUser);
MessageBox.Show("Password updated");
this.Close();
fmLogin.f.Show();
}
else
{
MessageBox.Show("The two passwords do not match.");
}
}
}
示例2: buttonDelete_Click
private void buttonDelete_Click(object sender, EventArgs e)
{
if (listViewEmployee.SelectedItems.Count == 1)
{
DialogResult result = MessageBox.Show("Do You Want To Delete?", "Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (result.Equals(DialogResult.OK))
{
//delete original txt
string employeeId = listViewEmployee.SelectedItems[0].SubItems[0].Text;
string employeefn = listViewEmployee.SelectedItems[0].SubItems[1].Text;
string employeeln = listViewEmployee.SelectedItems[0].SubItems[2].Text;
string jobTitle = listViewEmployee.SelectedItems[0].SubItems[3].Text;
Employee anEmployee = new Employee(employeeId, employeefn, employeeln, jobTitle);
//create a user to search employee id, in order to get password of this employee
User searchUser = new User(employeeId,"",0);
anEmployee.AUser = searchUser.GetUserInformation(employeeId);
//delete employee and user information in file
if (anEmployee.AUser==null) //user information has already deleted in userGUI
{
anEmployee.DeleteEmployeeInformation(anEmployee);
}
else
{
anEmployee.DeleteInformation(anEmployee);
}
//get the selected row,delete it in listview
listViewEmployee.Items.Remove(listViewEmployee.SelectedItems[0]);
}
}
else
{
MessageBox.Show("Please select one row to delete!");
}
}
示例3: buttonModify_Click
private void buttonModify_Click(object sender, EventArgs e)
{
if (listViewEmployee.SelectedItems.Count == 1)
{
if (textBoxUserName.Text!="")
{
DialogResult result = MessageBox.Show("Do You Want To Modify?", "Modify", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (result.Equals(DialogResult.OK))
{
//create old user
User searchUser = null;
string employeeId = listViewEmployee.SelectedItems[0].SubItems[0].Text;
searchUser = new User(employeeId, "", 0);
User oldUser = searchUser.GetUserInformation(employeeId);
//create new user
string newUserId = textBoxUserName.Text;
string newPassword = textBoxPassword.Text;
int newUserType = Int32.Parse(comboBoxUserType.Text);
User newUser = new User(newUserId, newPassword, newUserType);
//update
newUser.UpdateInformation(oldUser, newUser);
buttonDelete.Enabled = true;
buttonList.Enabled = true;
buttonSearch.Enabled = true;
textBoxUserName.Text = "";
textBoxPassword.Text = "";
//comboBoxUserType.Text=" ";
listViewEmployee.Items.Clear();
}
else
{
buttonDelete.Enabled = true;
buttonList.Enabled = true;
buttonSearch.Enabled = true;
textBoxUserName.Text = "";
textBoxPassword.Text = "";
}
}
else
{
MessageBox.Show("Please double click one row to modify!");
}
}
else
{
MessageBox.Show("Please double click one row to modify!");
}
}