public Country selectCountry(Country obj) { try { ICountrySvc svc = (ICountrySvc)this.getService(typeof(ICountrySvc).Name); return svc.selectCountry(obj); } catch (ServiceLoadException ex) { throw ex; } }
public Boolean objectDataEquals(Country obj) { if (!(this.Country_ID.Equals(obj.Country_ID))) { return false; } if (!(this.Country_Name.Equals(obj.Country_Name))) { return false; } return true; }
public bool deleteCountry(Country obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Country> CountryList = from country in db.Countries where country.Country_ID == obj.Country_ID select country; if ((CountryList.ToArray().Length > 0)) { foreach (Country country in CountryList) { for (int n = 0; n < country.Locations.Count; n++) { db.Locations.Remove((country.Locations.ToArray())[0]); } } db.Countries.Remove((CountryList.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 bool insertCountry(Country obj) { using (RealReportContext db = new RealReportContext()) { try { db.Countries.Add(obj); db.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
public Boolean updateCountry(Country obj) { try { ICountrySvc svc = (ICountrySvc)this.getService(typeof(ICountrySvc).Name); if (obj.isDataEntered()) { return svc.updateCountry(obj); } else { throw new BusinessValidationException(CustomErrors.REQUIRED_FIELD); } } catch (ServiceLoadException ex) { throw ex; } }
public Country selectCountry(Country obj) { RealReportContext db = new RealReportContext(); try { IQueryable<Country> CountryList = from country in db.Countries where country.Country_ID == obj.Country_ID select country; return (CountryList.ToList())[0]; } catch (Exception ex) { return null; } }
public bool updateCountry(Country obj) { using (RealReportContext db = new RealReportContext()) { try { IQueryable<Country> CountryList = from country in db.Countries where country.Country_ID == obj.Country_ID select country; if ((CountryList.ToArray()).Length > 0) { foreach (Country country in CountryList) { country.Country_Name = obj.Country_Name; } #region Database Submission with Rollback try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }