public bool DeleteOrder(tOrderBarcode el) { using (var trans = context.Database.BeginTransaction()) { try { tOrderBarcode dbEntry = context.tOrderBarcode.Where(t => t.Code == el.Code).FirstOrDefault(); if (dbEntry != null) { context.tOrderBarcode.Remove(dbEntry); context.SaveChanges(); trans.Commit(); } else { trans.Dispose(); } } catch (Exception e) { trans.Rollback(); return(false); } } return(true); }
public bool IsChanged(tOrderBarcode origOb, tOrderBarcode newOb) { if (origOb.Code == newOb.Code && origOb.Barcode == newOb.Barcode && origOb.IsActive == newOb.IsActive) { return(false); } return(true); }
public void AddBarcode(tOrderBarcode ob) { using (var trans = context.Database.BeginTransaction()) { try { tOrderBarcode dbEntry = context.tOrderBarcode.Where(t => t.Barcode == ob.Barcode && t.Code == ob.Code).FirstOrDefault(); context.tOrderBarcode.Remove(dbEntry); context.tOrderBarcode.Add(ob); context.SaveChanges(); trans.Commit(); } catch { trans.Rollback(); } } }
public bool IsListChanged(List <tOrderBarcode> list) { foreach (tOrderBarcode el in list) { tOrderBarcode dbEntry = context.tOrderBarcode.Where(t => t.Code == el.Code).FirstOrDefault(); if (dbEntry != null) { if (IsChanged(dbEntry, el)) { return(true); } } else { return(true); } } return(false); }
public void MarkBarcode(tOrderBarcode ob) { }