You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
3.1 KiB
C#
108 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
using XGL.Data.DBService;
|
|
using XGL.Data;
|
|
using XGL.Models.Model;
|
|
|
|
namespace XGLFinishPro.Views
|
|
{
|
|
/// <summary>
|
|
/// PersonView.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class PersonView : Window
|
|
{
|
|
|
|
public PersonView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private int PageIndex = 0;
|
|
private int PageSize = 10;
|
|
private int PageMax = 0;
|
|
userDB usdb = new userDB();
|
|
FormingMachineService formingMachineService = new FormingMachineService();
|
|
List<sys_user> users;
|
|
private void QueryBtn_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
PageIndex = 0;
|
|
GetDataFZ();
|
|
}
|
|
|
|
private void GetDataFZ()
|
|
{
|
|
string type = "";
|
|
if (this.UserType.SelectionBoxItem != null && this.UserType.SelectionBoxItem.ToString() == "辅助人员")
|
|
{
|
|
type = "f";
|
|
}
|
|
else if (this.UserType.SelectionBoxItem != null && this.UserType.SelectionBoxItem.ToString() == "一线员工")
|
|
{
|
|
type = "g";
|
|
}
|
|
else
|
|
{
|
|
type = "";
|
|
}
|
|
users = usdb.GetUsers(this.RealName.Text, type, PageIndex, PageSize);
|
|
users.ForEach(t =>
|
|
{
|
|
t.user_m_type=t.user_m_type == "f"?"辅助人员":t.user_m_type == "g"?"管理人员":t.user_m_type == "p"? "一线员工":"其他";
|
|
});
|
|
usdb.GetUsersCount(this.RealName.Text,type, out var Count);
|
|
PageMax = Count / PageSize + (Count % PageSize > 0 ? 1 : 0);
|
|
this.MainGrid.ItemsSource = users;
|
|
}
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
GetDataFZ();
|
|
}
|
|
|
|
private void LastPage_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
PageIndex--;
|
|
if (PageIndex == 0)
|
|
{
|
|
this.LastPage.IsEnabled = false;
|
|
}
|
|
this.NextPage.IsEnabled = true;
|
|
GetDataFZ();
|
|
}
|
|
|
|
private void NextPage_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
PageIndex++;
|
|
if (PageMax == PageIndex)
|
|
{
|
|
this.NextPage.IsEnabled = false;
|
|
}
|
|
this.LastPage.IsEnabled = true;
|
|
GetDataFZ();
|
|
}
|
|
|
|
private void AddBtn_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if(this.MainGrid.SelectedItem is sys_user user)
|
|
{
|
|
//new AuxiliaryPersonnel(user).ShowDialog();
|
|
}
|
|
}
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|