예제 #1
0
        public ActionResult ExecuteImportScheme(string templateId, string fileId, int chunks, string ext)
        {
            UserInfo userInfo = LoginUserInfo.Get();
            string   path     = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo);

            if (!string.IsNullOrEmpty(path))
            {
                // 读取导入文件
                string data = DirFileHelper.ReadText(path);
                // 删除临时文件
                DirFileHelper.DeleteFile2(path);
                if (!string.IsNullOrEmpty(data))
                {
                    NWFSchemeModel nWFSchemeModel = data.ToObject <NWFSchemeModel>();
                    // 验证流程编码是否重复
                    NWFSchemeInfoEntity schemeInfoEntityTmp = nWFSchemeIBLL.GetInfoEntityByCode(nWFSchemeModel.info.F_Code);
                    if (schemeInfoEntityTmp != null)
                    {
                        nWFSchemeModel.info.F_Code = Guid.NewGuid().ToString();
                    }
                    nWFSchemeIBLL.SaveEntity("", nWFSchemeModel.info, nWFSchemeModel.scheme, nWFSchemeModel.authList);
                }
                return(Success("导入成功"));
            }
            else
            {
                return(Fail("导入模板失败!"));
            }
        }