void AddShopDetail(GanJiWebInfoEntity entity, int shopId) { List<string> shopDetail = new ShopAnalyse().GetShopDetail(entity.HouseDetail, entity.ComeFrom); foreach (string detail in shopDetail) { ShopDetailEntity entityDetail = new ShopDetailEntity(); entityDetail.Info = detail; entityDetail.ShopID = shopId; entityDetail.IsActive = 1; entityDetail.CreateTime = DateTime.Now; ShopDetailBLL.GetInstance().Insert(entityDetail); } }
void AddPublisherInfo(GanJiWebInfoEntity entity, int shopId) { PublisherInfoEntity publisher = new ShopAnalyse().GetPublisherInfo(entity.HouseDetail, entity.ComeFrom); if (!string.IsNullOrEmpty(publisher.UserName) && (!string.IsNullOrEmpty(publisher.UserMobile) || !string.IsNullOrEmpty(publisher.MobilePic))) { publisher.ShopID = shopId; if (!string.IsNullOrEmpty(publisher.MobilePic)) { publisher.UserMobile = "";// GetInternetPic(publisher.MobilePic); } publisher.CreateTime = DateTime.Now; PublisherInfoBLL.GetInstance().Insert(publisher); } }
int AddShopInfo(GanJiWebInfoEntity entity) { if (ShopInfoBLL.GetInstance().IsExistsForTitle(entity.Title)) return 0; ShopInfoEntity shopInfo = new ShopInfoEntity(); shopInfo.ShopTilte = entity.Title; shopInfo.ShopPrice = entity.HousePrice; shopInfo.ShopArea = entity.HouseArea; shopInfo.BusinessID = (int)BaseMethod.GetHouseBusiness(entity.HouseBusiness); shopInfo.CityName = entity.City; shopInfo.AreaName = entity.Area; shopInfo.BurgName = entity.Burg; shopInfo.PublishTime = entity.PublishTime; shopInfo.CreateTime = DateTime.Now; shopInfo.UpdateTime = DateTime.Now; shopInfo.IsActive = 1; shopInfo.SourceID = entity.ID; shopInfo.ShopDisc = new ShopAnalyse().GetShopDesc(entity.HouseDiscribe, entity.ComeFrom); return ShopInfoBLL.GetInstance().Insert(shopInfo); }
void AddShopPic(GanJiWebInfoEntity entity, int shopId) { List<string> shopPic = new ShopAnalyse().GetShopPic(entity.HouseImage, entity.ComeFrom); foreach (string picUrl in shopPic) { ShopPicEntity entityPic = new ShopPicEntity(); entityPic.PicUrl = picUrl; entityPic.ShopID = shopId; entityPic.IsActive = 1; entityPic.CreateTime = DateTime.Now; ShopPicBLL.GetInstance().Insert(entityPic); } }
/// <summary> /// 向数据表GanJiWebInfo更新一条记录。带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="_GanJiWebInfoModel">_GanJiWebInfoModel</param> /// <returns>影响的行数</returns> public int Update(SqlTransaction sp, GanJiWebInfoEntity _GanJiWebInfoModel) { string sqlStr = "update GanJiWebInfo set [Title]=@Title,[CrawlerUrl]=@CrawlerUrl,[HousePrice]=@HousePrice,[HouseArea]=@HouseArea,[HouseDetail]=@HouseDetail,[HouseDiscribe]=@HouseDiscribe,[HouseBusiness]=@HouseBusiness,[HouseImage]=@HouseImage,[City]=@City,[Area]=@Area,[Burg]=@Burg,[IsEmail]=@IsEmail,[ComeFrom]=@ComeFrom,[PublishTime]=@PublishTime,[SendMaillTime]=@SendMaillTime,[CreateTime]=@CreateTime,[State]=@State,[IsAnalyze]=@IsAnalyze where ID=@ID"; SqlParameter[] _param ={ new SqlParameter("@ID",SqlDbType.Int), new SqlParameter("@Title",SqlDbType.VarChar), new SqlParameter("@CrawlerUrl",SqlDbType.VarChar), new SqlParameter("@HousePrice",SqlDbType.Float), new SqlParameter("@HouseArea",SqlDbType.Int), new SqlParameter("@HouseDetail",SqlDbType.NText), new SqlParameter("@HouseDiscribe",SqlDbType.NText), new SqlParameter("@HouseBusiness",SqlDbType.VarChar), new SqlParameter("@HouseImage",SqlDbType.NText), new SqlParameter("@City",SqlDbType.VarChar), new SqlParameter("@Area",SqlDbType.VarChar), new SqlParameter("@Burg",SqlDbType.VarChar), new SqlParameter("@IsEmail",SqlDbType.Bit), new SqlParameter("@ComeFrom",SqlDbType.SmallInt), new SqlParameter("@PublishTime",SqlDbType.DateTime), new SqlParameter("@SendMaillTime",SqlDbType.DateTime), new SqlParameter("@CreateTime",SqlDbType.DateTime), new SqlParameter("@State",SqlDbType.Bit), new SqlParameter("@IsAnalyze",SqlDbType.SmallInt) }; _param[0].Value = _GanJiWebInfoModel.ID; _param[1].Value = _GanJiWebInfoModel.Title; _param[2].Value = _GanJiWebInfoModel.CrawlerUrl; _param[3].Value = _GanJiWebInfoModel.HousePrice; _param[4].Value = _GanJiWebInfoModel.HouseArea; _param[5].Value = _GanJiWebInfoModel.HouseDetail; _param[6].Value = _GanJiWebInfoModel.HouseDiscribe; _param[7].Value = _GanJiWebInfoModel.HouseBusiness; _param[8].Value = _GanJiWebInfoModel.HouseImage; _param[9].Value = _GanJiWebInfoModel.City; _param[10].Value = _GanJiWebInfoModel.Area; _param[11].Value = _GanJiWebInfoModel.Burg; _param[12].Value = _GanJiWebInfoModel.IsEmail; _param[13].Value = _GanJiWebInfoModel.ComeFrom; _param[14].Value = _GanJiWebInfoModel.PublishTime; _param[15].Value = _GanJiWebInfoModel.SendMaillTime; _param[16].Value = _GanJiWebInfoModel.CreateTime; _param[17].Value = _GanJiWebInfoModel.State; _param[18].Value = _GanJiWebInfoModel.IsAnalyze; return SqlHelper.ExecuteNonQuery(sp, CommandType.Text, sqlStr, _param); }
/// <summary> /// 得到 ganjiwebinfo 数据实体 /// </summary> /// <param name="dr">dr</param> /// <returns>ganjiwebinfo 数据实体</returns> public GanJiWebInfoEntity Populate_GanJiWebInfoEntity_FromDr(IDataReader dr) { GanJiWebInfoEntity Obj = new GanJiWebInfoEntity(); Obj.ID = ((dr["ID"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["ID"]); Obj.Title = dr["Title"].ToString(); Obj.CrawlerUrl = dr["CrawlerUrl"].ToString(); Obj.HousePrice = ((dr["HousePrice"]) == DBNull.Value) ? 0 : Convert.ToDouble(dr["HousePrice"]); Obj.HouseArea = ((dr["HouseArea"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["HouseArea"]); Obj.HouseDetail = dr["HouseDetail"].ToString(); Obj.HouseDiscribe = dr["HouseDiscribe"].ToString(); Obj.HouseBusiness = dr["HouseBusiness"].ToString(); Obj.HouseImage = dr["HouseImage"].ToString(); Obj.City = dr["City"].ToString(); Obj.Area = dr["Area"].ToString(); Obj.Burg = dr["Burg"].ToString(); Obj.IsEmail = ((dr["IsEmail"]) == DBNull.Value) ? false : Convert.ToBoolean(dr["IsEmail"]); Obj.ComeFrom = ((dr["ComeFrom"]) == DBNull.Value) ? (short)0 : (short)dr["ComeFrom"]; Obj.PublishTime = ((dr["PublishTime"]) == DBNull.Value) ? Convert.ToDateTime("1900-1-1") : Convert.ToDateTime(dr["PublishTime"]); Obj.SendMaillTime = ((dr["SendMaillTime"]) == DBNull.Value) ? Convert.ToDateTime("1900-1-1") : Convert.ToDateTime(dr["SendMaillTime"]); Obj.CreateTime = ((dr["CreateTime"]) == DBNull.Value) ? Convert.ToDateTime("1900-1-1") : Convert.ToDateTime(dr["CreateTime"]); Obj.State = ((dr["State"]) == DBNull.Value) ? false : Convert.ToBoolean(dr["State"]); Obj.IsAnalyze = ((dr["IsAnalyze"]) == DBNull.Value) ? (short)0 : (short)dr["IsAnalyze"]; return Obj; }
/// <summary> /// 向数据库中插入一条新记录。带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="_GanJiWebInfoModel">GanJiWebInfo实体</param> /// <returns>新插入记录的编号</returns> public int Insert(SqlTransaction sp, GanJiWebInfoEntity _GanJiWebInfoModel) { string sqlStr = "insert into GanJiWebInfo([Title],[CrawlerUrl],[HousePrice],[HouseArea],[HouseDetail],[HouseDiscribe],[HouseBusiness],[HouseImage],[City],[Area],[Burg],[IsEmail],[ComeFrom],[PublishTime],[SendMaillTime],[CreateTime],[State],[IsAnalyze]) values(@Title,@CrawlerUrl,@HousePrice,@HouseArea,@HouseDetail,@HouseDiscribe,@HouseBusiness,@HouseImage,@City,@Area,@Burg,@IsEmail,@ComeFrom,@PublishTime,@SendMaillTime,@CreateTime,@State,@IsAnalyze) select @@identity"; int res; SqlParameter[] _param ={ new SqlParameter("@Title",SqlDbType.VarChar), new SqlParameter("@CrawlerUrl",SqlDbType.VarChar), new SqlParameter("@HousePrice",SqlDbType.Float), new SqlParameter("@HouseArea",SqlDbType.Int), new SqlParameter("@HouseDetail",SqlDbType.NText), new SqlParameter("@HouseDiscribe",SqlDbType.NText), new SqlParameter("@HouseBusiness",SqlDbType.VarChar), new SqlParameter("@HouseImage",SqlDbType.NText), new SqlParameter("@City",SqlDbType.VarChar), new SqlParameter("@Area",SqlDbType.VarChar), new SqlParameter("@Burg",SqlDbType.VarChar), new SqlParameter("@IsEmail",SqlDbType.Bit), new SqlParameter("@ComeFrom",SqlDbType.SmallInt), new SqlParameter("@PublishTime",SqlDbType.DateTime), new SqlParameter("@SendMaillTime",SqlDbType.DateTime), new SqlParameter("@CreateTime",SqlDbType.DateTime), new SqlParameter("@State",SqlDbType.Bit), new SqlParameter("@IsAnalyze",SqlDbType.SmallInt) }; _param[0].Value = _GanJiWebInfoModel.Title; _param[1].Value = _GanJiWebInfoModel.CrawlerUrl; _param[2].Value = _GanJiWebInfoModel.HousePrice; _param[3].Value = _GanJiWebInfoModel.HouseArea; _param[4].Value = _GanJiWebInfoModel.HouseDetail; _param[5].Value = _GanJiWebInfoModel.HouseDiscribe; _param[6].Value = _GanJiWebInfoModel.HouseBusiness; _param[7].Value = _GanJiWebInfoModel.HouseImage; _param[8].Value = _GanJiWebInfoModel.City; _param[9].Value = _GanJiWebInfoModel.Area; _param[10].Value = _GanJiWebInfoModel.Burg; _param[11].Value = _GanJiWebInfoModel.IsEmail; _param[12].Value = _GanJiWebInfoModel.ComeFrom; _param[13].Value = _GanJiWebInfoModel.PublishTime; _param[14].Value = _GanJiWebInfoModel.SendMaillTime; _param[15].Value = _GanJiWebInfoModel.CreateTime; _param[16].Value = _GanJiWebInfoModel.State; _param[17].Value = _GanJiWebInfoModel.IsAnalyze; res = Convert.ToInt32(SqlHelper.ExecuteScalar(sp, CommandType.Text, sqlStr, _param)); return res; }