Exemplo n.º 1
0
        /// <summary>
        /// 保存随行人员信息
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="roleEntity">角色实体</param>
        /// <returns></returns>
        public void SaveUserFileImgForm(VisitcarEntity entity)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();

            try
            {
                List <CarUserFileImgEntity> list = new List <CarUserFileImgEntity>();
                for (int i = 0; i < entity.AccompanyingPerson.Split(',').Length; i++)
                {
                    CarUserFileImgEntity uentity = new CarUserFileImgEntity();
                    if (!string.IsNullOrEmpty(entity.AccompanyingPerson))
                    {//跟随人员
                        uentity.Create();
                        uentity.Username   = entity.AccompanyingPerson.Split(',')[i];
                        uentity.Baseid     = entity.ID;
                        uentity.ID         = Guid.NewGuid().ToString();
                        uentity.CreateDate = DateTime.Now;
                        uentity.OrderNum   = i;
                        list.Add(uentity);
                    }
                }
                res.Insert <CarUserFileImgEntity>(list);
                res.Insert(entity);
                res.Commit();
                UploadUserHiK(entity, list);//人员同步到海康平台
            }
            catch (Exception)
            {
                res.Rollback();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存跟随人员及人脸图片(申请人手机)
        /// </summary>
        /// <param name="keyValue"></param>
        /// <param name="entity"></param>
        /// <param name="userjson"></param>
        public void SaveFaceUserForm(string keyValue, VisitcarEntity entity, List <CarUserFileImgEntity> userjson)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();

            try
            {
                List <CarUserFileImgEntity>      list      = new List <CarUserFileImgEntity>();
                List <UserCarFileMultipleEntity> FileItems = new List <UserCarFileMultipleEntity>();
                for (int i = 0; i < userjson.Count; i++)
                {
                    CarUserFileImgEntity uentity = new CarUserFileImgEntity();
                    if (!string.IsNullOrEmpty(entity.Dirver))
                    {//跟随人员
                        uentity.Create();
                        uentity.Username          = userjson[i].Username;
                        uentity.Userimg           = userjson[i].Userimg;
                        uentity.Imgdata           = userjson[i].Imgdata;
                        uentity.Baseid            = entity.ID;
                        uentity.ID                = Guid.NewGuid().ToString();
                        uentity.CreateDate        = DateTime.Now;
                        uentity.OrderNum          = i;
                        entity.AccompanyingPerson = entity.AccompanyingPerson + userjson[i].Username + ",";
                        list.Add(uentity);
                        if (userjson[i].FileItems != null && userjson[i].FileItems.Count > 0)
                        {
                            for (int j = 0; j < userjson[i].FileItems.Count; j++)
                            {
                                userjson[i].FileItems[j].Create();
                                userjson[i].FileItems[j].ID            = Guid.NewGuid().ToString();
                                userjson[i].FileItems[j].BaseId        = entity.ID;
                                userjson[i].FileItems[j].UserCarFileId = uentity.ID;
                                userjson[i].FileItems[j].CreateDate    = DateTime.Now;
                            }
                            FileItems.AddRange(userjson[i].FileItems);
                        }
                    }
                }
                entity.AccompanyingNumber = userjson.Count;
                entity.AccompanyingPerson = entity.AccompanyingPerson.TrimEnd(',');
                res.Insert <UserCarFileMultipleEntity>(FileItems);
                res.Insert <CarUserFileImgEntity>(list);
                res.Insert(entity);
                res.Commit();
                UploadUserHiK(entity, list);//人员同步到海康平台
            }
            catch (Exception)
            {
                res.Rollback();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 保存随行人员信息
        /// </summary>
        /// <param name="entity">主记录</param>
        /// <param name="userjson">随行人员集合</param>
        public void SaveUserFileImgForm(HazardouscarEntity entity, List <CarUserFileImgEntity> userjson)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();

            try
            {
                List <CarUserFileImgEntity> list = new List <CarUserFileImgEntity>();
                for (int i = 0; i < userjson.Count; i++)
                {
                    CarUserFileImgEntity uentity = new CarUserFileImgEntity();
                    if (!string.IsNullOrEmpty(entity.Dirver))
                    {//跟随人员
                        uentity.Create();
                        uentity.Username          = userjson[i].Username;
                        uentity.Userimg           = userjson[i].Userimg;
                        uentity.Imgdata           = userjson[i].Imgdata;
                        uentity.Baseid            = entity.ID;
                        uentity.ID                = Guid.NewGuid().ToString();
                        uentity.CreateDate        = DateTime.Now;
                        uentity.OrderNum          = i;
                        entity.AccompanyingPerson = entity.AccompanyingPerson + userjson[i].Username + ",";
                        list.Add(uentity);
                    }
                }
                entity.AccompanyingNumber = userjson.Count;
                entity.AccompanyingPerson = entity.AccompanyingPerson.TrimEnd(',');
                res.Insert <CarUserFileImgEntity>(list);
                res.Insert(entity);
                res.Commit();
                UploadUserHiK(entity, list);//人员同步到海康平台
            }
            catch (Exception)
            {
                res.Rollback();
            }
        }