public ActionResult Edit(ReportModel model, string cdts)
        {
            GetConditions(cdts);

            ModelState.Remove("Name");
            ModelState.Remove("ConfirmationCode");            
            if (!model.IsValid(ModelState))
            {
                return View("Save", model);
            }

            ////檢查內容無障礙是否通過
            if (!AccessibilityUtil.CheckFreeGO(model.Content))
            {
                model.ShowFreeGOMsg = true;
                model.FreeGOColumnName = "Content";
            }            

            model.Update();

            if (model.ShowFreeGOMsg)
            {
                return View("Save", model);
            }

            return RedirectToAction("AdminIndex", new { Page = model.Page, Cdts = cdts });
        }
        public ActionResult ReportFile(string id, string type)
        {
            EntityCounter(id, type);

            ReportModel entityModel = new ReportModel(id);
            switch (type)
            {
                case ("CVister"):
                    return Redirect(entityModel.CAUrl);
                case ("EVister"):
                    return Redirect(entityModel.EAUrl);
                case ("DVister"):
                    return Redirect(entityModel.DAUrl);
            }

            return new EmptyResult();
        }
        public ActionResult Create(ReportModel model, string cdts)
        {
            GetConditions(cdts);

            ModelState.Remove("Name");
            ModelState.Remove("ConfirmationCode");
            if (!model.IsValid(ModelState))
            {
                return View("Save", model);
            }

            ////檢查內容無障礙是否通過
            if (!AccessibilityUtil.CheckFreeGO(model.Content))
            {
                model.ShowFreeGOMsg = true;
                model.FreeGOColumnName = "Content";
            }

            model.Insert();

            if (model.ShowFreeGOMsg)
            {
                return View("Save", model);
            }

            return View("AdminIndex");
        }
        public ActionResult SendOrder(ReportModel model)
        {
            HttpPostedFileBase picFile = null;
            foreach (string file in Request.Files)
            {

                picFile = Request.Files[file] as HttpPostedFileBase;
            }

            ModelState.Remove("Name");
            string captcha = AccountUtil.GetCaptcha();
            if (picFile == null || picFile.ContentLength <= 0)
            {
                ModelState.AddModelError("ReportPic", "請選擇報告書封面圖片");
            }
            else if (picFile.ContentLength > (1024 * 1024))
            {
                ModelState.AddModelError("ReportPic", "請選擇小於 1MB 的報告書封面圖片");
            }
            else if (!IsImage(picFile))
            {
                ModelState.AddModelError("ReportPic", "請上傳圖片格式的報告書封面圖片");
            }
            else if (!captcha.Equals(model.ConfirmationCode, StringComparison.OrdinalIgnoreCase))
            {
                ModelState.AddModelError("ConfirmationCode", "驗證碼錯誤");
            }
            else
            {
                if (picFile.ContentLength > 0)
                {
                    var fileName = Guid.NewGuid().ToString() + Path.GetExtension(picFile.FileName);
                    var path = Path.Combine(AppSettings.CKFinderBaseDir, "webuser/images/", fileName);
                    picFile.SaveAs(path);
                    model.ReportPic = "webuser/images/" + fileName;
                }

                if (model.IsValid(ModelState))
                {
                    model.Status = "0";
                    model.Insert();
                }
            }
            if (model.SendOrderOk)
            {
                ModelState.Clear();
            }
            return View("Provide2", model);
        }
 public ActionResult Detail(string id, string cdts)
 {
     GetConditions(cdts);
     ReportModel entityModel = new ReportModel(id);
     return View(entityModel);
 }