public Client_IdentifyingSession(Supplier supplier, Pack pack, IdentifyingSession session) { IdentifyingSessionPK = session.IdentifyingSessionPK; SupplierName = supplier.SupplierName; PackID = pack.PackID; DateCreated = session.ExecutedDate; IsOpened = pack.IsOpened; }
public void changeExecutedDate(IdentifyingSession session) { try { session.ExecutedDate = DateTime.Now; db.Entry(session).State = EntityState.Modified; db.SaveChanges(); } catch (Exception e) { throw e; } }
public IdentifyingSession createdIdentifyingSession(string userID) { IdentifyingSession identifyingSession = new IdentifyingSession(userID); db.IdentifyingSessions.Add(identifyingSession); try { db.SaveChanges(); } catch (Exception e) { throw e; } identifyingSession = (from iss in db.IdentifyingSessions.OrderByDescending(unit => unit.IdentifyingSessionPK) select iss).FirstOrDefault(); return(identifyingSession); }
public void deleteIdentifiedItemsOfSession(int IdentifyingSessionPK) { try { IdentifyingSession identifyingSession = db.IdentifyingSessions.Find(IdentifyingSessionPK); List <IdentifiedItem> list = (from ii in db.IdentifiedItems where ii.IdentifyingSessionPK == IdentifyingSessionPK select ii).ToList(); foreach (var item in list) { db.IdentifiedItems.Remove(item); } db.IdentifyingSessions.Remove(identifyingSession); db.SaveChanges(); } catch (Exception e) { throw e; } }