コード例 #1
0
        public ActionResult SaveConstractTemplateDtl(ConstractTemplateDtl dtl, int isInsert)
        {
            dtl.InDateTime = DateTime.Now;
            dtl.InUserId   = UserInfo.UserId;
            if (dtl.ContentType == "图片")
            {
                if (Request.Files != null && Request.Files.Count > 0)
                {
                    HttpPostedFileBase fileBase = Request.Files.Get(0);
                    if (fileBase.ContentLength > 0)
                    {
                        string fileName = SaveFile(fileBase, dtl.ConstractTemplateId + "_" + dtl.SeqNO);
                        dtl.TemplateContent = fileName;
                    }
                }
            }
            if (isInsert == 1)
            {
                service.ConstractTemplateDtlInsert(dtl);
            }
            else
            {
                service.ConstractTemplateDtlSave(dtl);
            }

            return(RedirectToAction("Edit/" + dtl.ConstractTemplateId));
        }