/// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, CarcheckitemdetailEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #2
0
        /// <summary>
        /// 保存跟随人员及人脸图片
        /// </summary>
        /// <param name="keyValue"></param>
        /// <param name="entity"></param>
        /// <param name="userjson"></param>
        public void SaveFaceUserForm(string keyValue, HazardouscarEntity entity, List <CarUserFileImgEntity> userjson)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();

            try
            {
                string HazardousId = entity.HazardousId;
                Repository <CarcheckitemhazardousEntity> inlogdb = new Repository <CarcheckitemhazardousEntity>(DbFactory.Base());
                CarcheckitemhazardousEntity haza = inlogdb.FindEntity(it => it.HazardousId == HazardousId);

                Repository <CarcheckitemmodelEntity>  modeldb   = new Repository <CarcheckitemmodelEntity>(DbFactory.Base());
                IEnumerable <CarcheckitemmodelEntity> modelList = modeldb.IQueryable(it => it.CID == haza.CID).OrderBy(it => it.Sort);

                List <CarcheckitemdetailEntity> DetailList = new List <CarcheckitemdetailEntity>();
                foreach (CarcheckitemmodelEntity item in modelList)
                {
                    CarcheckitemdetailEntity detail = new CarcheckitemdetailEntity();
                    detail.CheckStatus        = 0;
                    detail.CheckItem          = item.CheckItem;
                    detail.Sort               = item.Sort;
                    detail.CreateUserId       = "System";
                    detail.CreateDate         = DateTime.Now;
                    detail.CreateUserDeptCode = "00";
                    detail.CreateUserOrgCode  = "00";
                    detail.ID  = Guid.NewGuid().ToString();
                    detail.PID = entity.ID;
                    DetailList.Add(detail);
                }
                res.Insert <CarcheckitemdetailEntity>(DetailList);
                //res.Insert<HazardouscarEntity>(entity);
                res.Commit();
                SaveUserFileImgForm(entity, userjson);
            }
            catch (Exception)
            {
                res.Rollback();
            }
        }
 public ActionResult SaveForm(string keyValue, CarcheckitemdetailEntity entity)
 {
     carcheckitemdetailbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }