public bool UpdateQRCode(QRCodeImage image, string ID) { int _id = Convert.ToInt32(ID); using (EventrixDBDataContext db = new EventrixDBDataContext()) { var query = (from img in db.Guest_QRCodes where img.QR_Id.Equals(_id) select img); if (query.Count() != 0) { Guest_QRCode toinsert = query.Single(); toinsert.Name = image.Name; toinsert.Location = image.Location; // db.EventViews.InsertOnSubmit(toinsert); db.SubmitChanges(); return(true); } else { return(false); } }; }
public bool CheckInGuest(string QR_ID, string S_ID) { int s_ID = Convert.ToInt32(S_ID); int _id = Convert.ToInt32(QR_ID); using (EventrixDBDataContext db = new EventrixDBDataContext()) { try { var query = (from qr in db.Guest_QRCodes where qr.QR_Id.Equals(QR_ID) select qr).First(); if (query != null) { Guest_QRCode data = query; data.Checked_In = 1; data.EntranceTime = DateTime.Now; db.SubmitChanges(); UpdateStaffNumScans(s_ID); return(true); } else { return(false); } }catch (Exception) { return(false); } }; }
//Upload User CreditsS public bool UploadCredit(EventTicket _ticket) { using (EventrixDBDataContext db = new EventrixDBDataContext()) { try { Ticket_Template toInsert = (from st in db.Ticket_Templates where st.TicketID.Equals(_ticket._TicketID) select st).First(); toInsert.Credit = _ticket._Credit; db.SubmitChanges(); List <Guest_Ticket> insert = (from st in db.Guest_Tickets where st.ticket_temp_id.Equals(_ticket._TicketID) && st.G_ID.Equals(_ticket._GuestID) select st).ToList(); // toInsert.Credit = _ticket._Credit; foreach (Guest_Ticket gt in insert) { var query = (from qr in db.Guest_QRCodes where qr.ticket_Id.Equals(gt.ticket_Id) select qr).First(); Guest_QRCode GQR = query; GQR.Credit = _ticket._Credit; db.SubmitChanges(); } return(true); } catch { return(false); } } }
//scanning QR Code and changing the check in status public bool updateQRCode(QRCodeImage image) { try { using (EventrixDBDataContext db = new EventrixDBDataContext()) { Guest_QRCode toInsert = (from st in db.Guest_QRCodes where st.QR_Id.Equals(image.QRCodeID) select st).First(); toInsert.Checked_In = image.Checked_in; db.SubmitChanges(); return(true); }; }catch (Exception) { return(false); } }
public int saveQRCodeImage(QRCodeImage imageUp) { try { Guest_QRCode fileToSave = new Guest_QRCode(); using (EventrixDBDataContext db = new EventrixDBDataContext()) { var query = from image in db.Guest_QRCodes where image.QR_Id.Equals(imageUp.QRCodeID) select image; if (query.Count() == 0) { fileToSave.Name = imageUp.Name; fileToSave.ticket_Id = imageUp.ticket_ID; fileToSave.Location = imageUp.Location; fileToSave.EntranceTime = imageUp.EntranceTime; fileToSave.Checked_In = 0; fileToSave.Credit = imageUp.Credit; // fileToSave.tick = Convert.ToInt32(imageUp.EventID); db.Guest_QRCodes.InsertOnSubmit(fileToSave); db.SubmitChanges(); } else if (query.Count() == 1) { return(0); } }; using (EventrixDBDataContext db = new EventrixDBDataContext()) { var query = (from tk in db.Guest_QRCodes select tk).ToList(); Guest_QRCode tick = query.Last(); int ID = tick.QR_Id; return(ID); }; } catch (Exception) { return(0); } }