Created
April 17, 2012 21:02
-
-
Save codewithcats/2409032 to your computer and use it in GitHub Desktop.
Calculate Unit Per Day
This file contains hidden or 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 int calUnit() | |
{ | |
decimal result = Convert.ToDecimal((Power / 1000.00) * Duration); | |
string[] str; | |
int font; | |
if (result.ToString().Contains('.')) | |
{ | |
str = result.ToString().Split('.'); | |
font = Convert.ToInt32(str[0]); | |
if (Convert.ToInt32(str[1]) > 0) | |
{ | |
font += 1; | |
} | |
} | |
else | |
{ | |
font = Convert.ToInt32(result); | |
} | |
return font; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment