//Update a record public static int UpdateRecord(eCustomerPointsMap eobj) { using (OneFineRateEntities db = new OneFineRateEntities()) { try { OneFineRate.tblCustomerPointsMap obj = (OneFineRate.tblCustomerPointsMap)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblCustomerPointsMap()); db.tblCustomerPointsMaps.Attach(obj); db.Entry(obj).State = System.Data.Entity.EntityState.Modified; return(db.SaveChanges()); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw e; } catch (Exception ex) { throw ex; } } }
//Add new record public static int AddRecord(eCustomerPointsMap customerPointsMap) { using (OneFineRateEntities db = new OneFineRateEntities()) { try { OneFineRate.tblCustomerPointsMap dbCustomerPoint = (OneFineRate.tblCustomerPointsMap)OneFineRateAppUtil.clsUtils.ConvertToObject(customerPointsMap, new OneFineRate.tblCustomerPointsMap()); db.tblCustomerPointsMaps.Add(dbCustomerPoint); return(db.SaveChanges()); } catch (Exception ex) { throw ex; } } }
//Update a record public static int UpdateLoyalityPointsExpiryDate(eLoyalityPointsCustomerData eobj) { int retval = 0; using (OneFineRateEntities db = new OneFineRateEntities()) { try { OneFineRate.tblCustomerPointsMap obj = (OneFineRate.tblCustomerPointsMap)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblCustomerPointsMap()); db.tblCustomerPointsMaps.Attach(obj); db.Entry(obj).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); retval = 1; } catch (Exception) { throw; } } return(retval); }