12,162
社区成员
发帖
与我相关
我的任务
分享
protected void btnQuery_Click(object sender, EventArgs e)
{
string emplid = string.Empty;
string[] emplidArr = { "Z20171010", "Z20171011", "Z20171012" };
for (int i = 0; i < emplidArr.Length; i++)
{
emplid = emplid + ",'" + emplidArr[i] + "'";
}
emplid = emplid.TrimStart(',');
try
{
string strSql1 = "UPDATE person p SET p.building_code = '', p.room_id = '', p.active = 'O' WHERE p.emplid in (" + emplid + ") and p.active='Y'";
string strSql2 = @"UPDATE accomm a SET a.odate = trunc(sysdate), a.outdormadm = 'system', a.action_type = 'O', a.out_reason = '離職退宿'
WHERE a.accomm_id in (select p.accomm_id from person p where p.emplid in (" + emplid + ") and p.active = 'Y') and a.action_type = 'I'";
BLLDAL myInsert = new BLLDAL(this.sconn);
myInsert.ExecuteSQL(strSql1);
myInsert.ExecuteSQL(strSql2);
}
catch (Exception ex)
{
}
}
[WebMethod]
public string Dorm_CheckOut(string[] emplidArr)
{
int num = 0;
string emplid = string.Empty;
string result = string.Empty;
for (int i = 0; i < emplidArr.Length; i++)
{
emplid = emplid+",'"+ emplidArr[i]+"'";
}
emplid = emplid.TrimStart(',');
try
{
string strSql1 = "UPDATE person p SET p.building_code = '', p.room_id = '', p.active = 'O' WHERE p.emplid in (" + emplid + ") and p.active='Y'";
string strSql2 = @"UPDATE accomm a SET a.odate = trunc(sysdate), a.outdormadm = 'system', a.action_type = 'O', a.out_reason = '離職退宿'
WHERE a.accomm_id in (select p.accomm_id from person p where p.emplid in (" + emplid + ") and p.active = 'Y') and a.action_type = 'I'";
BLLDAL myInsert = new BLLDAL(this.sconn);
myInsert.ExecuteSQL(strSql1);
myInsert.ExecuteSQL(strSql2);
}
catch (Exception ex)
{
num++;
}
if (num == 0)
{
return "OK";
}
else
{
return "NO";
}
}
static void Main(string[] args)
{
string[] emplidArr = {"Z20171010", "Z20171011", "Z20171012" };
WebReference1.Dorm_CheckOutWebService dormService = new WebReference1.Dorm_CheckOutWebService();
Console.WriteLine(dormService.Dorm_CheckOut(emplidArr));
Console.ReadKey();
}