コード例 #1
0
ファイル: UsersController.cs プロジェクト: RhindSlater/2B
        public ActionResult Subscription()
        {
            checkCookie();
            CheckUserID();
            int  id   = Convert.ToInt32(Session["UserID"].ToString());
            User user = db.Users.Include("UserLevel").Where(x => x.ID == id).FirstOrDefault();

            Models.AccountType acc = db.AccountTypes.Find(3);
            user.UserLevel          = acc;
            Session["AccountLevel"] = user.UserLevel.ID.ToString();
            PremiumBilling pb = new PremiumBilling()
            {
                Amount          = 11.99,
                Date            = DateTime.Now,
                Member          = user,
                NextBillingDate = DateTime.Now.AddMonths(1)
            };
            Notification notify = new Notification()
            {
                Date       = DateTime.Now,
                Title      = "Subscription",
                Message    = "Congrats, you're now a premium member here at 2B.",
                Seen       = false,
                NotifyUser = user,
            };

            user.DisplayPicture = "premium.png";
            Session["UserPic"]  = user.DisplayPicture;
            db.PremiumBilling.Add(pb);
            db.Notifications.Add(notify);
            db.SaveChanges();
            return(RedirectToAction("Premium"));
        }
コード例 #2
0
 private void btnProceedToCreateAccount_Click(object sender, EventArgs e)
 {
     if (user == null)
     {
         API.Message("Select a User and Try Again", MessageBoxIcon.Warning);
     }
     else
     {
         if (cboAccountType.Text.Trim().Equals(String.Empty))
         {
             API.Message("Please Select Type Of Account", MessageBoxIcon.Warning);
         }
         else
         {
             Models.AccountType type = new Models.AccountType {
                 Name = cboAccountType.Text, Type = cboAccountType.SelectedIndex
             };
             if (user.Id != null && type != null)
             {
                 if (type.Type == 0)
                 {
                     CreateAccount createAccount = new CreateAccount(user, type);
                     createAccount.ShowDialog();
                 }
                 else if (type.Type == 1)
                 {
                     FixedDepositAccount createAccount = new FixedDepositAccount(user, type);
                     createAccount.ShowDialog();
                 }
             }
             else
             {
                 API.Message("Failed to proceed Try Again", MessageBoxIcon.Warning);
             }
         }
     }
 }