Created
July 12, 2019 20:17
-
-
Save ornerymoose/a4902789f20fe69b3335683eb372d0b3 to your computer and use it in GitHub Desktop.
the below works but isn't very clean.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initalize resi_vid/hsd/voice and comm_vid/hsd_voice to 0... | |
// result.summary.products is List<ImpactProduct> Summary.products | |
foreach (var r in result.summary.products) | |
{ | |
if (r.customer_class == "Residential" && r.name == "Video") | |
{ | |
resi_vid = r.customer_count; | |
} | |
if (r.customer_class == "Residential" && r.name == "HSD") | |
{ | |
resi_hsd = r.customer_count; | |
} | |
if (r.customer_class == "Residential" && r.name == "Voice") | |
{ | |
resi_voice = r.customer_count; | |
} | |
if (r.customer_class == "Commercial" && r.name == "SMB Video") | |
{ | |
comm_vid = r.customer_count; | |
} | |
if (r.customer_class == "Commercial" && r.name == "SMB HSD") | |
{ | |
comm_hsd = r.customer_count; | |
} | |
if (r.customer_class == "Commercial" && r.name == "SMB Voice") | |
{ | |
comm_voice = r.customer_count; | |
} | |
} | |
var subscriberCounts = new SubscriberCountModel | |
{ | |
Residential = { | |
Video = resi_vid, | |
Internet = resi_hsd, | |
Voice = resi_voice | |
}, | |
Commercial = { | |
Video = comm_vid, | |
Internet = comm_hsd, | |
Voice = comm_voice | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImpactProduct | |
{ | |
public string name { get; set; } | |
public string customer_class { get; set; } | |
public int customer_count { get; set; } | |
} | |
public class Summary | |
{ | |
public List<ImpactProduct> products { get; set; } | |
} | |
public class RootObject | |
{ | |
public Summary summary { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"summary": { | |
"products": [ | |
{ | |
"name": "Video", | |
"customer_class": "Commercial", | |
"customer_count": 500, | |
}, | |
{ | |
"name": "HSD", | |
"customer_class": "Residential", | |
"customer_count": 1200, | |
}, | |
{ | |
"name": "Voice", | |
"customer_class": "Residential", | |
"customer_count": 1900, | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment