private void DoWork(object Sender, EventArgs E) { if (_Cam.WebCamImage == null) return; string Decoded = QrCodeUtility.Decode(_Cam.WebCamImage); if (!string.IsNullOrEmpty(Decoded)) { if (Decoded.Contains("name")) { CurrentEmployee = JsonConvert.DeserializeObject<Employee>(Decoded); } else if (Decoded.Contains("title")) { CurrentBook = JsonConvert.DeserializeObject<Book>(Decoded); } } }
private void Log_Click(object sender, EventArgs e) { Log.Enabled = false; var Context = new OpenShelfDataContext(); Context.Borrows.InsertOnSubmit(new Borrow{Id = Guid.NewGuid(), Book = CurrentBook.ToString(), Employee = CurrentEmployee.ToString()}); Context.SubmitChanges(); CurrentEmployee = null; CurrentBook = null; }