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.
84 lines
2.3 KiB
C#
84 lines
2.3 KiB
C#
using CommonFunc;
|
|
using CommonFunc.Tools;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
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.Navigation;
|
|
using System.Windows.Shapes;
|
|
using XGL.Dats.DBServiceFinishProd;
|
|
|
|
namespace XGLFinishPro.Views
|
|
{
|
|
/// <summary>
|
|
/// LanJu_NowUser.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class LanJu_NowUser : UserControl
|
|
{
|
|
FinishProdDBService userDbWareHouse = new FinishProdDBService();
|
|
string deviceCode = Utils.GetAppSetting("DeviceCode");
|
|
public LanJu_NowUser()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
|
|
{
|
|
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
|
|
}
|
|
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
GetRecordInfo();
|
|
}
|
|
|
|
private void GetRecordInfo()
|
|
{
|
|
try
|
|
{
|
|
DataTable dt = userDbWareHouse.GetAttendanceRecord(deviceCode, LoginUser.WorkDate);
|
|
if (dt == null)
|
|
{
|
|
dgUserInfo.ItemsSource = null;
|
|
}
|
|
else
|
|
{
|
|
// 添加一个新的列来表示上班/下班状态
|
|
dt.Columns.Add("Status", typeof(string));
|
|
|
|
// 遍历每一行,并根据 endTime 的值设置状态
|
|
foreach (DataRow row in dt.Rows)
|
|
{
|
|
if (row["end_time"] != DBNull.Value && !string.IsNullOrEmpty(row["end_time"].ToString()))
|
|
{
|
|
row["Status"] = "下班";
|
|
}
|
|
else
|
|
{
|
|
row["Status"] = "上班";
|
|
}
|
|
}
|
|
|
|
dgUserInfo.ItemsSource = dt.DefaultView;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|