Esempio n. 1
0
        public object SaveProtocol([FromBody] JObject json)
        {
            try
            {
                string  res = json.Value <string>("json");
                dynamic dy  = JsonConvert.DeserializeObject <ExpandoObject>(res);

                var o1 = JsonConvert.DeserializeAnonymousType(res, new
                {
                    keyValue = string.Empty,
                    data     = string.Empty,
                    file     = string.Empty
                });
                var o = JsonConvert.DeserializeObject <ProtocolEntity>(dy.data);
                o.CREATEDATE = DateTime.Now;
                o.ID         = dy.keyValue;

                //string str = JsonConvert.SerializeObject(dy.file);
                //IList<FileInfoEntity> filelist = JsonConvert.DeserializeObject<IList<FileInfoEntity>>(o1.file);
                ProtocolBLL ProtocolBLL = new ProtocolBLL();
                ProtocolBLL.SaveForm(dy.keyValue, o);
                FileInfoBLL FileInfoBLL = new FileInfoBLL();
                JArray      jlist       = JArray.Parse(dy.file);
                foreach (var item in jlist)
                {
                    var file = new FileInfoEntity();
                    file.RecId          = dy.keyValue;
                    file.FileName       = JObject.Parse(item.ToString())["FileName"].ToString();
                    file.FilePath       = JObject.Parse(item.ToString())["FilePath"].ToString();
                    file.FileType       = JObject.Parse(item.ToString())["FileType"].ToString();
                    file.FileSize       = JObject.Parse(item.ToString())["FileSize"].ToString();
                    file.FileExtensions = JObject.Parse(item.ToString())["FileExtensions"].ToString();
                    FileInfoBLL.SaveForm("", file);
                }
                return(new { Code = 0, Count = 1, Info = "保存成功" });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Count = 0, Info = ex.Message });
            }
        }
Esempio n. 2
0
 public ActionResult SaveForm(string keyValue, ProtocolEntity entity)
 {
     protocolbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }