Exemple #1
0
        public void syncwelFareObjectImages()
        {
            var interfaceName      = "syncwelFareObjectImages";
            var loggingSessionInfo = BaseService.GetLoggingSession();
            var imageService       = new ObjectImagesBLL(loggingSessionInfo);

            var dsImages = new DataSet();
            var images   = new ImageList();

            images.mapping = new List <Image>();

            //更新接口同步表
            var queryList = UpdateInterfaceTimestamp(interfaceName, loggingSessionInfo);

            if (queryList != null && queryList.Length > 0)
            {
                //存在,根据日期条件查询
                dsImages = imageService.GetSynWelfareObjectImageList(queryList.FirstOrDefault().LatestTime.ToString());
            }
            else
            {
                //不存在,查询所有数据
                dsImages = imageService.GetSynWelfareObjectImageList(string.Empty);
            }

            if (dsImages != null && dsImages.Tables.Count > 0 && dsImages.Tables[0].Rows.Count > 0)
            {
                images.mapping = DataTableToObject.ConvertToList <Image>(dsImages.Tables[0]);

                //上传数据
                var content = images.ToJSON();
                var result  = UploadData(interfaceName, images.ToJSON());

                //写入接口日志
                var logEntity = new ZInterfaceLogEntity()
                {
                    LogId         = Utils.NewGuid(),
                    InterfaceName = interfaceName,
                    Params        = content,
                    ResultCode    = result.code,
                    ResultDesc    = result.description
                };

                InsertInterfaceLog(logEntity, loggingSessionInfo);
            }
        }