Time period control code and segment control code

Source: Internet
Author: User

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 ())
;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.