Пример #1
0
 public DateTime? GetBillingDate(UserModel.User user)
 {
     try
     {
         var subscriptionID = user.GetSubscriptionID(User.Identity.Name);
         if (subscriptionID != String.Empty)
         {
             Subscription subscription = Gateway.BrainTreeGateway.Subscription.Find(subscriptionID);
             return subscription.NextBillingDate;
         }
         else
         {
             //Fail to retrieve Billing ID
             return default(DateTime);
         }
     }
     catch (Exception ex)
     {
         Logger.WriteErrorLog(ex);
         return default(DateTime);
     }
 }
Пример #2
0
 public ActionResult SaveSubscriptionInfo(UserModel.User user)
 {
     if (ModelState.IsValid)
     {
         if (user.CancelSubscription(User.Identity.Name, user.CancelComments))
         {
             var subscriptionId = user.GetSubscriptionID(User.Identity.Name);
             var result = Gateway.BrainTreeGateway.Subscription.Cancel(subscriptionId);
             //Authentication
             HttpCookie userNameCookie = new HttpCookie("QueueViewUserName");
             DateTime now = DateTime.Now;
             userNameCookie.Value = User.Identity.Name;
             userNameCookie.Expires = now.AddDays(-1D);
             Response.Cookies.Add(userNameCookie);
             FormsAuthentication.SignOut();
         }
         else
         {
             //Fail
             return RedirectToAction("Error", "User");
         }
     }
     return RedirectToAction("CancelSuccess", "Home");
 }
Пример #3
0
 public string GetBillingStatus(UserModel.User user)
 {
     try
     {
         var subscriptionID = user.GetSubscriptionID(User.Identity.Name);
         if (subscriptionID != String.Empty)
         {
             Subscription subscription = Gateway.BrainTreeGateway.Subscription.Find(subscriptionID);
             return subscription.Status.ToString();
         }
         else
         {
             //Fail to retrieve Billing ID
             return string.Empty;
         }
     }
     catch (Exception ex)
     {
         Logger.WriteErrorLog(ex);
         return string.Empty;
     }
 }