public class DTPropertyLine extends common
{
/// <summary>
///
/// </summary>
/// <param name = "_fieldId"></param>
public void modifiedField(FieldId _fieldId)
{
super(_fieldId);
switch (_fieldId)
{
case fieldNum(DTPropertyLine, DTHijriDate):
this.DTCalenderStartDate = DTHijri2date::hijri2GrDate(this.DTHijriDate);
break;
case fieldNum(DTPropertyLine, DTHijriExpiryDate):
this.DTCalenderExpireDate = DTHijri2date::hijri2GrDate(this.DTHijriExpiryDate);
break;
}
}
/// <summary>
///
/// </summary>
/// <param name = "_fieldIdToCheck"></param>
/// <returns></returns>
public boolean validateField(FieldId _fieldIdToCheck)
{
boolean ret;
ret = super(_fieldIdToCheck);
if (ret)
{
switch (_fieldIdToCheck)
{
case fieldnum(DTPropertyLine,DTCalenderExpireDate):
if (this.DTCalenderExpireDate <= this.DTCalenderStartDate)
ret = checkFailed("Calender Start Date must no be greater than Calender Expire Date.");
}
}
return ret;
}
}
[Control("String")]
class DTPropertyLine_DTHijriDate
{
/// <summary>
///
/// </summary>
/// <returns></returns>
public boolean modified()
{
boolean ret;
DTHijriDate hijriDateStr;
ret = super();
hijriDateStr = this.text();
DTPropertyLine.DTCalenderStartDate = DTHijri2date::hijri2GrDate(hijriDateStr);
return ret;
}
}
public void modifiedField(FieldId _fieldId)
{
switch (_fieldId)
{
case fieldNum(DTPropertyLine, DTHijriDate):
this.DTCalenderStartDate = DTHijri2date::hijri2GrDate(this.DTHijriDate);
break;
}
}
final class DTHijri2date
{
static date hijri2GrDate(DTHijriDate hijriDateStr)
{
System.Globalization.CultureInfo arCul = new System.Globalization.CultureInfo("ar-SA");
System.Globalization.CultureInfo enCul = new System.Globalization.CultureInfo("en-US");
System.DateTime tempDateTime;
str strTemp;
System.String[] arr;
date grDate;
;
//all expected dates formats
arr = new System.String[18]();
arr.SetValue("dd/MM/yyyy", 1);
arr.SetValue("dd-MM-yyyy", 2);
try
{
tempDateTime = System.DateTime::ParseExact(hijriDateStr, arr, arCul, System.Globalization.DateTimeStyles::AllowWhiteSpaces);
}
catch
{
error("Unexpected Hirji date format.");
return datenull();
}
strTemp = tempDateTime.ToString("dd/MM/yyyy");
grDate = str2date(strTemp, 123);
return grDate;
}
}
[Control("String")]
class DTPropertyLine_DTHijriDate
{
/// <summary>
///
/// </summary>
/// <returns></returns>
public boolean modified()
{
boolean ret;
DTHijriDate hijriDateStr;
ret = super();
DTPropertyLine.DTCalenderStartDate = DTHijri2date::hijri2GrDate(hijriDateStr);
return ret;
}
}
[Control("String")]
class DTPropertyLine_DTHijriDate
{
/// <summary>
///
/// </summary>
/// <returns></returns>
public boolean modified()
{
boolean ret;
DTHijriDate hijriDateStr;
ret = super();
DTPropertyLine.DTCalenderStartDate = this.hijri2GrDate(hijriDateStr);
return ret;
}
/// <summary>
///
/// </summary>
//private void FormControlMethod1()
//{
private date hijri2GrDate(DTHijriDate hijriDateStr)
{
System.Globalization.CultureInfo arCul = new System.Globalization.CultureInfo("ar-SA");
System.Globalization.CultureInfo enCul = new System.Globalization.CultureInfo("en-US");
System.DateTime tempDateTime;
str strTemp;
System.String[] arr;
date grDate;
;
//all expected dates formats
arr = new System.String[18]();
arr.SetValue("dd/MM/yyyy", 1);
arr.SetValue("dd-MM-yyyy", 2);
try
{
tempDateTime = System.DateTime::ParseExact(hijriDateStr, arr, arCul, System.Globalization.DateTimeStyles::AllowWhiteSpaces);
}
catch
{
error("Unexpected Hirji date format.");
return datenull();
}
strTemp = tempDateTime.ToString("dd/MM/yyyy");
grDate = str2date(strTemp, 123);
return grDate;
}
//}
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156