This topic is locked

how can make editing feature open at specific hours

2/16/2023 2:42:58 AM
ASPRunnerPro General questions
M
mr. zx author

Dear All
I want to make the editing feature open at specific hours during the day , For example, from 6 pm to 8 pm .
Thanks

admin 2/16/2023

You can use isRecordEditable event for this purpose:
https://xlinesoft.com/asprunnerpro/docs/isrecordeditable.htm

You can check the current time there and prohibit editing if it is outside of 6pm - 8pm window.

M
mr. zx author 2/16/2023

Thanks Admin for help us
but this feature do for day
f Weekday(Now())==1 or Weekday(Now())==7 then
IsRecordEditable=false
else
IsRecordEditable=true
end if

I need for time if possible

jadachDevClub member 2/16/2023

Try this on the isRecordEditable event

TimeSpan start = new TimeSpan(18, 0, 0); //6pm
TimeSpan end = new TimeSpan(20, 0, 0); //8pm
TimeSpan now = DateTime.Now.TimeOfDay;

if ((now > start) && (now < end))
{
return true;
}
else
{
return false;
}
M
mr. zx author 2/16/2023

Thanks jadach
I will try it

M
mr. zx author 2/17/2023

Sorry jadach the code is not working

jadachDevClub member 2/18/2023

My bad. I gave you C#. I thought you were using ASPRunner.Net.

M
mr. zx author 2/19/2023

Thank you jadach for your sincere help
I really appreciate you