public override string ToString() { JSONObject jSONObject = new JSONObject(); jSONObject.AddField("DataFormatVersion", (int)this.DataFormatVersion); jSONObject.AddField("Registered", this.Registered); jSONObject.AddField("CustomerID", this.CustomerId); jSONObject.AddField("MembershipType", (int)this.MembershipType); jSONObject.AddField("MembershipName", (this.MembershipName != null ? this.MembershipName.Replace("\0", string.Empty) : "null")); jSONObject.AddField("GraceDays", this.GraceDays); jSONObject.AddField("NewUnit", this.NewUnit); jSONObject.AddField("UnitType", (this.UnitType != null ? this.UnitType.Replace("\0", string.Empty) : "null")); jSONObject.AddField("QuickAccessCode", (this.QuickAccessCode != null ? this.QuickAccessCode.Replace("\0", string.Empty) : "null")); jSONObject.AddField("MemberFirstName", (this.MemberFirstName != null ? this.MemberFirstName.Replace("\0", string.Empty) : "null")); jSONObject.AddField("MemberLastName", (this.MemberLastName != null ? this.MemberLastName.Replace("\0", string.Empty) : "null")); jSONObject.AddField("MemberPhone", (this.MemberPhone != null ? this.MemberPhone.Replace("\0", string.Empty) : "null")); jSONObject.AddField("NewSystemGraceDays", this.NewSystemGraceDays); jSONObject.AddField("ESNVerificationCode", (this.EsnVerificationCode != null ? this.EsnVerificationCode.Replace("\0", string.Empty) : "null")); jSONObject.AddField("TotalShotsTaken", this.TotalShotsTaken); jSONObject.AddField("TotalShotsTakenLastUpdatedDate", this.TotalShotsTakenLastUpdatedDate.ToString("G")); jSONObject.AddField("FirstUseDate", this.FirstUseDate.ToString("G")); jSONObject.AddField("MembershipPackDate", this.MembershipPackDate.ToString("G")); jSONObject.AddField("MembershipExpireDate", this.MembershipExpireDate.ToString("G")); jSONObject.AddField("InitialRegistrationDate", this.InitialRegistrationDate.ToString("G")); jSONObject.AddField("DeviceStatusFlag", (int)this.DeviceStatusFlag); for (int i = 0; i < Enum.GetValues(typeof(STSWMMSFeatureFlagType)).Length; i++) { STSWMMSFeatureFlagType sTSWMMSFeatureFlagType = (STSWMMSFeatureFlagType)i; bool flagValue = this.GetFlagValue(sTSWMMSFeatureFlagType); jSONObject.AddField(sTSWMMSFeatureFlagType.ToString(), flagValue); } return(jSONObject.ToString()); }
public void SetBitArray(BitArray arr) { for (int i = 0; i < 256; i++) { STSWMMSFeatureFlagType sTSWMMSFeatureFlagType = (STSWMMSFeatureFlagType)i; this.GetType().GetField(sTSWMMSFeatureFlagType.ToString()).SetValue(this, arr[i]); } }
public BitArray GetBitArray() { BitArray bitArrays = new BitArray(256, false); for (int i = 0; i < 256; i++) { STSWMMSFeatureFlagType sTSWMMSFeatureFlagType = (STSWMMSFeatureFlagType)i; FieldInfo field = this.GetType().GetField(sTSWMMSFeatureFlagType.ToString()); bitArrays[i] = (bool)this.GetType().InvokeMember(field.Name, BindingFlags.GetField, null, this, null); } return(bitArrays); }