Time period control code and segment control code
I got a period of control today, and I always felt a problem. Please give me some advice:
If (request ["Action"] = "PriceLast") {int PriceId = int. parse (request ["PriceId"]); List <Control> PrcList = ccp. modelList ("id = 1 order by id"); string StatData = ""; string EndData = "2099-06-16"; for (int I = 0; I <PrcList. count; I ++) {if (PrcList [I]. id = PriceId) {// if there are items in the current time range, execute the get and remove if (I-1 )! =-1 & (I + 1 )! = PrcList. count) {StatData = PrcList [I-1]. endTime. value. addDays (1 ). toString ("yyyy-MM-dd"); EndData = PrcList [I + 1]. startTime. value. addDays (-1 ). toString ("yyyy-MM-dd");} // if the price is unique, execute else if (I-1) =-1 & (I + 1) = PrcList. count) {// if the current setting time is greater than the current time, the default current time is smaller than the default setting time if (PrcList [I]. startTime> DateTime. now) {StatData = DateTime. now. toString ("yyyy-MM-dd");} else {StatData = PrcList [I]. startT Ime. value. toString ("yyyy-MM-dd") ;}// if the current number is the last one, execute else if (I + 1) = PrcList. count) {StatData = PrcList [I-1]. endTime. value. addDays (1 ). toString ("yyyy-MM-dd");} // else if (I-1 =-1) {StatData = DateTime in the first case of price over multiple time periods. now. toString ("yyyy-MM-dd"); // if there is one of the following, the last if (I + 1 )! = PrcList. count) {EndData = PrcList [I + 1]. startTime. value. addDays (-1 ). toString ("yyyy-MM-dd") ;}}} context. response. write ("{StatData: '" + StatData + "', EndData: '" + EndData + "'}"); context. response. end ();}
Restrict the time range to access the page's JS Code
<Script language = "JavaScript">
<! --
Var d, s;
D = new Date ();
S = d. getDate ();
If (s> 17 | s <15 ){
Alert ("It's work time ...... ");
Window. close ();
}
// -->
</SCRIPT>
No test error.
Please accept it if you are satisfied!
How long does a program implement C language control? The following code is automatically executed after a certain period of time.
Call the subprogram below to determine how long it will take to automatically execute your own code.
/* How many milliseconds of waiting for a subroutine */
// Do not forget the # include <time. h> header file
Void sleep (clock_t wait)
{
Clock_t goal;
Goal = wait + clock ();
While (goal> clock ())
;
}