private void Button_Click(object sender, RoutedEventArgs e) { User user = new User(); user.Id = Guid.NewGuid(); user.Name = tbName.Text; user.IdentityCardNumber = tbIdentityCardNumber.Text; if (rbMan.IsChecked == true && rbWoman.IsChecked == false) { user.Sex = "男"; } else if (rbMan.IsChecked == false && rbWoman.IsChecked == true) { user.Sex = "女"; } else { lbMessge.Content ="请选择性别!"; } user.Address = tbAddress.Text; user.Duty = "服务员"; user.UserName = tbUeserName.Text; user.Password = tbPassword.Text; AddUserBLL.addUser(user); UserRefresh(sender, e); tbName.Text = ""; tbIdentityCardNumber.Text = ""; tbAddress.Text = ""; tbUeserName.Text = ""; tbPassword.Text = ""; }
private void CheckOutBill_Loaded(object sender, RoutedEventArgs e) { DataTable checkInBill= UseRoomNumberSelectCheckInBillBLL.UseRoomNumberSelectCheckInBill(MainWondows.SelectRoomNumber); DataRow row = checkInBill.Rows[0]; checkOutBill.Id = Guid .NewGuid (); lbBillNumber.Content = checkOutBill.BillNumber = (Guid)row["BillNumber"]; lbRoomNumber .Content = checkOutBill.RoomNumber = MainWondows.SelectRoomNumber; lbGuestName .Content = checkOutBill.GuestName = (string)row["GuestName"]; lbNumberOfPeaple .Content = checkOutBill.NumberOfPeaple = (string)row["NumberOfPeaple"]; lbRoomRate .Content = checkOutBill.RoomRate = MainWondows.RoomRate; lbConsumPionPaid .Content = checkOutBill.ConsumptionPaid = (decimal)row["AmountPaid"] - MainWondows.RoomRate; lbDate .Content = checkOutBill.Date = System.DateTime.Now; User user=new User (); user .UserName =LoginWindows .UserName ; DataTable usertable = UseUserNameSelectUserBLL.useUserNameSelectUser(user); DataRow userRow = usertable.Rows[0]; lbWaiterName .Content = checkOutBill.WaiterName =(string ) userRow["Name"]; checkOutBill.CheckInBillTableId = (Guid)row["Id"]; }
public static List<User> loadUserData(string sql) { List<User> list = new List<User>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(sql)) { if (reader.HasRows) { while (reader.Read()) { User user = new User(); user.Name = reader.GetString(0); user.IdentityCardNumber = reader.GetString(1); user.Sex = reader.GetString(2); user.Address = reader.GetString(3); user.Duty = reader.GetString(4); user.UserName = reader.GetString(5); user.Password = reader.GetString(6); list.Add(user); } } } return list; }
public static void addUser(User user) { SqlParameter[] pams = new SqlParameter[] { new SqlParameter ("@Id",user.Id ), new SqlParameter ("@Name",user.Name ), new SqlParameter ("@IdentityCardNumber",user .IdentityCardNumber ), new SqlParameter ("@Sex", user .Sex ), new SqlParameter ("@Address",user .Address ), new SqlParameter ("@Duty",user .Duty ), new SqlParameter ("@UserName",user .UserName ), new SqlParameter ("@Password",user .Password ), }; SqlHelper.ExecuteNonQuery(AddUserDAL.sql, pams); }
/// <summary> /// 用户登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSuer_Click(object sender, RoutedEventArgs e) { User user = new User(); if (tbxUserName.Text == "" || pwbPassword.Password == "") { lbReminder.Content = "用户名或密码不能为空,请输入!"; } else { user.UserName = tbxUserName.Text; user.Password = pwbPassword.Password; DataTable table = LoginBll.Login(user); if (table.Rows.Count <= 0) { lbReminder.Content = "用户名不存在,请查证后再输入!"; return; } if (table.Rows.Count > 1) { lbReminder.Content = "有多个用户存在,请联系管理员!"; return; } DataRow row = table.Rows[0]; string dataUserPasswod = (string)row["Password"]; if (dataUserPasswod != user.Password) { lbReminder.Content = "密码错误,请查证后再输入!"; } else { UserName = user .UserName ; MainWondows mainWindows = new MainWondows(); DataTable userTable = UseUserNameSelectUserBLL.useUserNameSelectUser(user); DataRow userRow = userTable.Rows[0]; WaiterName = (string)userRow["Name"]; mainWindows.Show(); LoginWindow.Close(); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { Guest guest=new Guest (); guest.Id =AddGuestToRoom.FirstGuestId ; DataTable table=UseIdSelectGuestBLL.useIdSelectGuest (guest ); DataRow row=table .Rows[0]; lbBillNumber.Content = BillNumber=Guid.NewGuid(); lbRoomNumber.Content = MainWondows.SelectRoomNumber; lbNumberOfPeaple.Content = AddGuestToRoom.NumberOfPeaple; lbRoomRate.Content = MainWondows.RoomRate; User user = new User(); user.UserName = LoginWindows.UserName; DataTable userTable = UseUserNameSelectUserBLL .useUserNameSelectUser (user ); DataRow userRow = userTable.Rows[0]; lbWaiterName.Content = WaiterName = (string)userRow["Name"]; lbGuestName.Content = GuestName = (string)row["Name"]; lbDate.Content = System.DateTime.Now; }
/// <summary> /// 用户验证 /// </summary> /// <param name="sql"></param> /// <param name="User"></param> /// <returns></returns> public static DataTable Longin(User user ) { DataTable table = SqlHelper.ExecuteDataTable(sql, new SqlParameter("@UserName", user.UserName)); return table; }
/// <summary> /// 验证登陆 /// </summary> /// <param name="User"></param> public static DataTable Login(User user) { return LoginDAL.Longin(user ); }
private void UserDataRefresh(object sender, RoutedEventArgs e) { User user = new User(); user.UserName = LoginWindows.UserName; DataTable userTable = UseUserNameSelectUserBLL.useUserNameSelectUser(user); DataRow row = userTable.Rows[0]; if ((string)row["Duty"] == "管理员") { dgUserData.ItemsSource = LoadUserDataBLL.loadUserData(); } }
public static void addUser(User user) { AddUserDAL.addUser(user); }
public static DataTable useUserNameSelectUser(User user) { return UseUserNameSelectUserDAL.useUserNameSelectUser(user); }