public async Task <QRCodeDataObject> Add(QRCodeDataObject qrcode) { QRCode code = DyMapper.Map <QRCodeDataObject, QRCode>(qrcode); await this.repository.Add(code); await this.repository.Commit(); return(DyMapper.Map <QRCode, QRCodeDataObject>(code)); }
private static void HttpCommunicator_Error(object sender, DyEventArgs e) { string receive = Encoding.ASCII.GetString(e.Data); string content = receive.Split("&")[0]; string line = receive.Split("&")[1]; Console.WriteLine($"{e.Message}\n{content},{line}"); QRCodeDataObject code = new QRCodeDataObject(); code.Code = content; code.AssemblyLine = line; code.CreateTime = DateTime.Now; qrCodeService.Add(code); }
private static void Scaner_Received(byte[] buf) { string str = Encoding.ASCII.GetString(buf); Console.WriteLine(str); if (str.Contains("ER") || str.Contains("OK")) { Console.WriteLine(str); return; } QRCodeDataObject code = new QRCodeDataObject(); code.Code = str; code.AssemblyLine = AppConfig.ASSEMBLY_LINE; code.CreateTime = DateTime.Now; qrCodeService.Add(code); //Console.WriteLine(code.ToURLParameter()); //byte[] data = Encoding.UTF8.GetBytes(code.ToURLParameter()); //httpCommunicator.Send(data); }
public async Task <QRCodeDataObject> Add(QRCodeDataObject data) { return(await this.qrcodeService.Add(data)); }