private Rate(Datamodel.StruckRate sr) { rateId = sr.rate; struckId = sr.id; rank = sr.rank; Datamodel.Rate r = null; if (!Datamodel.Rate.FetchById(ref r, rateId)) { throw new ArgumentException( "Struck rate does not have a valid rate id"); } name = r.name; abbrev = r.abrv; earnedDate = DateTimeOffset.FromUnixTimeSeconds(sr.earnedDate).DateTime; if (sr.expirationDate != -1) { hasExpirationDate = true; expirationDate = DateTimeOffset.FromUnixTimeSeconds( sr.expirationDate).DateTime; } else { hasExpirationDate = false; } }
private Rate(Datamodel.Rate r) { rateId = r.id; struckId = -1; name = r.name; abbrev = r.abrv; rank = 3; hasExpirationDate = false; }
/// <summary> /// Gets a rate by the ID of that rate /// </summary> /// <param name="id"></param> /// <returns></returns> public static Rate FetchByRateId(int id) { Datamodel.Rate r = null; if (Datamodel.Rate.FetchById(ref r, id)) { return(new Rate(r)); } else { return(null); } }
private OperationRole(Datamodel.OperationRole r) { id = r.id; name = r.name; rateId = r.rate; Datamodel.Rate rate = null; if (!Datamodel.Rate.FetchById(ref rate, rateId)) { throw new ArgumentException("Role does not have valid rate"); } rateAbbrev = rate.abrv; channelCdr = r.channelCdr; }