public ActionResult Create(FormCollection collection)
        {
            var model = new StandardFile();

            TryUpdateModel(model, collection.ToValueProvider());

            if (Request.Files == null || Request.Files.Count == 0)
            {
                FlashFailure("上传文件不存在,请选择上传文件!");
                return View();
            }
            for (var i = 0; i < Request.Files.Count; i++)
            {
                // 检查文件后缀名
                var file = Request.Files[i];
                if (file == null || file.ContentLength <= 0) continue;

                var ext = Path.GetExtension(file.FileName);
                if (string.IsNullOrEmpty(ext) || (!ext.Equals(".doc") && !ext.Equals(".docx")))
                {
                    FlashFailure("文件 '{0}' 后缀名不符合要求 (doc,docx)", file.FileName);
                    return View();
                }
                var uppath = Server.MapPath("~/upload/");
                var key = Request.Params["key"];
                model.SaveFile(file, key, uppath, CurrentAccountNo.GetName());
                model.CreatedBy = CurrentAccountNo;
                model.CreatedAt = DateTime.Now;
                model.State = "";
                model.ApproveState = "";
                if (!SessionHelper.Create(model))
                {
                    FlashFailure("上传失败,请联系管理员!");
                    return Close();
                }
                model.CreateHtml();
            }
            FlashSuccess("上传成功");
            return Close();
        }
 private static bool CanSubmitToInchargeLeader(StandardFile file)
 {
     if (file == null) return false;
     return file.State.Equals(StandardFileStateConst.法规部门负责人审核) && file.ApproveState.Equals(ApproveStateConst.已审核);
 }
 private static bool CanSubmit(StandardFile model)
 {
     return model != null && string.IsNullOrEmpty(model.State);
 }
 private static bool CanPublish(StandardFile file)
 {
     if (file == null) return false;
     return file.State.Equals(StandardFileStateConst.审核完成);
 }
 private static bool CanBack(StandardFile file)
 {
     if (file == null) return false;
     return file.State.Equals(StandardFileStateConst.分管领导审批) && file.ApproveState.Equals(ApproveStateConst.已审核);
 }
 private static bool CanApprove(StandardFile file)
 {
     if (file == null) return false;
     return file.ApproveState.Equals(ApproveStateConst.待审核)
         &&
         (file.State.Equals(StandardFileStateConst.分管领导审批)
             || file.State.Equals(StandardFileStateConst.法规部门负责人审核));
 }