Exemple #1
0
        public bool AcceptOrderVip(OrderVipDTO dto)
        {
            try
            {
                if (new OrderVipDao().Create(new OrderVip()
                {
                    UserID = dto.UserID,
                    PVipID = dto.PVipID,
                    PaymentID = dto.PaymentID,
                    OrdDayCreate = DateTime.Now,
                    OrdPrice = dto.OrdPrice
                }))
                {
                    if (dto.PVipID != null)
                    {
                        var vip = new PackageVipDao().GetById((int)dto.PVipID);
                        new UserDao().SetVipForUser(dto.UserID, vip.PVipMonths);
                    }
                }


                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Exemple #2
0
 public PackageVipDTO GetPackageVipById(int id)
 {
     try
     {
         var data = new PackageVipDao().GetById(id);
         return(new PackageVipDTO()
         {
             ID = data.ID,
             PVipName = data.PVipName,
             PVipPrice = data.PVipPrice,
             PVipMonths = data.PVipMonths
         });
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(null);
     }
 }
Exemple #3
0
        public bool CreatePackageVip(PackageVipDTO packageVip)
        {
            try
            {
                var data = new PackageVipDao().CreatePackageVip(new PackageVip()
                {
                    PVipMonths = packageVip.PVipMonths,
                    PVipName   = packageVip.PVipName,
                    PVipPrice  = packageVip.PVipPrice,
                });

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }