Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        pushtype = HttpUtil.GetReqStrValue("pushtype");
        if (!string.IsNullOrEmpty(pushtype))
        {
            staffid  = HttpUtil.GetReqStrValue("staffid");
            pushtime = HttpUtil.GetReqStrValue("pushtime");
            timetype = HttpUtil.GetReqStrValue("timetype");
            message  = HttpUtil.GetReqStrValue("message");

            valObj          = new APP_PUSHMESSAGE();
            valObj.ADDTIME  = DateTime.Now;
            valObj.PUSHTYPE = Convert.ToInt32(pushtype);
            if (!string.IsNullOrEmpty(staffid))
            {
                valObj.STAFFID = Convert.ToDecimal(staffid);
            }
            valObj.TIMETYPE = Convert.ToInt32(timetype);
            valObj.MESSAGE  = message;
            if (!string.IsNullOrEmpty(pushtime))
            {
                valObj.PUSHTIME = DateTime.ParseExact(pushtime, "yyyy-MM-ddTHH:mm", CultureInfo.CurrentCulture, DateTimeStyles.None);
            }
            BLLTable <APP_PUSHMESSAGE> .Insert(valObj, APP_PUSHMESSAGE.Attribute.ID);

            if (valObj.PUSHTIME != null)
            {
                TimeSpan            ts1     = new TimeSpan(valObj.PUSHTIME.Ticks);
                TimeSpan            ts2     = new TimeSpan(DateTime.Now.Ticks);
                TimeSpan            ts      = ts1.Subtract(ts2).Duration();
                System.Timers.Timer myTimer = new System.Timers.Timer(ts.TotalMilliseconds);
                myTimer.Elapsed  += new System.Timers.ElapsedEventHandler(OnTimedEvent);
                myTimer.AutoReset = false;
                myTimer.Enabled   = true;
                myTimer.Start();
            }
            else
            {
                sendByTime();
            }
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        pushtype = HttpUtil.GetReqStrValue("pushtype");
        if (!string.IsNullOrEmpty(pushtype))
        {
            staffid = HttpUtil.GetReqStrValue("staffid");
            pushtime = HttpUtil.GetReqStrValue("pushtime");
            timetype = HttpUtil.GetReqStrValue("timetype");
            message = HttpUtil.GetReqStrValue("message");

            valObj = new APP_PUSHMESSAGE();
            valObj.ADDTIME = DateTime.Now;
            valObj.PUSHTYPE = Convert.ToInt32(pushtype);
            if(!string.IsNullOrEmpty(staffid)){
                valObj.STAFFID = Convert.ToDecimal(staffid);
            }
            valObj.TIMETYPE = Convert.ToInt32(timetype);
            valObj.MESSAGE = message;
            if(!string.IsNullOrEmpty(pushtime)){
                valObj.PUSHTIME = DateTime.ParseExact(pushtime, "yyyy-MM-ddTHH:mm", CultureInfo.CurrentCulture, DateTimeStyles.None);
            }
            BLLTable<APP_PUSHMESSAGE>.Insert(valObj, APP_PUSHMESSAGE.Attribute.ID);
            if (valObj.PUSHTIME != null)
            {
                TimeSpan ts1 = new TimeSpan(valObj.PUSHTIME.Ticks);
                TimeSpan ts2 = new TimeSpan(DateTime.Now.Ticks);
                TimeSpan ts = ts1.Subtract(ts2).Duration();
                System.Timers.Timer myTimer = new System.Timers.Timer(ts.TotalMilliseconds);
                myTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);
                myTimer.AutoReset = false;
                myTimer.Enabled = true;
                myTimer.Start();
            }
            else {
                sendByTime();
            }
        }
    }