public static List <PrintRecordItem> ReadXml(String name) { List <PrintRecordItem> apri = new List <PrintRecordItem>(); XmlDocument xmlDoc = PrintRecordItem.GetXmlDoc(name); XmlNode xn = xmlDoc.SelectSingleNode("Datas"); // XmlNodeList xnl = xn.ChildNodes; foreach (XmlNode node in xn) { PrintRecordItem pri = new PrintRecordItem(); #if true pri._OrderId = ReadNode(node, "OrderId"); pri._OrderId_Suffix = ReadNode(node, "OrderId_Suffix"); pri._UserName = ReadNode(node, "UserName"); pri._PrinterName = ReadNode(node, "PrinterName"); pri.PrinterDriveName = ReadNode(node, "PrinterDriveName"); pri._phoneNumber = ReadNode(node, "PhoneNumber"); pri._phoneType = ReadNode(node, "PhoneType"); pri._androidOs = ReadNode(node, "OS"); pri._FileFullPath = ReadNode(node, "PrintFile"); pri._PParamcopies = int.Parse(ReadNode(node, "PrintCopy")); pri._PParamcolor = ReadNode(node, "PrintColor").Equals("彩色"); pri._PParamRange = ReadNode(node, "PrintRange"); pri._PParam2Paper = ReadNode(node, "PrintDuplx").Equals("双面"); pri._Paper_Type = ReadNode(node, "PrinterPaperType"); pri._TimeCompete = ReadNode(node, "TimeComplete"); pri._Price = ReadNode(node, "Price");// XmlElement item = doc.CreateElement("Price"); pri._AsyncNofify = ReadNode(node, "AsyncNotify"); apri.Add(pri); #endif } return(apri); }
/** * 保存提交信息到本地, *写入提交记录 * */ public void WriteSubmitRecord2Disk_NoPay(FileSendOnNet fson) { /* * 文件拷贝 */ { String from = fson.FileFullPath; String to = GetFileFullPath_SubmitDocPath() + fson.GetFileName(); File.Move(from, to); fson.FileFullPath = to; } this.Wait(); try { PrintRecordItem PRI = new PrintRecordItem(fson); PRI.WriteSubmitRecord2Disk(true); PrintSubmitItems.Add(PRI); } catch (Exception e) { LogHelper.WriteLog(this.GetType(), e); } this.Release(); }
public void WriteRecord2Disk(FileSendOnNet fson) { try { PrintRecordItem PRI = new PrintRecordItem(fson); String FilePath = GetFileFullPath(); PRI.WriteThisRecord2Disk(FilePath); }catch (Exception e) { LogHelper.WriteLog(this.GetType(), e); } }
/** *发送本机下挂的所有打印机 * * */ public static void SendPrinterPrice(Socket client, FileSendOnNet fson) { String orderid = fson.GetProperty("orderid_suffix", ""); String cmd = fson.GetProperty("cmd", ""); String asyncNotify_t = fson.GetProperty("ppneedasyncnotify", "false"); if ("getprice".Equals(cmd)) { if (!String.IsNullOrEmpty(orderid)) { PrintRecordItem pri = PrintSubmitItems.QueryId(orderid); if (pri != null) { String price_t = pri.GetPriceJson(); client.Send(System.Text.Encoding.UTF8.GetBytes(price_t)); return; } } } else if ("PrintDoc".Equals(cmd)) { //已经付费---打印之 if (!String.IsNullOrEmpty(orderid)) { PrintRecordItem pri = PrintSubmitItems.QueryId(orderid); if (pri != null) { String result_t = pri.GetPrintCompletedJson(); client.Send(System.Text.Encoding.UTF8.GetBytes(result_t)); return; } if ("true".Equals(asyncNotify_t)) { LogHelper.WriteLogError(typeof(PhonePcCommunication), "需要异步通知" + pri.WriteSubmitRecord2Disk(false)); } } } else { } }
public static List <PrintRecordItem> ReadAllRecord() { List <PrintRecordItem> LPRI = new List <PrintRecordItem>(); String Root = GetRootPath(); DirectoryInfo d = new DirectoryInfo(Root); if (!d.Exists) { return(LPRI); } ArrayList Flst = GetAll(d); foreach (Object a in Flst) { if (a.GetType() == typeof(String)) { List <PrintRecordItem> Lpri = PrintRecordItem.ReadXml((String)a); LPRI.AddRange(Lpri); } } return(LPRI); }
/** * */ public void Parse4PrintRecord(PrintRecordItem pri) { /*-----------------------------------*/ this.SetOrderId(pri._OrderId); this.SetOrderId_Suffix(pri.OrderId_Suffix); this.SetUserName(pri._UserName); this.SetPrice2Pay(pri.GetPrice()); this.FileFullPath = pri._FileFullPath; /*-----------------------------------*/ this._PhoneNumber = pri._phoneNumber; this._PhoneType = pri._phoneType; this._OsNumber = pri._androidOs; this.PParamcopies = pri._PParamcopies; this.PParamcolor = pri._PParamcolor; this.PParamRange = pri._PParamRange; this.PParam2Paper = pri._PParam2Paper; //pri._Paper_Type = "自动适应纸张大小"; this.SetPrinterName(pri._PrinterName); this.SetProperty("PrinterDriveName", pri.PrinterDriveName); this.SetProperty("ppneedasyncnotify", pri.AsyncNotify); /*-----------------------------------*/ }
public static List <PrintRecordItem> ReadXml(String name) { List <PrintRecordItem> apri = new List <PrintRecordItem>(); XmlDocument xmlDoc = PrintRecordItem.GetXmlDoc(name); XmlNode xn = xmlDoc.SelectSingleNode("Datas"); // XmlNodeList xnl = xn.ChildNodes; foreach (XmlNode node in xn) { PrintRecordItem pri = new PrintRecordItem(); #if true { XmlNode xn_t = node.SelectSingleNode("PrinterName"); if (xn_t != null) { pri.PrinterName = xn_t.InnerText; } // item.InnerText = this.PrinterName; // record.AppendChild(item); } { XmlNode xn_t = node.SelectSingleNode("PhoneNumber"); if (xn_t != null) { pri._phoneNumber = xn_t.InnerText; } } { XmlNode item = node.SelectSingleNode("PhoneType"); if (item != null) { pri._phoneType = item.InnerText; } } { XmlNode item = node.SelectSingleNode("OS"); if (item != null) { pri._androidOs = item.InnerText; } } { XmlNode item = node.SelectSingleNode("PrintCopy"); if (item != null) { pri.PParamcopies = int.Parse(item.InnerText); } } { XmlNode item = node.SelectSingleNode("PrintColor"); if (item != null) { pri.PParamcolor = item.InnerText.Equals("彩色"); } } { XmlNode item = node.SelectSingleNode("PrintRange"); if (item != null) { pri.PParamRange = item.InnerText; } } { XmlNode item = node.SelectSingleNode("PrintDuplx"); if (item != null) { pri.PParam2Paper = item.InnerText.Equals("双面"); } } { XmlNode item = node.SelectSingleNode("PrinterPaperType"); if (item != null) { pri.Paper_Type = item.InnerText; } } { XmlNode item = node.SelectSingleNode("TimeComplete"); if (item != null) { pri.TimeCompete = item.InnerText; } } apri.Add(pri); #endif } return(apri); }