Ejemplo n.º 1
0
 public Wish selectWish(Wish obj)
 {
     try
     {
         IWishSvc svc = (IWishSvc)this.getService(typeof(IWishSvc).Name);
         return svc.selectWish(obj);
     }
     catch (ServiceLoadException ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public Boolean objectDataEquals(Wish obj)
        {
            if (!(this.Wish_ID.Equals(obj.Wish_ID)))
            {
                return false;
            }
            if (!(this.Agent_ID.Equals(obj.Agent_ID)))
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 3
0
        public bool insertWish(Wish obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    db.Wishes.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Ejemplo n.º 4
0
 public Boolean insertWish(Wish obj)
 {
     try
     {
         IWishSvc svc = (IWishSvc)this.getService(typeof(IWishSvc).Name);
         if (obj.isDataEntered())
         {
             return svc.insertWish(obj);
         }
         else
         {
             throw new BusinessValidationException(CustomErrors.REQUIRED_FIELD);
         }
     }
     catch (ServiceLoadException ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
        public bool deleteWish(Wish obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    IQueryable<Wish> WishList = from Wish in db.Wishes
                                                where Wish.Wish_ID == obj.Wish_ID
                                                select Wish;

                    if ((WishList.ToArray().Length > 0))
                    {
                        db.Wishes.Remove((WishList.ToArray())[0]);

                        #region Database Submission

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }

                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Ejemplo n.º 6
0
        public Wish selectWish(Wish obj)
        {
            RealReportContext db = new RealReportContext();

            try
            {
                IQueryable<Wish> WishList = from Wish in db.Wishes
                                            where Wish.Wish_ID == obj.Wish_ID
                                            select Wish;

                return (WishList.ToList())[0];
            }
            catch (Exception ex)
            {
                return null;
            }
        }
Ejemplo n.º 7
0
        public bool updateWish(Wish obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {

                    IQueryable<Wish> WishList = from Wish in db.Wishes
                                                where Wish.Wish_ID == obj.Wish_ID
                                                select Wish;

                    if ((WishList.ToArray()).Length > 0)
                    {
                        foreach (Wish Wish in WishList)
                        {
                            //Modify Attributes
                        }

                        #region Database Submission with Rollback

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }
                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }