コード例 #1
0
        /// <summary>
        /// 保存临时人员
        /// </summary>
        /// <param name="keyValue"></param>
        /// <param name="entity"></param>
        public List <AddJurisdictionEntity> SaveUForm(string keyValue, TemporaryUserEntity entity)
        {
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();
            //开始事物
            var res = DbFactory.Base().BeginTrans();

            try
            {
                List <TemporaryUserEntity> list = new List <TemporaryUserEntity>();
                if (!string.IsNullOrEmpty(keyValue))
                {
                    entity.Modify(keyValue);
                    list.Add(entity);
                }
                else
                {
                    entity.Create();
                    list.Add(entity);
                }
                res.Insert <TemporaryUserEntity>(list);
                res.Commit();
                var tasks = InsertTempUserHiK(entity, list);
                taskIds.Add(tasks);
            }
            catch (Exception er)
            {
                res.Rollback();
            }
            return(taskIds);
        }
コード例 #2
0
        /// <summary>
        /// 获取临时人员实体
        /// </summary>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        public TemporaryUserEntity GetEmptyUserEntity(string keyValue)
        {
            Repository <TemporaryUserEntity> inlogdb = new Repository <TemporaryUserEntity>(DbFactory.Base());
            TemporaryUserEntity old = inlogdb.FindEntity(keyValue);

            return(old);
        }
コード例 #3
0
        /// <summary>
        /// 给新添加的人员单个分配卡号
        /// </summary>
        private void SetLoadUserCarNo(TemporaryUserEntity Item, string baseUrl, string Key, string Signature)
        {
            var url = "/artemis/api/cis/v1/card/bindings";
            List <cardList1>           cardList = new List <cardList1>();
            List <TemporaryUserEntity> list     = new List <TemporaryUserEntity>();

            list.Add(Item);
            cardList1 entity = new cardList1();
            string    time   = DateTime.Now.ToString("yyyyMMddHHmmss");
            var       no     = Str.PinYin(Item.UserName).ToUpper() + time;//卡号唯一

            if (Item.Istemporary == 0)
            {
                no = Item.Tel.Trim();
            }                                                   //非临时人员
            entity.cardNo   = no;
            entity.personId = Item.USERID;
            entity.cardType = 1;
            cardList.Add(entity);
            var model = new
            {
                startDate = Convert.ToDateTime(Item.startTime).ToString("yyyy-MM-dd"),
                endDate   = Convert.ToDateTime(Item.EndTime).ToString("yyyy-MM-dd"),
                cardList
            };

            HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseUrl, 443, true);
            byte[] result = HttpUtillibKbs.HttpPost(url, JsonConvert.SerializeObject(model), 20);
            if (result != null)
            {
                string msg = System.Text.Encoding.UTF8.GetString(result);
            }
        }
コード例 #4
0
        /// <summary>
        /// 单个添加人脸
        /// </summary>
        public void SaveSingleFace(TemporaryUserEntity insert)
        {
            DataItemDetailService data = new DataItemDetailService();
            var    pitem     = data.GetItemValue("Hikappkey");  //密钥
            var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
            string Key       = string.Empty;
            string Signature = string.Empty;
            string url       = "/artemis/api/resource/v1/face/single/add";

            if (!string.IsNullOrEmpty(pitem))
            {
                Key       = pitem.Split('|')[0];
                Signature = pitem.Split('|')[1];
            }

            var model = new
            {
                personId = insert.USERID,
                faceData = insert.ImgData
            };

            HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseurl, 443, true);
            byte[] result = HttpUtillibKbs.HttpPost(url, JsonConvert.SerializeObject(model), 20);
            //string msg = System.Text.Encoding.UTF8.GetString(result);

            //string msg = SocketHelper.LoadCameraList(model, baseurl, url, Key, Signature);
        }
コード例 #5
0
        /// <summary>
        /// 将临时人员信息上传到海康平台
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        public AddJurisdictionEntity InsertTempUserHiK(TemporaryUserEntity entity, List <TemporaryUserEntity> list)
        {
            DataItemDetailService data = new DataItemDetailService();
            var    pitem     = data.GetItemValue("Hikappkey");  //密钥
            var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
            string Key       = string.Empty;
            string Signature = string.Empty;
            string no        = new Random().Next(10, 888888).ToString();

            if (!string.IsNullOrEmpty(pitem))
            {
                Key       = pitem.Split('|')[0];
                Signature = pitem.Split('|')[1];
            }
            string Url = "/artemis/api/resource/v1/person/single/add";

            foreach (var item in list)
            {
                //人脸信息(base64必须为jpg格式)
                List <FaceEntity> faces = new List <FaceEntity>();
                FaceEntity        face  = new FaceEntity();
                face.faceData = item.ImgData;
                faces.Add(face);
                string orgcode = "root000000";
                if (item.Istemporary == 0)
                {
                    orgcode = item.Groupsid;
                }
                var model = new
                {
                    personId        = item.USERID,
                    personName      = item.UserName,
                    gender          = "1",
                    orgIndexCode    = orgcode,
                    birthday        = "1990-01-01",
                    phoneNo         = item.Tel,
                    email           = "*****@*****.**",
                    certificateType = "990",
                    certificateNo   = no,
                    jobNo           = item.Tel,
                    faces
                };
                //string msg = SocketHelper.LoadCameraList(model, baseurl, Url, Key, Signature);
                HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseurl, 443, true);
                byte[] result = HttpUtillibKbs.HttpPost(Url, JsonConvert.SerializeObject(model), 20);
                if (result != null)
                {
                    string    msg = System.Text.Encoding.UTF8.GetString(result);
                    parkList1 pl  = JsonConvert.DeserializeObject <parkList1>(msg);
                    if (pl != null && pl.code == "0")
                    {
                        SetLoadUserCarNo(item, baseurl, Key, Signature);
                    }
                }
            }
            //添加权限
            return(UploadUserlimits(list, baseurl, Key, Signature));
        }
コード例 #6
0
        /// <summary>
        /// 批量权限设置
        /// </summary>
        /// <param name="list"></param>
        public List <AddJurisdictionEntity> SaveCycle(List <TemporaryUserEntity> list)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();

            try
            {
                List <TemporaryUserEntity>       list1      = new List <TemporaryUserEntity>();
                List <TemporaryUserEntity>       addlist    = new List <TemporaryUserEntity>();
                List <TemporaryUserEntity>       updatelist = new List <TemporaryUserEntity>();
                Repository <TemporaryUserEntity> inlogdb    = new Repository <TemporaryUserEntity>(DbFactory.Base());
                DataItemDetailService            data       = new DataItemDetailService();
                var    pitem     = data.GetItemValue("Hikappkey");  //密钥
                var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
                string Key       = string.Empty;
                string Signature = string.Empty;
                if (!string.IsNullOrEmpty(pitem))
                {
                    Key       = pitem.Split('|')[0];
                    Signature = pitem.Split('|')[1];
                }
                foreach (var entity in list)
                {
                    TemporaryUserEntity old = inlogdb.FindEntity(entity.USERID);
                    if (old != null)
                    {
                        old.EndTime   = entity.EndTime;
                        old.startTime = entity.startTime;
                        if (old.Istemporary == 0 && string.IsNullOrEmpty(old.PassPost))
                        {//添加权限
                            old.PassPost = entity.PassPost;
                            addlist.Add(old);
                        }
                        else
                        {//更改权限
                            updatelist.Add(old);
                            old.PassPost = entity.PassPost;
                        }
                        list1.Add(old);
                    }
                }
                SetLoadUserCarNo1(addlist, baseurl, Key, Signature);
                var delEntity = DelEquipmentRecord(updatelist, baseurl, Key, Signature);
                var addEntity = UploadUserlimits(list1, baseurl, Key, Signature);
                taskIds.Add(delEntity); //删除权限集
                taskIds.Add(addEntity); //添加权限集

                res.Update <TemporaryUserEntity>(list1);
                res.Commit();
            }
            catch (Exception er)
            {
                res.Rollback();
            }
            return(taskIds);
        }
コード例 #7
0
        /// <summary>
        /// 单条记录授权或重新授权
        /// </summary>
        /// <param name="entity1"></param>
        /// <param name="keyValue"></param>
        /// <param name="Power">是否受过权 true 更改权限 false 添加权限</param>
        public List <AddJurisdictionEntity> SaveUserFace(TemporaryUserEntity entity1, string keyValue, bool Power)
        {
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();
            var res = DbFactory.Base().BeginTrans();

            try
            {
                DataItemDetailService data = new DataItemDetailService();
                var    pitem     = data.GetItemValue("Hikappkey");  //密钥
                var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
                string Key       = string.Empty;
                string Signature = string.Empty;
                if (!string.IsNullOrEmpty(pitem))
                {
                    Key       = pitem.Split('|')[0];
                    Signature = pitem.Split('|')[1];
                }
                Repository <TemporaryUserEntity> inlogdb = new Repository <TemporaryUserEntity>(DbFactory.Base());
                TemporaryUserEntity entity = inlogdb.FindEntity(keyValue);
                if (entity != null)
                {
                    List <TemporaryUserEntity> dellist = new List <TemporaryUserEntity>();
                    dellist.Add(entity);
                    entity.UserImg    = entity1.UserImg;
                    entity.ImgData    = entity1.ImgData;
                    entity.PassPost   = entity1.PassPost;
                    entity.PassPostId = entity1.PassPostId;
                    entity.startTime  = entity1.startTime;
                    entity.EndTime    = entity1.EndTime;
                    res.Update(entity);
                    res.Commit();
                    List <TemporaryUserEntity> list = new List <TemporaryUserEntity>();
                    list.Add(entity);
                    if (Power)
                    {     //更改权限
                        if (entity1.Remark == "1")
                        { //更换人脸(仅用于页面状态临时判断)
                            string msg = UpdateHumanFace(entity, baseurl, Key, Signature);
                        }
                        var delEntity = DelEquipmentRecord(dellist, baseurl, Key, Signature);
                        taskIds.Add(delEntity);//删除权限集
                    }
                    else
                    {//添加权限
                        SetLoadUserCarNo(entity, baseurl, Key, Signature);
                    }
                    var addEntity = UploadUserlimits(list, baseurl, Key, Signature);
                    taskIds.Add(addEntity);//添加权限集
                }
            }
            catch (Exception)
            {
                res.Rollback();
            }
            return(taskIds);
        }
コード例 #8
0
        /// <summary>
        /// 加入禁入名单
        /// </summary>
        /// <param name="list"></param>
        public List <AddJurisdictionEntity> SaveForbidden(List <TemporaryUserEntity> list)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();

            try
            {
                Repository <TemporaryUserEntity>   inlogdb = new Repository <TemporaryUserEntity>(DbFactory.Base());
                Repository <ForbiddenRecordEntity> Frecord = new Repository <ForbiddenRecordEntity>(DbFactory.Base());
                DataItemDetailService data = new DataItemDetailService();
                var    pitem     = data.GetItemValue("Hikappkey");  //密钥
                var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
                string Key       = string.Empty;
                string Signature = string.Empty;
                if (!string.IsNullOrEmpty(pitem))
                {
                    Key       = pitem.Split('|')[0];
                    Signature = pitem.Split('|')[1];
                }
                List <TemporaryUserEntity>   list1 = new List <TemporaryUserEntity>();
                List <ForbiddenRecordEntity> list2 = new List <ForbiddenRecordEntity>();
                foreach (var entity in list)
                {
                    TemporaryUserEntity old = inlogdb.FindEntity(entity.USERID);
                    if (old != null)
                    {
                        old.ISDebar = 1;
                        old.Remark  = entity.Remark;
                        list1.Add(old);
                        //禁入记录
                        ForbiddenRecordEntity RecordEntity = new ForbiddenRecordEntity();
                        RecordEntity.Create();
                        RecordEntity.StartTime = DateTime.Now;
                        RecordEntity.Remark    = entity.Remark;
                        RecordEntity.UserId    = old.USERID;
                        list2.Add(RecordEntity);
                    }
                }
                res.Update <TemporaryUserEntity>(list1);
                res.Insert <ForbiddenRecordEntity>(list2);
                res.Commit();
                if (list1.Count > 0)
                {
                    list1.ForEach(a => a.EndTime = DateTime.Now.AddDays(-1));
                }
                ;
                var Invalidentity = UploadUserlimits(list1, baseurl, Key, Signature);
                taskIds.Add(Invalidentity);
            }
            catch (Exception er)
            {
                res.Rollback();
            }
            return(taskIds);
        }
