Search This Blog

Wednesday, August 24, 2011

Time Comparision using Dialog objects

The following sample code used to do Time values comparison and Time field values comparison using Dialog.

 static void TimeComparisonWithDialog(Args _args)
 {
  TimeofDay fromTime,toTime;

  Dialog dlg = new Dialog("TimeComparision");
  dialogField dlgField,dlgField2;
  TimeofDay fTime,tTime;

   ;
  dlgField = dlg.addFieldValue(typeid(TimeofDay),"","FromTime");
  dlgField2 = dlg.addFieldValue(typeid(TimeofDay),"ToTime","ToTime");

   if(dlg.run())
   {
       fromTime = dlgField.value();
       toTime = dlgField2.value();
    }
//str2Time("") this function is used to convet time into string.   if(fromTime < toTime)
  {
       info("This is the small time");
       info(time2str(fromTime,1,1));
  }
  else if(fromTime > toTime)
  {
       info("From Time should be less than To time ");
       info(time2str(toTime,1,1));
   }
   else

  {
      info("Enter the time");

   }
}

No comments:

Post a Comment

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.