Example #1
0
 public Interest selectInterest(Interest obj)
 {
     try
     {
         IInterestSvc svc = (IInterestSvc)this.getService(typeof(IInterestSvc).Name);
         return svc.selectInterest(obj);
     }
     catch (ServiceLoadException ex)
     {
         throw ex;
     }
 }
        public bool insertInterest(Interest obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    db.Interests.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Example #3
0
 public Boolean insertInterest(Interest obj)
 {
     try
     {
         IInterestSvc svc = (IInterestSvc)this.getService(typeof(IInterestSvc).Name);
         if (obj.isDataEntered())
         {
             return svc.insertInterest(obj);
         }
         else
         {
             throw new BusinessValidationException(CustomErrors.REQUIRED_FIELD);
         }
     }
     catch (ServiceLoadException ex)
     {
         throw ex;
     }
 }
        public bool deleteInterest(Interest obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    IQueryable<Interest> InterestList = from interest in db.Interests
                                                        where interest.Buying_Agent == obj.Buying_Agent &&
                                                        interest.Selling_Agent == obj.Selling_Agent &&
                                                        interest.Property_ID == obj.Property_ID
                                                        select interest;

                    if ((InterestList.ToArray().Length > 0))
                    {

                        db.Interests.Remove((InterestList.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 Interest selectInterest(Interest obj)
        {
            RealReportContext db = new RealReportContext();

            try
            {
                IQueryable<Interest> InterestList = from interest in db.Interests
                                                    where interest.Buying_Agent == obj.Buying_Agent &&
                                                    interest.Selling_Agent == obj.Selling_Agent &&
                                                    interest.Property_ID == obj.Property_ID
                                                    select interest;

                return (InterestList.ToList())[0];
            }
            catch (Exception ex)
            {
                return null;
            }
        }