コード例 #9
0
        /// <summary>
        /// 单条同步更换海康人脸信息
        /// </summary>
        public string UpdateHumanFace(TemporaryUserEntity entity, string baseUrl, string Key, string Signature)
        {
            string res = string.Empty;

            try
            {
                string url   = "/artemis/api/resource/v2/person/advance/personList";
                var    model = new
                {
                    personIds = entity.USERID,
                    pageNo    = 1,
                    pageSize  = 100
                };
                //查询人脸图片唯一标识
                //string msg = SocketHelper.LoadCameraList(model, baseUrl, url, Key, Signature);
                HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseUrl, 443, true);
                byte[]        result = HttpUtillibKbs.HttpPost(url, JsonConvert.SerializeObject(model), 20);
                string        msg    = System.Text.Encoding.UTF8.GetString(result);
                UserPicEntity re     = JsonConvert.DeserializeObject <UserPicEntity>(msg);
                if (re != null && re.data.list.Count > 0)
                {
                    string picfileid = string.Empty;
                    foreach (var item in re.data.list)
                    {
                        foreach (var items in item.personPhoto)
                        {
                            picfileid = items.personPhotoIndexCode;
                        }
                    }
                    //更换人脸图片
                    string upurl    = "/artemis/api/resource/v1/face/single/update";
                    var    delmodel = new
                    {
                        faceId   = picfileid,
                        faceData = entity.ImgData
                    };
                    HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseUrl, 443, true);
                    byte[] result1 = HttpUtillibKbs.HttpPost(upurl, JsonConvert.SerializeObject(delmodel), 20);
                    msg = System.Text.Encoding.UTF8.GetString(result1);
                }
                else if (!string.IsNullOrEmpty(entity.ImgData))
                {//没查到人脸唯一标示,表示人脸上传未成功就重新上传人脸信息
                    List <FacedataEntity> FaceList = new List <FacedataEntity>();
                    FacedataEntity        faces    = new FacedataEntity();
                    faces.UserId  = entity.USERID;
                    faces.ImgData = entity.ImgData;
                    FaceList.Add(faces);
                    res = SocketHelper.UploadFace(FaceList, baseUrl, Key, Signature, 1);
                }
            }
            catch (Exception)
            {
            }
            return(res);
        }
コード例 #10
0
 /// <summary>
 /// 单条记录授权或重新授权
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="keyValue"></param>
 /// <param name="Power">是否受过权 true 更改权限 false 添加权限</param>
 public List <AddJurisdictionEntity> SaveUserFace(TemporaryUserEntity entity, string keyValue, bool Power)
 {
     try
     {
         return(service.SaveUserFace(entity, keyValue, Power));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #11
0
 /// <summary>
 /// 用户权限管理
 /// </summary>
 /// <param name="UserEntity"></param>
 /// <param name="userids"></param>
 /// <param name="type"></param>
 public void SaveUserJurisdiction(TemporaryUserEntity UserEntity, string userids, string type)
 {
     try
     {
         service.SaveUserJurisdiction(UserEntity, userids, type);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #12
0
 /// <summary>
 /// 删除临时人员
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void DeleteTemporaryList(string type, TemporaryUserEntity entity)
 {
     try
     {
         service.DeleteTemporaryList(type, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #13
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public List <AddJurisdictionEntity> SaveUForm(string keyValue, TemporaryUserEntity entity)
 {
     try
     {
         return(service.SaveUForm(keyValue, entity));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #14
0
        /// <summary>
        /// 移除禁入名单
        /// </summary>
        /// <param name="list"></param>
        public List <AddJurisdictionEntity> RemoveForbidden(string list)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();

            try
            {
                Repository <TemporaryUserEntity>   inlogdb = new Repository <TemporaryUserEntity>(DbFactory.Base());
                Repository <ForbiddenRecordEntity> Frecord = new Repository <ForbiddenRecordEntity>(DbFactory.Base());
                DataItemDetailService data = new DataItemDetailService();
                var    pitem     = data.GetItemValue("Hikappkey");  //密钥
                var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
                string Key       = string.Empty;
                string Signature = string.Empty;
                if (!string.IsNullOrEmpty(pitem))
                {
                    Key       = pitem.Split('|')[0];
                    Signature = pitem.Split('|')[1];
                }
                List <TemporaryUserEntity>   list1 = new List <TemporaryUserEntity>();
                List <ForbiddenRecordEntity> list2 = new List <ForbiddenRecordEntity>();
                foreach (var UserId in list.Split(','))
                {
                    if (string.IsNullOrEmpty(UserId))
                    {
                        continue;
                    }
                    TemporaryUserEntity old = inlogdb.FindEntity(UserId);
                    if (old != null)
                    {
                        old.ISDebar = 0;
                        list1.Add(old);
                        //移除禁入记录
                        List <ForbiddenRecordEntity> Rlist = Frecord.IQueryable(it => it.UserId == UserId).OrderByDescending(t => t.CreateDate).ToList();
                        if (Rlist != null)
                        {
                            Rlist[0].EndTime = DateTime.Now;
                            list2.Add(Rlist[0]);
                        }
                    }
                }
                var Invalidentity = UploadUserlimits(list1, baseurl, Key, Signature);
                taskIds.Add(Invalidentity);
                res.Update <TemporaryUserEntity>(list1);
                res.Update <ForbiddenRecordEntity>(list2);
                res.Commit();
            }
            catch (Exception er)
            {
                res.Rollback();
            }
            return(taskIds);
        }
コード例 #15
0
        /// <summary>
        /// 用户权限管理
        /// </summary>
        /// <param name="UserEntity"></param>
        /// <param name="userids"></param>
        /// <param name="type"></param>
        public void SaveUserJurisdiction(TemporaryUserEntity UserEntity, string userids, string type)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();

            try
            {
                //List<TemporaryUserEntity> list1 = new List<TemporaryUserEntity>();
                //if (type == "1")
                //{//门岗权限分配
                //    DataItemDetailService data = new DataItemDetailService();
                //    var pitem = data.GetItemValue("Hikappkey");//密钥
                //    var baseurl = data.GetItemValue("HikBaseUrl");//海康地址
                //    string Key = string.Empty;
                //    string Signature = string.Empty;
                //    if (!string.IsNullOrEmpty(pitem))
                //    {
                //        Key = pitem.Split('|')[0];
                //        Signature = pitem.Split('|')[1];
                //    }
                //    Repository<TemporaryUserEntity> inlogdb = new Repository<TemporaryUserEntity>(DbFactory.Base());
                //    List<TemporaryUserEntity> plist = new List<TemporaryUserEntity>();

                //    string[] ids = userids.Split(',');
                //    foreach (var item in ids)
                //    {
                //        if (string.IsNullOrEmpty(item)) continue;
                //        TemporaryUserEntity old = inlogdb.FindEntity(item);
                //        if (old != null && old.EndTime != null)
                //        {//只需要添加权限配置和快捷下载
                //            old.PassPost = UserEntity.PassPost;
                //            list1.Add(old);
                //            if (old.EndTime != null)
                //            {//权限配置及下发结束时间必填
                //                plist.Add(old);
                //            }
                //        }
                //    }

                //    UploadUserlimits(plist, baseurl, Key, Signature);
                //    res.Update<TemporaryUserEntity>(list1);
                //    res.Commit();
                // }
            }
            catch (Exception)
            {
                res.Rollback();
            }
        }
コード例 #16
0
        /// <summary>
        /// 删除临时人员
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void DeleteTemporaryList(string keyValue, TemporaryUserEntity entity)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();

            try
            {
                res.Delete <TemporaryUserEntity>(entity);
                res.Commit();
            }
            catch (Exception er)
            {
                res.Rollback();
            }
        }
コード例 #17
0
        /// <summary>
        /// 获取临时人员实体
        /// </summary>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        public TemporaryUserEntity GetUserEntity(string keyValue)
        {
            Repository <TemporaryUserEntity> inlogdb = new Repository <TemporaryUserEntity>(DbFactory.Base());
            TemporaryUserEntity old = inlogdb.FindEntity(keyValue);

            if (old == null)
            {//临时表没记录取用户表基础信息
                UserService       userbll = new UserService();
                DepartmentService deptbll = new DepartmentService();
                var uentity = userbll.GetEntity(keyValue);
                old             = new TemporaryUserEntity();
                old.UserName    = uentity.RealName;
                old.Tel         = uentity.Mobile;
                old.Identifyid  = uentity.IdentifyID;
                old.startTime   = uentity.CreateDate;
                old.Istemporary = 2;
                //old.UserImg = uentity.HeadIcon;
            }
            return(old);
        }
コード例 #18
0
        public TemporaryUserEntity ImgToBase64(string imgData)
        {
            TemporaryUserEntity UserEntity = new TemporaryUserEntity();
            string fileurl = string.Empty;

            if (!string.IsNullOrEmpty(imgData))
            {//拍照的照片
                UserEntity.ImgData = imgData;
                DataItemDetailBLL dd   = new DataItemDetailBLL();
                string            path = dd.GetItemValue("imgPath") + "\\Resource\\" + "TemporaryUser";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string sdd    = imgData.Substring(0, imgData.IndexOf(',') + 1);
                string base64 = imgData.Replace(sdd, "");
                byte[] arr2   = Convert.FromBase64String(base64);
                using (MemoryStream ms2 = new MemoryStream(arr2))
                {//将png格式图片存储为jpg格式文件
                    System.Drawing.Bitmap bmp2 = new System.Drawing.Bitmap(ms2);
                    bmp2 = KiResizelmage(bmp2, 600, 450);
                    string fileName = Guid.NewGuid().ToString() + ".jpg";
                    bmp2.Save(path + "\\" + fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
                    fileurl = "\\Resource\\" + "TemporaryUser" + "\\" + fileName;
                }
                string srcPath = Server.MapPath("~" + fileurl);
                if (System.IO.File.Exists(srcPath))
                {
                    //读jpg图片转为Base64String
                    var nbase64 = Convert.ToBase64String(System.IO.File.ReadAllBytes(srcPath));
                    UserEntity.ImgData = nbase64;
                }
                UserEntity.UserImg = fileurl;
            }
            return(UserEntity);
        }
コード例 #19
0
        public ActionResult GetCarUserList(string userids, string type = "0")
        {
            string[] users  = userids.Split(',');
            string   userid = "";

            for (int i = 0; i < users.Length; i++)
            {
                if (i == 0)
                {
                    userid = "'" + users[i] + "'";
                }
                else
                {
                    userid += ",'" + users[i] + "'";
                }
                #region 临时人员判断
                if (type == "1")
                {
                    var tempentity = new TemporaryGroupsBLL().GetEmptyUserEntity(users[i]);
                    if (tempentity == null)
                    {
                        var Us = userBLL.GetEntity(users[i]);
                        if (Us != null)
                        {
                            List <TemporaryUserEntity> list = new List <TemporaryUserEntity>();
                            //如果不存在于临时列表则新增一条数据
                            TemporaryUserEntity inserttuser = new TemporaryUserEntity();
                            inserttuser.Tel          = Us.Account;
                            inserttuser.ComName      = "";
                            inserttuser.CreateDate   = Us.CreateDate;
                            inserttuser.CreateUserId = Us.CreateUserId;
                            inserttuser.USERID       = Us.UserId;
                            inserttuser.Gender       = Us.Gender;
                            inserttuser.ISDebar      = 0;
                            inserttuser.Istemporary  = 0;
                            inserttuser.Identifyid   = Us.IdentifyID;
                            inserttuser.Postname     = Us.DutyName;
                            inserttuser.UserName     = Us.RealName;
                            inserttuser.Groupsid     = Us.DepartmentId;
                            inserttuser.startTime    = Us.CreateDate;
                            var dept1 = departmentBLL.GetEntity(Us.DepartmentId);
                            if (dept1 != null)
                            {
                                inserttuser.GroupsName = dept1.FullName;
                            }
                            list.Add(inserttuser);
                            new TemporaryGroupsBLL().SaveTemporaryList("", list);
                        }
                    }
                }
                #endregion
            }
            string sql = string.Empty;
            if (type == "1")
            {
                sql = string.Format(@"  select d.userid as id, realname as username from v_userinfo d   where d.userid in ({0})", userid);
            }
            else
            {
                sql = string.Format(@" select d.id,d.userimg,d.username,d.baseid,d.imgdata from bis_usercarfileimg d   where d.id in ({0})", userid);
            }

            var data = Opertickebll.GetDataTable(sql);
            return(ToJsonResult(data));
        }