}//end of method internal static bool WriteCarAllocation(out TMRIWriteResponse response, string kchp, string kcxh, string kscc, string qdxm) { string id = "17CB3"; switch (kscc) { case "上午场": kscc = "0"; break; case "下午场": kscc = "1"; break; default: kscc = string.Empty; break; } string writeBodyXml = $"<kchp>{kchp}</kchp>" + $"<kcxh>{kcxh}</kcxh>" + $"<kscc>{kscc}</kscc>"; if (!string.IsNullOrEmpty(qdxm)) { writeBodyXml += $"<qdxm>{qdxm}</qdxm>"; } if (!DoWrite(out response, id, writeBodyXml)) { return(false); } return(true); }//end of method
}//end of method static bool DoWrite(out TMRIWriteResponse response, string id, string writeBodyXml) { //string writeXmlDoc = System.Web.HttpUtility.UrlEncode(writeHeader + writeBodyXml + writeFooter, Encoding.GetEncoding("UTF-8")); string writeXmlDoc = writeHeader + writeBodyXml + writeFooter; #if true StreamWriter sw = new StreamWriter(@".\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-") + id + "-WRITE.txt"); #endif try { try { #if true sw.WriteLine(id.Substring(0, 2)); sw.WriteLine(Form_Config.ServiceSerialNumber); sw.WriteLine(id); sw.WriteLine(writeXmlDoc); sw.WriteLine(); #endif string writeResponseXmlDoc = System.Web.HttpUtility.UrlDecode(tmri.writeObjectOut(id.Substring(0, 2), Form_Config.ServiceSerialNumber, id, writeXmlDoc), Encoding.GetEncoding("UTF-8")); #if true sw.WriteLine(writeResponseXmlDoc); #endif response = new TMRIWriteResponse(id, writeResponseXmlDoc); return("1" == response.code); } catch (Exception ex) { #if true sw.WriteLine(ex.Message); #endif } } finally { #if true sw.Close(); #endif } response = null; return(false); }//end of method
internal static bool WriteCheckIn(out TMRIWriteResponse response, string sfzmhm, string kskm, string kcxh, string kscc, string qdxm) { string id = "17CB2"; string writeBodyXml = $"<sfzmhm>{sfzmhm}</sfzmhm>"; switch (kskm) { case "科目一": kskm = "1"; break; case "科目二": kskm = "2"; break; case "科目三": kskm = "3"; break; default: kskm = string.Empty; break; } switch (kscc) { case "上午场": kscc = "0"; break; case "下午场": kscc = "1"; break; default: kscc = string.Empty; break; } writeBodyXml += $"<kskm>{kskm}</kskm>"; writeBodyXml += $"<kcxh>{kcxh}</kcxh>" + $"<kscc>{kscc}</kscc>"; if (!string.IsNullOrEmpty(qdxm)) { writeBodyXml += $"<qdxm>{qdxm}</qdxm>"; } if (!DoWrite(out response, id, writeBodyXml)) { return(false); } return(true); }//end of method