Example #1
0
        public ActionResult editSchedule(ATScheduleModel arm)
        {
            ViewBag.Title = WebCMS.Menu.Edit + WebCMS.Menu.Schedule;

            if (!string.IsNullOrEmpty((string)Session["UserID"]))
            {
                if (ModelState.IsValid)
                {
                    string DBMsg = arm.Update((string)Session["UserID"]);
                    if (string.IsNullOrEmpty(DBMsg))
                    {
                        ViewBag.Message = "修改完成…";
                    }
                    else
                    {
                        ViewBag.Message = DBMsg;
                    }
                }
                else
                {
                    ViewBag.Message = "資料不正確…";
                }

                return(View("addSchedule", arm));
            }
            else
            {
                ViewBag.MessageType = "警告";
                ViewBag.Message     = "您無權限使用本功能或長時間未使用已自動登出,請重新登入,如有疑問請洽管理員,謝謝…";
                return(View("Message"));
            }
        }
Example #2
0
        public ActionResult editSchedule(int ATSID)
        {
            ViewBag.Title = WebCMS.Menu.Edit + WebCMS.Menu.Schedule;
            ATScheduleModel arm = ATScheduleModel.GetATSchedule(ATSID);

            return(View("addSchedule", arm));
        }
Example #3
0
        public ActionResult AddSchedule()
        {
            ViewBag.Title = WebCMS.Menu.Add + WebCMS.Menu.Schedule;

            ATScheduleModel arm = new ATScheduleModel()
            {
                ExecuteType  = "d",
                DataType     = "d",
                ExecuteCycle = 1,
                DataCycle    = 1,
                SamplingTime = 1
            };

            return(View(arm));
        }
Example #4
0
        public JsonResult JsonScheduleDelete(int ATSID)
        {
            string s = string.Empty;

            if (!string.IsNullOrEmpty((string)Session["UserID"]))
            {
                string DBMsg = ATScheduleModel.Delete(ATSID);
                if (string.IsNullOrEmpty(DBMsg))
                {
                    s = WebCMS.Menu.Delete + " ok";
                }
                else
                {
                    s = DBMsg;
                }
            }

            return(Json(s));
        }
Example #5
0
        public JsonResult JsonScheduleList(int page, int rp)
        {
            try
            {
                IEnumerable <ATScheduleModel> al = ATScheduleModel.GetScheduleList(Session["UserID"].ToString());

                return(Json(new
                {
                    page = page,
                    total = al.Count(),
                    rows = from c in al.Skip((page - 1) * rp).Take(rp)
                           select c
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    ex.Message
                }));
            }
        }
Example #6
0
 // GET: /Main/AT/
 #region Schedule
 public ActionResult ScheduleList(string output)
 {
     if (!string.IsNullOrEmpty((string)Session["UserID"]))
     {
         if (output != "export")
         {
             ViewBag.bar = "ATSchedule";
             return(View());
         }
         else
         {
             byte[] file = ATScheduleModel.GetScheduleFile(Session["UserID"].ToString());
             return(File(file, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Delayed_Upload_" + DateTime.Now.ToString("yyyy_MM_dd") + ".xlsx"));
         }
     }
     else
     {
         ViewBag.MessageType = "警告";
         ViewBag.Message     = "您無權限使用本功能或長時間未使用已自動登出,請重新登入,如有疑問請洽管理員,謝謝…";
         return(View("Message"));
     }
 }