185 lines
5.5 KiB
C#
185 lines
5.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using SOH.Kernel;
|
|
using EAS;
|
|
using EAS.Services;
|
|
using SOH.BLL;
|
|
using SOH.Entities.DTO;
|
|
using SOH.Data;
|
|
using SOH.Entities;
|
|
|
|
namespace SOH.ShouFei
|
|
{
|
|
public partial class frmTJWJRY : Form
|
|
{
|
|
private int htbm;
|
|
public frmTJWJRY()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public frmTJWJRY(int thtbm):this()
|
|
{
|
|
htbm = thtbm;
|
|
this.gvWJRS.AutoGenerateColumns = false;
|
|
this.gvWJRYList.AutoGenerateColumns = false;
|
|
//根据htbm加载未检人员分组及人数
|
|
BindWJRS(thtbm);
|
|
|
|
}
|
|
private void BindWJRS(int thtbm)
|
|
{
|
|
var vs = ServiceContainer.GetService<It_ttgzb>();
|
|
List<dto_wjrs> ldw = vs.GetWJRYByHtbm(thtbm);
|
|
this.gvWJRS.DataSource = null;
|
|
if (ldw == null || ldw.Count == 0)
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
int hj=0;
|
|
for (int i = 0; i < ldw.Count; i++)
|
|
{
|
|
hj += ldw[i].wjrs;
|
|
}
|
|
dto_wjrs dw = new dto_wjrs();
|
|
dw.htfzbm = 0;
|
|
dw.htfzmc = "合计";
|
|
dw.wjrs = hj;
|
|
ldw.Add(dw);
|
|
this.gvWJRS.DataSource = ldw;
|
|
}
|
|
}
|
|
|
|
private void gvWJRS_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0)
|
|
{
|
|
return;
|
|
}
|
|
dto_wjrs dw = this.gvWJRS.Rows[e.RowIndex].DataBoundItem as dto_wjrs;
|
|
if (dw.htfzbm == 0)
|
|
{
|
|
this.gvWJRYList.DataSource = null;
|
|
return;
|
|
}
|
|
//根据htfzbm查询出未检人员的list
|
|
var vs = ServiceContainer.GetService<It_ttgzb>();
|
|
List<t_ttgzb> lttt= vs.GetWjryByHtfzbm(dw.htfzbm);
|
|
this.gvWJRYList.DataSource = null;
|
|
if (lttt != null &<tt.Count> 0)
|
|
{
|
|
this.gvWJRYList.DataSource = lttt;
|
|
}
|
|
}
|
|
|
|
private void btnSelectAll_Click(object sender, EventArgs e)
|
|
{
|
|
for (int i = 0; i < gvWJRYList.Rows.Count; i++)
|
|
{
|
|
DataGridViewRow dgv = gvWJRYList.Rows[i] as DataGridViewRow;
|
|
dgv.Cells[0].Value = true;
|
|
}
|
|
}
|
|
|
|
private void btnCancleAll_Click(object sender, EventArgs e)
|
|
{
|
|
for (int i = 0; i < gvWJRYList.Rows.Count; i++)
|
|
{
|
|
DataGridViewRow dgv = gvWJRYList.Rows[i] as DataGridViewRow;
|
|
dgv.Cells[0].Value = false;
|
|
}
|
|
}
|
|
|
|
private void btnDelete_Click(object sender, EventArgs e)
|
|
{
|
|
List<t_ttgzb> lit = new List<t_ttgzb>();
|
|
//找到选择项目
|
|
for (int i = 0; i < gvWJRYList.Rows.Count; i++)
|
|
{
|
|
DataGridViewRow dgv = gvWJRYList.Rows[i] as DataGridViewRow;
|
|
if (dgv.Cells[0].Value != null)
|
|
{
|
|
bool ifcheck = bool.Parse(dgv.Cells[0].Value.ToString());
|
|
if(ifcheck)
|
|
{
|
|
t_ttgzb it=dgv.DataBoundItem as t_ttgzb;
|
|
lit.Add(it);
|
|
}
|
|
}
|
|
}
|
|
if(lit==null||lit.Count==0)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
OperationResult or= DeleteWjry(lit);
|
|
if (or.State == 1)
|
|
{
|
|
BindWJRS(htbm);
|
|
this.gvWJRYList.DataSource = null;
|
|
}
|
|
MessageBox.Show(or.Message);
|
|
}
|
|
}
|
|
|
|
//删除未检人员
|
|
private OperationResult DeleteWjry(List<t_ttgzb> lit)
|
|
{
|
|
OperationResult or = new OperationResult();
|
|
var vs = ServiceContainer.GetService<It_tjhk>();
|
|
or=vs.DeleteWjry(lit);
|
|
return or;
|
|
}
|
|
|
|
//设置未检人员为待检
|
|
private OperationResult SetDJ(List<t_ttgzb> lit)
|
|
{
|
|
OperationResult or = new OperationResult();
|
|
var vs = ServiceContainer.GetService<It_tjhk>();
|
|
or = vs.SetDaiCha(lit);
|
|
return or;
|
|
}
|
|
|
|
private void btnDC_Click(object sender, EventArgs e)
|
|
{
|
|
List<t_ttgzb> lit = new List<t_ttgzb>();
|
|
//找到选择项目
|
|
for (int i = 0; i < gvWJRYList.Rows.Count; i++)
|
|
{
|
|
DataGridViewRow dgv = gvWJRYList.Rows[i] as DataGridViewRow;
|
|
if (dgv.Cells[0].Value != null)
|
|
{
|
|
bool ifcheck = bool.Parse(dgv.Cells[0].Value.ToString());
|
|
if (ifcheck)
|
|
{
|
|
t_ttgzb it = dgv.DataBoundItem as t_ttgzb;
|
|
lit.Add(it);
|
|
}
|
|
}
|
|
}
|
|
if (lit == null || lit.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
OperationResult or = SetDJ(lit);
|
|
if (or.State == 1)
|
|
{
|
|
BindWJRS(htbm);
|
|
this.gvWJRYList.DataSource = null;
|
|
}
|
|
MessageBox.Show(or.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|