R
reigh7
Guest
I am programing in C# for a lightswitch project I know the visual basic if/then/else/else if code 1st see code block
Code Block, Link
Namespace LightSwitchApplication
Public Class Lieu
Private Sub LieuTotal_Compute(ByRef result As System.Nullable(Of Decimal))
Dim Total As Decimal
If LieuAdd = True Then
Total = LieuHours
Else
Total = 0
End If
result = Total
Set result to the desired field value
End Sub
End Class
End Namespace
My current age code looks like the second Code block.
Code Block, Link
partial void Age_Compute(ref string result)
{
// Set result to the desired field value
int age = DateTime.Now.Year - BirthDate.Year;
if (BirthDate > DateTime.Now.AddYears(-age)) age--;
string ageLable = " Years";
string ageResult = age.ToString() + ageLable;
result = ageResult;
}
I would appreciate help with more complicated date time math using the C# .Net libraries the following is the question.
How do I add More If, Then, else if , else if , else if date/time math to my Age calculations to accomplish?
==Update age calculation to include those ages that require things defining age that are less than years like those require Months, Days and Hours as defined by the standard age groups for medicine. In medicine the list of those ages is;
Medical Name Category Name Range Description
Unborn "Cord Blood" 0(Zero) Days, Months, or years old or less
Newborn "1 day" 0(Zero) to 1 Days old
Weeks old "2 weeks" 1 day to 2 Weeks old
1 month old "1 Month" 2 Weeks to 1 Month old
Half Year Old "6 Month" 1 Month to 6 Months old
Toddler "1 year" 6 months to 1 year old
Child "10 Year" 1 year to 10 years
Adolescent "9 to 14 year" 9 to 14 Years old
Adult M or F "15 to 64 Year" 15 to 64 years plus "Gender" variable
Geriatric "64 to deceased" 64 years or more and null "DeseasedDate" variable
Deceased "Deceased Date" Age when deseased plus "DeseasedDate" variable;
THEN
==Update AgeGroup calculation to divide those ages into categories based on the range they currently fit into using date/time math for the current year.
Continue reading...
Code Block, Link
Namespace LightSwitchApplication
Public Class Lieu
Private Sub LieuTotal_Compute(ByRef result As System.Nullable(Of Decimal))
Dim Total As Decimal
If LieuAdd = True Then
Total = LieuHours
Else
Total = 0
End If
result = Total
Set result to the desired field value
End Sub
End Class
End Namespace
My current age code looks like the second Code block.
Code Block, Link
partial void Age_Compute(ref string result)
{
// Set result to the desired field value
int age = DateTime.Now.Year - BirthDate.Year;
if (BirthDate > DateTime.Now.AddYears(-age)) age--;
string ageLable = " Years";
string ageResult = age.ToString() + ageLable;
result = ageResult;
}
I would appreciate help with more complicated date time math using the C# .Net libraries the following is the question.
How do I add More If, Then, else if , else if , else if date/time math to my Age calculations to accomplish?
==Update age calculation to include those ages that require things defining age that are less than years like those require Months, Days and Hours as defined by the standard age groups for medicine. In medicine the list of those ages is;
Medical Name Category Name Range Description
Unborn "Cord Blood" 0(Zero) Days, Months, or years old or less
Newborn "1 day" 0(Zero) to 1 Days old
Weeks old "2 weeks" 1 day to 2 Weeks old
1 month old "1 Month" 2 Weeks to 1 Month old
Half Year Old "6 Month" 1 Month to 6 Months old
Toddler "1 year" 6 months to 1 year old
Child "10 Year" 1 year to 10 years
Adolescent "9 to 14 year" 9 to 14 Years old
Adult M or F "15 to 64 Year" 15 to 64 years plus "Gender" variable
Geriatric "64 to deceased" 64 years or more and null "DeseasedDate" variable
Deceased "Deceased Date" Age when deseased plus "DeseasedDate" variable;
THEN
==Update AgeGroup calculation to divide those ages into categories based on the range they currently fit into using date/time math for the current year.
Continue reading...