[C#] 纯文本查看 复制代码 protected void Page_Load(object sender, EventArgs e)
{
//DateTime dt1 = DateTime.Parse("2014-07-26");
//DateTime dt2 = DateTime.Parse("2014-07-30");
DB coon = new DB();
DataSet _ds = new DataSet();
_ds = coon.ExecuteSql("Select hbdwno from hrshhbd where hbdmds=0 and hbdwno in('140300095','140201237 ')");
if (_ds!=null)
{
for (int i = 0; i < _ds.Tables[0].Rows.Count; i++)
{
CHECK_EMP(EMP_IN(_ds.Tables[0].Rows[i]["hbdwno"].ToString()), EMP_OUT(_ds.Tables[0].Rows[i]["hbdwno"].ToString()));
}
}
}
public DataSet EMP_IN(string str_no)
{
DB coon = new DB();
DataSet _ds = new DataSet();
_ds = coon.ExecuteSql("Select * from hrms_visa where emp_no='" + str_no + "' and visa_type=0 order by visa_time");
if (_ds == null)
{
return null;
}
return _ds;
}
public DataSet EMP_OUT(string str_no)
{
DB coon = new DB();
DataSet _ds = new DataSet();
_ds = coon.ExecuteSql("Select * from hrms_visa where emp_no='" + str_no + "' and visa_type=1 order by visa_time desc");
if (_ds == null)
{
return null;
}
return _ds;
}
public void CHECK_EMP(DataSet _dsIn, DataSet _dsOut)
{
if (_dsIn != null && _dsOut != null)
{
if (_dsIn.Tables[0].Rows.Count == _dsOut.Tables[0].Rows.Count)
{
for (int i = 0; i < _dsIn.Tables[0].Rows.Count; i++)
{
if(i<_dsOut.Tables[0].Rows.Count)
{
//Response.Write(_dsIn.Tables[0].Rows[i]["emp_no"] + "|" + _dsIn.Tables[0].Rows[i]["visa_time"] + "|" + _dsIn.Tables[0].Rows[i]["visa_type"] );
//Response.Write(_dsOut.Tables[0].Rows[i]["emp_no"] + "|" + _dsOut.Tables[0].Rows[i]["visa_time"] + "|" + _dsOut.Tables[0].Rows[i]["visa_type"]);
}
}
}
else
{
if (_dsIn.Tables[0].Rows.Count > _dsOut.Tables[0].Rows.Count)
{
for (int i = 0; i < _dsIn.Tables[0].Rows.Count; i++)
{
if (i < _dsOut.Tables[0].Rows.Count)
{
Response.Write(_dsIn.Tables[0].Rows[i]["emp_no"] + "|" + _dsIn.Tables[0].Rows[i]["visa_time"] + "|" + _dsIn.Tables[0].Rows[i]["visa_type"] + "----------");
Response.Write(_dsOut.Tables[0].Rows[i]["emp_no"] + "|" + _dsOut.Tables[0].Rows[i]["visa_time"] + "|" + _dsOut.Tables[0].Rows[i]["visa_type"] + "<br/>");
}
else
{
Response.Write(_dsIn.Tables[0].Rows[i]["emp_no"] + "|" + _dsIn.Tables[0].Rows[i]["visa_time"] + "|" + _dsIn.Tables[0].Rows[i]["visa_type"] + "----------");
Response.Write("| 异常记录 |" + "<br/>");
}
}
}
else
{
for (int i = 0; i < _dsOut.Tables[0].Rows.Count; i++)
{
if (i < _dsIn.Tables[0].Rows.Count)
{
Response.Write(_dsIn.Tables[0].Rows[i]["emp_no"] + "|" + _dsIn.Tables[0].Rows[i]["visa_time"] + "|" + _dsIn.Tables[0].Rows[i]["visa_type"] + "----------");
Response.Write(_dsOut.Tables[0].Rows[i]["emp_no"] + "|" + _dsOut.Tables[0].Rows[i]["visa_time"] + "|" + _dsOut.Tables[0].Rows[i]["visa_type"] + "<br/>");
}
else
{
Response.Write("| 异常记录 |" + "----------");
Response.Write(_dsOut.Tables[0].Rows[i]["emp_no"] + "|" + _dsOut.Tables[0].Rows[i]["visa_time"] + "|" + _dsOut.Tables[0].Rows[i]["visa_type"] + "<br/>");
}
}
}
}
}
}
这是我的代码 |