public bool MoveShades(ShadeCard oSelectedShade, ShadeCard oAffectedShade) { try { using (var ctx = new DBAJEntities()) { int?SelectedOrderId = oSelectedShade.DisplayOrder; int?affectOrderId = oAffectedShade.DisplayOrder; //selected shade oSelectedShade.DisplayOrder = affectOrderId; ctx.Entry(oSelectedShade).State = EntityState.Modified; //affected shade oAffectedShade.DisplayOrder = SelectedOrderId; ctx.Entry(oAffectedShade).State = EntityState.Modified; ctx.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public void Update(User oUser) { try { using (var ctx = new DBAJEntities()) { ctx.Entry(oUser).State = EntityState.Modified; ctx.SaveChanges(); } } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } catch (Exception ex) { throw ex; } }
public void Update(SiteConfig oSiteConfig) { try { using (var ctx = new DBAJEntities()) { ctx.Entry(oSiteConfig).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception) { throw; } }
public void Update(EmbroideryFirmPriceSetting oEmbroideryFirmPriceSetting) { try { using (var ctx = new DBAJEntities()) { ctx.Entry(oEmbroideryFirmPriceSetting).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void Update(FinanceSale oFinanceSale) { try { using (var ctx = new DBAJEntities()) { ctx.Entry(oFinanceSale).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } } catch (Exception) { throw; } }
public void Update(JariCompany oJariCompany) { try { using (var ctx = new DBAJEntities()) { ctx.Entry(oJariCompany).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void SetDefaultPrimaryLocation(EmbroideryFirmLocation oEmbroideryFirmLocation) { try { if (oEmbroideryFirmLocation.IsPrimaryLocation == true) { ResetPrimaryLocation(oEmbroideryFirmLocation.EmbroideryFirmId); } using (var ctx = new DBAJEntities()) { ctx.Entry(oEmbroideryFirmLocation).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception) { throw; } }
public void Update(ShadeCard oShadeCard) { try { using (var ctx = new DBAJEntities()) { if (oShadeCard.DisplayOrder == null) { oShadeCard.DisplayOrder = (ctx.ShadeCards.OrderByDescending(c => c.ShadeId).FirstOrDefault().ShadeId) + 1; } ctx.Entry(oShadeCard).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { throw ex; } }