/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ExpirationPeriod != null) { hashCode = hashCode * 59 + ExpirationPeriod.GetHashCode(); } if (RecurringPaymentSequenceIndicator != null) { hashCode = hashCode * 59 + RecurringPaymentSequenceIndicator.GetHashCode(); } if (RequiresApproval != null) { hashCode = hashCode * 59 + RequiresApproval.GetHashCode(); } if (Token != null) { hashCode = hashCode * 59 + Token.GetHashCode(); } if (Tokenize != null) { hashCode = hashCode * 59 + Tokenize.GetHashCode(); } return(hashCode); } }
public JsonResult AddExpirationPeriod(ExpirationPeriodViewModel expirationPeriod) { try { var expirationPeriodList = db.ExpirationPeriod.ToList(); if (ModelState.IsValid) { if (expirationPeriod.ExpirationPeriodName == null) { return(Json(expirationPeriodList)); } var expirationPeriodModel = new ExpirationPeriod(); expirationPeriodModel.ExpirationPeriodName = expirationPeriod.ExpirationPeriodName; expirationPeriodModel.ExpirationPeriodValue = expirationPeriod.ExpirationPeriodValue; expirationPeriodModel.Status = true; expirationPeriodModel.UserName = WebSecurity.CurrentUserName; expirationPeriodModel.ModifiedDate = DateTime.Now; UpdateModel(expirationPeriodModel); db.ExpirationPeriod.Add(expirationPeriodModel); db.Entry(expirationPeriodModel).State = System.Data.Entity.EntityState.Added; db.SaveChanges(); expirationPeriodList.Add(expirationPeriodModel); } return(Json(expirationPeriodList)); } catch (Exception ex) { logger.Log(LogLevel.Error, "Exception occurred in Settings -> AddExpirationPeriod: " + ex.Message); throw; } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ExpirationPeriod != null) { hashCode = hashCode * 59 + ExpirationPeriod.GetHashCode(); } if (IssuerId != null) { hashCode = hashCode * 59 + IssuerId.GetHashCode(); } return(hashCode); } }
public void RunExpiration() { long num = 0L; checked { switch (ExpirationType) { case ExpirationType.TIMING: num = unchecked ((long)ExpirationTime) - (long)Math.Round(DateAndTime.Now.Subtract(LastLoginTime).TotalMilliseconds / 1000.0); break; case ExpirationType.PERIOD: num = (long)Math.Round(ExpirationPeriod.Subtract(DateAndTime.Now).TotalMilliseconds / 1000.0); break; } if (num <= 0) { ExpirationService.GetInstance().Remove(_accountId); GameService.KickAccountFromGameServer(_accountId); return; } switch (num) { case 1L: case 2L: case 3L: case 4L: case 5L: case 15L: case 30L: case 60L: case 300L: case 600L: case 900L: case 1800L: GameService.SendExpiration(_accountId, num); break; } } }
/// <summary> /// Returns true if AbstractRedirectPaymentMethodSpecificInput instances are equal /// </summary> /// <param name="other">Instance of AbstractRedirectPaymentMethodSpecificInput to be compared</param> /// <returns>Boolean</returns> public bool Equals(AbstractRedirectPaymentMethodSpecificInput other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ExpirationPeriod == other.ExpirationPeriod || ExpirationPeriod != null && ExpirationPeriod.Equals(other.ExpirationPeriod) ) && ( RecurringPaymentSequenceIndicator == other.RecurringPaymentSequenceIndicator || RecurringPaymentSequenceIndicator != null && RecurringPaymentSequenceIndicator.Equals(other.RecurringPaymentSequenceIndicator) ) && ( RequiresApproval == other.RequiresApproval || RequiresApproval != null && RequiresApproval.Equals(other.RequiresApproval) ) && ( Token == other.Token || Token != null && Token.Equals(other.Token) ) && ( Tokenize == other.Tokenize || Tokenize != null && Tokenize.Equals(other.Tokenize) )); }
public JsonResult UpdateExpirationPeriod(ExpirationPeriodViewModel expirationPeriod) { try { var expirationPeriodDetails = new ExpirationPeriodViewModel(); var expirationPeriodList = db.ExpirationPeriod.ToList(); var ExpirationPeriodToUpdate = new ExpirationPeriod(); if (expirationPeriod == null || !ModelState.IsValid) { return(Json(expirationPeriodList)); } ExpirationPeriodToUpdate = db.ExpirationPeriod.Find(expirationPeriod.ExpirationPeriodId); if (ExpirationPeriodToUpdate == null) { return(Json(expirationPeriodList)); } ExpirationPeriodToUpdate.ExpirationPeriodName = expirationPeriod.ExpirationPeriodName; ExpirationPeriodToUpdate.ExpirationPeriodValue = expirationPeriod.ExpirationPeriodValue; ExpirationPeriodToUpdate.UserName = WebSecurity.CurrentUserName; ExpirationPeriodToUpdate.ModifiedDate = DateTime.Now; if (TryUpdateModel(ExpirationPeriodToUpdate, "ExpirationPeriodName,ExpirationPeriodValue")) { db.Entry(ExpirationPeriodToUpdate).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); expirationPeriodList = db.ExpirationPeriod.ToList(); } return(Json(expirationPeriodDetails)); } catch (Exception ex) { logger.Log(LogLevel.Error, "Exception occurred in Settings -> UpdateExpirationPeriod[HTTPGET]: " + ex.Message); throw; } }
/// <summary> /// Returns true if RedirectPaymentProduct809SpecificInput instances are equal /// </summary> /// <param name="other">Instance of RedirectPaymentProduct809SpecificInput to be compared</param> /// <returns>Boolean</returns> public bool Equals(RedirectPaymentProduct809SpecificInput other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ExpirationPeriod == other.ExpirationPeriod || ExpirationPeriod != null && ExpirationPeriod.Equals(other.ExpirationPeriod) ) && ( IssuerId == other.IssuerId || IssuerId != null && IssuerId.Equals(other.IssuerId) )); }
public static string GenerateTestToken( LicenseType licenseType, String productId, UserLimit userLimit, ExpirationPeriod expirationDays, String purchaserId) { //Note that the AssetId matches that of the Cheezburgers app on the marketplace. //This is just for TEST purposes so that the storefront URL takes you to a valid app page string hardCodedBaseToken = "<r v=\"0\"><t aid=\"WA103524926\" did=\"{3F47392A-2308-4FC6-BF24-740626612B26}\" ad=\"2012-06-19T21:48:56Z\" te=\"2112-07-15T23:47:42Z\" sd=\"2012-02-01\" test=\"true\"/><d>449JFz+my0wNoCm0/h+Ci9DsF/W0Q8rqEBqjpe44KkY=</d></r>"; string userLimitString = string.Empty; switch (userLimit) { case UserLimit.Ten: userLimitString = "10"; break; case UserLimit.Twenty: userLimitString = "20"; break; case UserLimit.Unlimited: userLimitString = "Unlimited"; break; } int expirationDaysNumber = 0; switch (expirationDays) { case ExpirationPeriod.Month: expirationDaysNumber = 30; break; case ExpirationPeriod.Unlimited: expirationDaysNumber = 9999; break; default: expirationDaysNumber = -1; break; } string tokenXml = hardCodedBaseToken; tokenXml = AddAttributesToToken(tokenXml, "pid", productId); tokenXml = AddAttributesToToken(tokenXml, "et", UppercaseFirst(licenseType.ToString())); tokenXml = AddAttributesToToken(tokenXml, "cid", purchaserId); //Set user limit if (licenseType == LicenseType.Free) { tokenXml = AddAttributesToToken(tokenXml, "ts", "0"); } else { tokenXml = AddAttributesToToken(tokenXml, "ts", userLimitString); } //Set site license == unlimited users if (userLimitString == "Unlimited") { tokenXml = AddAttributesToToken(tokenXml, "sl", "true"); } else { tokenXml = AddAttributesToToken(tokenXml, "sl", "false"); } //Set expiration (only supported for Trials) if (licenseType == LicenseType.Trial) { DateTime expirationDate; if (expirationDaysNumber == -1) { //expired token expirationDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(10)); } else if (expirationDaysNumber == 9999) { //Unlimited trial expirationDate = DateTime.MaxValue; } else { //today + the selected number of days expirationDate = DateTime.UtcNow.AddDays(expirationDaysNumber); } tokenXml = AddAttributesToToken(tokenXml, "ed", expirationDate.ToString("o")); } return(tokenXml); }
public static string GenerateTestToken( LicenseType licenseType, String productId, UserLimit userLimit, ExpirationPeriod expirationDays, String purchaserId) { //Note that the AssetId matches that of the Cheezburgers app on the marketplace. //This is just for TEST purposes so that the storefront URL takes you to a valid app page string hardCodedBaseToken = "<r v=\"0\"><t aid=\"WA103524926\" did=\"{3F47392A-2308-4FC6-BF24-740626612B26}\" ad=\"2012-06-19T21:48:56Z\" te=\"2112-07-15T23:47:42Z\" sd=\"2012-02-01\" test=\"true\"/><d>449JFz+my0wNoCm0/h+Ci9DsF/W0Q8rqEBqjpe44KkY=</d></r>"; string userLimitString = string.Empty; switch (userLimit){ case UserLimit.Ten: userLimitString = "10"; break; case UserLimit.Twenty: userLimitString = "20"; break; case UserLimit.Unlimited: userLimitString = "Unlimited"; break; } int expirationDaysNumber = 0; switch (expirationDays) { case ExpirationPeriod.Month: expirationDaysNumber = 30; break; case ExpirationPeriod.Unlimited: expirationDaysNumber = 9999; break; default: expirationDaysNumber = -1; break; } string tokenXml = hardCodedBaseToken; tokenXml = AddAttributesToToken(tokenXml, "pid", productId); tokenXml = AddAttributesToToken(tokenXml, "et", UppercaseFirst(licenseType.ToString())); tokenXml = AddAttributesToToken(tokenXml, "cid", purchaserId); //Set user limit if (licenseType == LicenseType.Free) { tokenXml = AddAttributesToToken(tokenXml, "ts", "0"); } else { tokenXml = AddAttributesToToken(tokenXml, "ts", userLimitString); } //Set site license == unlimited users if (userLimitString == "Unlimited") { tokenXml = AddAttributesToToken(tokenXml, "sl", "true"); } else { tokenXml = AddAttributesToToken(tokenXml, "sl", "false"); } //Set expiration (only supported for Trials) if (licenseType == LicenseType.Trial) { DateTime expirationDate; if (expirationDaysNumber == -1) { //expired token expirationDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(10)); } else if (expirationDaysNumber == 9999) { //Unlimited trial expirationDate = DateTime.MaxValue; } else { //today + the selected number of days expirationDate = DateTime.UtcNow.AddDays(expirationDaysNumber); } tokenXml = AddAttributesToToken(tokenXml, "ed", expirationDate.ToString("o")); } return tokenXml; }