public string RollbackTask(string xml) { string result = string.Empty; try { XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(xml); string taskID = xmldoc.DocumentElement.SelectSingleNode("//TaskID").InnerText; DateTime dt1 = DateTime.Now; WriteLog.WriteLine(WriteLog.m_FilePreName, string.Format("RollbackTask {0}", taskID)); System.Data.SqlClient.SqlParameter sp_taskID = new System.Data.SqlClient.SqlParameter("@taskID", taskID); System.Data.SqlClient.SqlParameter sp_flag = new System.Data.SqlClient.SqlParameter("@flag", System.Data.SqlDbType.Int); sp_flag.Direction = System.Data.ParameterDirection.Output; System.Data.SqlClient.SqlParameter sp_msg = new System.Data.SqlClient.SqlParameter("@msg", System.Data.SqlDbType.VarChar); sp_msg.Direction = System.Data.ParameterDirection.Output; sp_msg.Size = 1024; SQLUtil.ExecProc(m_conn, "spRollbackHistoryTask", sp_taskID, sp_flag, sp_msg); result = sp_msg.Value.ToString(); WriteLog.WriteLine(WriteLog.m_FilePreName, string.Format("RollbackTask {0} spend {1} s", taskID, (DateTime.Now - dt1).TotalSeconds.ToString())); switch (int.Parse(sp_flag.Value.ToString())) { case 1: result = IdlUtil.ConvertToReslutXML(1, "接收成功"); break; default: result = IdlUtil.ConvertToReslutXML(0, result); break; } } catch (NullReferenceException ex) { result = IdlUtil.ConvertToReslutXML(0, "报文信息不完整或格式有误,请核查"); WriteLog.WriteLine(xml + Environment.NewLine + ex.ToString()); } catch (Exception ex) { if (ex.Message.IndexOf("重复键") >= 0) { result = IdlUtil.ConvertToReslutXML(0, "此工单已下发"); } else { result = IdlUtil.ConvertToReslutXML(0, ex.Message); } WriteLog.WriteLine(xml + Environment.NewLine + ex.ToString()); } return(result); }
private void ClearTask(string procName) { SqlParameter spTaskID = new SqlParameter("@taskID", m_currentReply.ReplyBoss.TaskID); SQLUtil.ExecProc(m_Connstr, procName, spTaskID); }