public Location selectLocation(Location obj) { try { ILocationSvc svc = (ILocationSvc)this.getService(typeof(ILocationSvc).Name); return svc.selectLocation(obj); } catch (ServiceLoadException ex) { throw ex; } }
public Boolean objectDataEquals(Location obj) { if (!(this.Location_ID.Equals(obj.Location_ID))) { return false; } if (!(this.City.Equals(obj.City))) { return false; } return true; }
public bool insertLocation(Location obj) { using (RealReportContext db = new RealReportContext()) { try { db.Locations.Add(obj); db.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
public bool deleteLocation(Location obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Location> LocationList = from location in db.Locations where location.Location_ID == obj.Location_ID select location; if ((LocationList.ToArray().Length > 0)) { foreach (Location location in LocationList) { location.Properties.Clear(); location.Country = null; } db.Locations.Remove((LocationList.ToArray())[0]); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Boolean updateLocation(Location obj) { try { ILocationSvc svc = (ILocationSvc)this.getService(typeof(ILocationSvc).Name); if (obj.isDataEntered()) { return svc.updateLocation(obj); } else { throw new BusinessValidationException(CustomErrors.REQUIRED_FIELD); } } catch (ServiceLoadException ex) { throw ex; } }
public Location selectLocation(Location obj) { RealReportContext db = new RealReportContext(); try { IQueryable<Location> LocationList = from location in db.Locations where location.Location_ID == obj.Location_ID select location; return (LocationList.ToList())[0]; } catch (Exception ex) { return null; } }
public bool updateLocation(Location obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Location> LocationList = from location in db.Locations where location.Location_ID == obj.Location_ID select location; if ((LocationList.ToArray()).Length > 0) { foreach (Location location in LocationList) { location.City = obj.City; location.Country_ID = obj.Country_ID; location.Country = null; } #region Database Submission with Rollback try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }