Exemplo n.º 1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, DetectionRecordEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
        public object GetDetectionEntity([FromBody] JObject json)
        {
            try
            {
                string  res = json.Value <string>("json");
                dynamic dy  = JsonConvert.DeserializeObject <ExpandoObject>(res);
                //获取用户Id
                string userId = dy.userid;
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator curUser = OperatorProvider.Provider.Current();
                if (null == curUser)
                {
                    return(new { code = -1, count = 0, info = "请求失败,请登录!" });
                }
                string id = dy.data.Id;//ID
                DetectionRecordEntity entity = detectionrecordbll.GetEntity(id);
                dynamic obj = new ExpandoObject();
                obj.Id                = entity.Id;
                obj.EquipmentId       = entity.EquipmentId;
                obj.DetectionPerson   = entity.DetectionPerson;
                obj.DetectionDate     = entity.DetectionDate;
                obj.Describe          = entity.Describe;
                obj.Project           = entity.Project;
                obj.Conclusion        = entity.Conclusion;
                obj.DetectionPersonId = entity.DetectionPersonId;
                obj.Remark            = entity.Remark;
                obj.Content           = entity.Content;

                IList <Photo> pList = new List <Photo>(); //附件
                DataTable     file  = fileInfoBLL.GetFiles(entity.Id);
                foreach (DataRow dr in file.Rows)
                {
                    Photo p = new Photo();
                    p.id       = dr["fileid"].ToString();
                    p.filename = dr["filename"].ToString();
                    p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1);
                    pList.Add(p);
                }
                obj.file = pList;

                return(new { Code = 0, Count = 1, Info = "获取数据成功", data = obj });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Count = 0, Info = ex.Message });
            }
        }
Exemplo n.º 3
0
        public object SaveDetectionRecord()
        {
            try
            {
                string  res    = ctx.Request["json"];
                dynamic dy     = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  userId = dy.userid;          //当前用户ID
                OperatorProvider.AppUserId = userId; //设置当前用户
                Operator curUser             = OperatorProvider.Provider.Current();
                string   EquipmentId         = dy.data.EquipmentId;
                string   keyValue            = dy.data.Id;
                string   str                 = JsonConvert.SerializeObject(dy.data);
                DetectionRecordEntity entity = JsonConvert.DeserializeObject <DetectionRecordEntity>(str);

                if (!string.IsNullOrEmpty(keyValue))
                {
                    //获取删除附件ID
                    string deleteFileId = dy.data.deleteFileId;
                    if (!string.IsNullOrEmpty(deleteFileId))
                    {
                        DeleteFile(deleteFileId);
                    }
                }
                else
                {
                    entity.Id = Guid.NewGuid().ToString();
                    keyValue  = entity.Id;
                }
                HttpFileCollection files = ctx.Request.Files; //上传的文件
                                                              //上传设备图片
                UploadifyFile(entity.Id, "DetectionRecord", files);

                detectionrecordbll.SaveForm(keyValue, entity);
            }
            catch (Exception)
            {
                return(new { code = -1, count = 0, info = "保存失败" });
            }

            return(new { code = 0, count = 0, info = "保存成功" });
        }
Exemplo n.º 4
0
 public ActionResult SaveForm(string keyValue, DetectionRecordEntity entity)
 {
     detectionrecordbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }