public static bool 将上传时被过滤的信息记录到表中(int 城市ID, int 网站ID, List <案例库上传信息过滤表> 过滤案例List, DataClassesDataContext db = null)
        {
            if (城市ID < 1 || 网站ID < 1 || 过滤案例List == null || 过滤案例List.Count < 1)
            {
                return(true);
            }
            List <案例库上传信息过滤表> list = new List <案例库上传信息过滤表>();

            foreach (案例库上传信息过滤表 obj in 过滤案例List)
            {
                案例库上传信息过滤表 caseObj = new 案例库上传信息过滤表 {
                    案例ID = obj.案例ID, 城市ID = 城市ID, 网站ID = 网站ID, 过滤时间 = DateTime.Now, 错误说明 = obj.错误说明
                };
                list.Add(caseObj);
            }
            bool exstisDb = true;

            if (db == null)
            {
                exstisDb = false;
                db       = new DataClassesDataContext();
            }
            try
            {
                db.案例库上传信息过滤表.InsertAllOnSubmit <案例库上传信息过滤表>(list);
                db.SubmitChanges();
                if (!exstisDb)
                {
                    db.Connection.Close();
                }
            }
            catch (Exception ex)
            {
                log.Error(string.Format("将上传时被过滤的信息记录到表中_异常,(城市ID:{0},网站ID{1},当前案例ID个数:{2})",
                                        城市ID, 网站ID, 过滤案例List.Count),
                          ex);
                if (!exstisDb)
                {
                    db.Connection.Close();
                }
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_obj"></param>
        /// <param name="过滤信息">输出过滤掉的案例</param>
        /// <returns></returns>
        public static bool 发布需要整理的数据到服务器(VIEW_案例信息_城市表_网站表 _obj, out 案例库上传信息过滤表 过滤信息, out int fxtId, FxtAPIClientExtend _fxtApi = null)
        {
            fxtId = 0;
            bool result = true;
            Dictionary <long, int>   dic      = new Dictionary <long, int>();
            List <VIEW_案例信息_城市表_网站表> _list    = new List <VIEW_案例信息_城市表_网站表>();
            List <案例库上传信息过滤表>        过滤信息List = new List <案例库上传信息过滤表>();

            过滤信息 = null;
            if (_obj == null)
            {
                return(true);
            }
            _list.Add(_obj);
            FxtAPIClientExtend fxtApi = new FxtAPIClientExtend(_fxtApi);

            try
            {
                result = 发布需要整理的数据到服务器(_list, out 过滤信息List, out dic, _fxtApi: fxtApi);
                if (过滤信息List != null && 过滤信息List.Count > 0)
                {
                    过滤信息 = 过滤信息List[0];
                }
                if (dic.ContainsKey(_obj.ID))
                {
                    fxtId = dic[_obj.ID];
                }
                fxtApi.Abort();
            }
            catch (Exception ex)
            {
                log.Error("发布需要整理的数据到服务器(VIEW_案例信息_城市表_网站表 _obj, out 案例库上传信息过滤表 过滤信息,out int fxtId)", ex);
                fxtApi.Abort();
                return(false);
            }
            return(result);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_list"></param>
        /// <param name="caseIds">输出过滤掉的案例ID</param>
        /// <returns></returns>
        public static bool 发布需要整理的数据到服务器(List <VIEW_案例信息_城市表_网站表> _list, out List <案例库上传信息过滤表> 过滤信息, out Dictionary <long, int> 原始库ID对应成功的房讯通ID, FxtAPIClientExtend _fxtApi = null)
        {
            原始库ID对应成功的房讯通ID = new Dictionary <long, int>();
            过滤信息            = new List <案例库上传信息过滤表>();
            string json     = "";
            string nowIp    = WcfCheck.GetWcfCheckIp();
            string validate = WcfCheck.GetWcfCheckValidData();

            if (_list == null || _list.Count < 1)
            {
                return(true);
            }
            FxtAPIClientExtend fxtServer = new FxtAPIClientExtend(_fxtApi);

            try
            {
                json = _list.FxtApi_GetJson();
                if (string.IsNullOrEmpty(json))
                {
                    fxtServer.Abort();
                    return(true);
                }


                string name    = "SpiderExport";
                var    para    = new { data = json };
                string jsonStr = Convert.ToString(EntranceApi.Entrance_FxtSpider(name, para.ToJSONjss(), _fxtApi: fxtServer));

                List <SpiderExportResult> list = JsonHelp.ParseJSONList <SpiderExportResult>(jsonStr);
                foreach (SpiderExportResult obj in list)
                {
                    if (obj.Success.ToLower().Equals("false"))
                    {
                        VIEW_案例信息_城市表_网站表 obj2 = _list.Find(delegate(VIEW_案例信息_城市表_网站表 _obj2) { return(_obj2.ID == Convert.ToInt64(obj.ID)); });
                        if (obj2 != null)
                        {
                            int    错误类型ID = StaticValue.其他_ID;
                            string 错误说明   = "";
                            if (obj.Remark.Equals(SpiderExportResult.Remark_楼盘名不存在))
                            {
                                错误类型ID = StaticValue.楼盘名不存在_ID;
                                错误说明   = "楼盘名不存在";
                            }
                            else if (obj.Remark.Equals(SpiderExportResult.Remark_系统异常))
                            {
                                错误类型ID = StaticValue.系统异常_ID;
                                错误说明   = "系统异常";
                            }
                            else
                            {
                                错误类型ID = StaticValue.其他_ID;
                                错误说明   = obj.Remark;
                            }
                            案例库上传信息过滤表 obj3 = new 案例库上传信息过滤表 {
                                案例ID = obj2.ID, 城市ID = obj2.城市ID, 网站ID = obj2.网站ID, 错误类型ID = 错误类型ID, 错误说明 = 错误说明, 过滤时间 = DateTime.Now
                            };
                            过滤信息.Add(obj3);
                        }
                    }
                    else
                    {
                        原始库ID对应成功的房讯通ID.Add(Convert.ToInt64(obj.ID), obj.FxtId);
                    }
                }
                fxtServer.Abort();
            }
            catch (Exception ex)
            {
                log.Error("发布需要整理的数据到服务器(List<VIEW_案例信息_城市表_网站表> _list, out List<案例库上传信息过滤表> 过滤信息,out Dictionary<long,int> 原始库ID对应成功的房讯通ID)", ex);
                fxtServer.Abort();
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 导入案例后统计未入库案例个数
        /// </summary>
        /// <param name="importCaseList">准备导入的案例</param>
        /// <param name="notImportCase">导入失败的案例</param>
        /// <param name="message"></param>
        /// <param name="_db"></param>
        /// <returns></returns>
        public static bool UpdateNotImportCaseCount(List <案例信息> importCaseList, List <案例库上传信息过滤表> notImportCase, out string message, DataClass _db = null)
        {
            message = "";
            DataClass db = new DataClass(_db);

            try
            {
                //设置案例楼盘ID,行政区ID,片区ID
                importCaseList = ProjectManager.SetProjectId(importCaseList, _dc: db);
                List <SysData_ProjectCaseCount> addCount    = new List <SysData_ProjectCaseCount>();
                List <SysData_ProjectCaseCount> updateCount = GetSysData_ProjectCaseCountByCase(importCaseList, _db: db);
                foreach (案例信息 caseObj in importCaseList)
                {
                    if (caseObj.fxtId != null)
                    {
                        continue;
                    }
                    bool nowObj = false;//true:新实体,false:存在实体
                    SysData_ProjectCaseCount countObj = updateCount.Where(tbl => tbl.ProjectId == Convert.ToInt64(caseObj.ProjectId) && tbl.AreaId == Convert.ToInt64(caseObj.AreaId)).FirstOrDefault();
                    //个数记录不存在
                    if (countObj == null)
                    {
                        countObj = addCount.Where(tbl => tbl.ProjectId == Convert.ToInt64(caseObj.ProjectId) && tbl.AreaId == Convert.ToInt64(caseObj.AreaId)).FirstOrDefault();
                        if (countObj == null)
                        {
                            nowObj   = true;
                            countObj = new SysData_ProjectCaseCount {
                                ProjectId = Convert.ToInt64(caseObj.ProjectId), AreaId = Convert.ToInt64(caseObj.AreaId), NotImportCaseCount = 0
                            };
                        }
                    }
                    案例库上传信息过滤表 notImport = notImportCase.Where(tbl => tbl.案例ID == caseObj.ID).FirstOrDefault();
                    //当前为导入成功的
                    if (notImport == null)
                    {
                        //当前案例为曾经导入失败的案例
                        if (caseObj.是否已进行入库整理 == 1 && countObj.NotImportCaseCount > 0)
                        {
                            countObj.NotImportCaseCount = countObj.NotImportCaseCount - 1;
                        }
                    }
                    else//当前为导入失败的
                    {
                        //当前案例为曾经导入失败的案例
                        if (caseObj.是否已进行入库整理 != 1)
                        {
                            countObj.NotImportCaseCount = countObj.NotImportCaseCount + 1;
                        }
                    }
                    if (nowObj)
                    {
                        addCount.Add(countObj);
                    }
                }
                db.DB.SysData_ProjectCaseCount.InsertAllOnSubmit(addCount);
                db.DB.SubmitChanges();
            }
            catch (Exception ex)
            {
                db.Connection_Close();
                db.Dispose();
                message = "导入案例后统计未入库案例个数_系统异常";
                log.Error("UpdateNotImportCaseCount(List<VIEW_案例信息_城市表_网站表> importCaseList, List<案例库上传信息过滤表> notImportCase,out string message, DataClass _db = null)", ex);

                return(false);
            }
            db.Connection_Close();
            db.Dispose();
            return(true);
        }