/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StoreInfoEntity GetModel(string BizID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 BizID,StoreName,BranchName,StoreAddress,BusinessTypeID,BusinessAddTime,ChainStoreID,CityID,DistrictID,BusinessState,ShortID,StorePhone,StorePhoto,StoreHours,BasicIntroduction,TelPhone,Cod,OnlinePay,TakeAwayType,VideoAddress,TakeOrderNum,CreateUserName,UpdateUserName,LastUpdateDate,BizSLD,BizBannerUrl,BizWeiBoUrl,BizNotice,GLat,GLng,BLat,BLng,IsQueue,IsPointMenu,IsTakeAway,IsReservation,IsCheck,LikeCount,OrderCount,SortID,IsCitySend,IsCoupon,IsPrivileges,IsSend,ShareCount,CollectionCount,ComCount,FoodCount,IsGroup,QRcodeUrl,Bus,MinPrice,MaxPrice,CarPark,Box,PayCar,WIFI,NoSmoke,ChildrenChair,SendDesc,TakeRange,KCVIP,Onlineorder from StoreInfo "); strSql.Append(" where BizID=@BizID "); SqlParameter[] parameters = { new SqlParameter("@BizID", SqlDbType.NVarChar,50) }; parameters[0].Value = BizID; Maticsoft.Model.StoreInfoEntity model = new Maticsoft.Model.StoreInfoEntity(); DataSet ds = ServerDbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StoreInfoEntity DataRowToModel(DataRow row) { Maticsoft.Model.StoreInfoEntity model = new Maticsoft.Model.StoreInfoEntity(); if (row != null) { if (row["BizID"] != null) { model.BizID = row["BizID"].ToString(); } if (row["StoreName"] != null) { model.StoreName = row["StoreName"].ToString(); } if (row["BranchName"] != null) { model.BranchName = row["BranchName"].ToString(); } if (row["StoreAddress"] != null) { model.StoreAddress = row["StoreAddress"].ToString(); } if (row["BusinessTypeID"] != null) { model.BusinessTypeID = row["BusinessTypeID"].ToString(); } if (row["BusinessAddTime"] != null && row["BusinessAddTime"].ToString() != "") { model.BusinessAddTime = DateTime.Parse(row["BusinessAddTime"].ToString()); } if (row["ChainStoreID"] != null) { model.ChainStoreID = row["ChainStoreID"].ToString(); } if (row["CityID"] != null) { model.CityID = row["CityID"].ToString(); } if (row["DistrictID"] != null) { model.DistrictID = row["DistrictID"].ToString(); } if (row["BusinessState"] != null && row["BusinessState"].ToString() != "") { model.BusinessState = int.Parse(row["BusinessState"].ToString()); } if (row["ShortID"] != null) { model.ShortID = row["ShortID"].ToString(); } if (row["StorePhone"] != null) { model.StorePhone = row["StorePhone"].ToString(); } if (row["StorePhoto"] != null) { model.StorePhoto = row["StorePhoto"].ToString(); } if (row["StoreHours"] != null) { model.StoreHours = row["StoreHours"].ToString(); } if (row["BasicIntroduction"] != null) { model.BasicIntroduction = row["BasicIntroduction"].ToString(); } if (row["TelPhone"] != null) { model.TelPhone = row["TelPhone"].ToString(); } if (row["Cod"] != null && row["Cod"].ToString() != "") { if ((row["Cod"].ToString() == "1") || (row["Cod"].ToString().ToLower() == "true")) { model.Cod = true; } else { model.Cod = false; } } if (row["OnlinePay"] != null && row["OnlinePay"].ToString() != "") { if ((row["OnlinePay"].ToString() == "1") || (row["OnlinePay"].ToString().ToLower() == "true")) { model.OnlinePay = true; } else { model.OnlinePay = false; } } if (row["TakeAwayType"] != null) { model.TakeAwayType = row["TakeAwayType"].ToString(); } if (row["VideoAddress"] != null) { model.VideoAddress = row["VideoAddress"].ToString(); } if (row["TakeOrderNum"] != null && row["TakeOrderNum"].ToString() != "") { model.TakeOrderNum = int.Parse(row["TakeOrderNum"].ToString()); } if (row["CreateUserName"] != null) { model.CreateUserName = row["CreateUserName"].ToString(); } if (row["UpdateUserName"] != null) { model.UpdateUserName = row["UpdateUserName"].ToString(); } if (row["LastUpdateDate"] != null && row["LastUpdateDate"].ToString() != "") { model.LastUpdateDate = DateTime.Parse(row["LastUpdateDate"].ToString()); } if (row["BizSLD"] != null) { model.BizSLD = row["BizSLD"].ToString(); } if (row["BizBannerUrl"] != null) { model.BizBannerUrl = row["BizBannerUrl"].ToString(); } if (row["BizWeiBoUrl"] != null) { model.BizWeiBoUrl = row["BizWeiBoUrl"].ToString(); } if (row["BizNotice"] != null) { model.BizNotice = row["BizNotice"].ToString(); } if (row["GLat"] != null) { model.GLat = row["GLat"].ToString(); } if (row["GLng"] != null) { model.GLng = row["GLng"].ToString(); } if (row["BLat"] != null) { model.BLat = row["BLat"].ToString(); } if (row["BLng"] != null) { model.BLng = row["BLng"].ToString(); } if (row["IsQueue"] != null && row["IsQueue"].ToString() != "") { if ((row["IsQueue"].ToString() == "1") || (row["IsQueue"].ToString().ToLower() == "true")) { model.IsQueue = true; } else { model.IsQueue = false; } } if (row["IsPointMenu"] != null && row["IsPointMenu"].ToString() != "") { if ((row["IsPointMenu"].ToString() == "1") || (row["IsPointMenu"].ToString().ToLower() == "true")) { model.IsPointMenu = true; } else { model.IsPointMenu = false; } } if (row["IsTakeAway"] != null && row["IsTakeAway"].ToString() != "") { if ((row["IsTakeAway"].ToString() == "1") || (row["IsTakeAway"].ToString().ToLower() == "true")) { model.IsTakeAway = true; } else { model.IsTakeAway = false; } } if (row["IsReservation"] != null && row["IsReservation"].ToString() != "") { if ((row["IsReservation"].ToString() == "1") || (row["IsReservation"].ToString().ToLower() == "true")) { model.IsReservation = true; } else { model.IsReservation = false; } } if (row["IsCheck"] != null && row["IsCheck"].ToString() != "") { if ((row["IsCheck"].ToString() == "1") || (row["IsCheck"].ToString().ToLower() == "true")) { model.IsCheck = true; } else { model.IsCheck = false; } } if (row["LikeCount"] != null && row["LikeCount"].ToString() != "") { model.LikeCount = int.Parse(row["LikeCount"].ToString()); } if (row["OrderCount"] != null && row["OrderCount"].ToString() != "") { model.OrderCount = int.Parse(row["OrderCount"].ToString()); } if (row["SortID"] != null && row["SortID"].ToString() != "") { model.SortID = int.Parse(row["SortID"].ToString()); } if (row["IsCitySend"] != null && row["IsCitySend"].ToString() != "") { if ((row["IsCitySend"].ToString() == "1") || (row["IsCitySend"].ToString().ToLower() == "true")) { model.IsCitySend = true; } else { model.IsCitySend = false; } } if (row["IsCoupon"] != null && row["IsCoupon"].ToString() != "") { if ((row["IsCoupon"].ToString() == "1") || (row["IsCoupon"].ToString().ToLower() == "true")) { model.IsCoupon = true; } else { model.IsCoupon = false; } } if (row["IsPrivileges"] != null && row["IsPrivileges"].ToString() != "") { if ((row["IsPrivileges"].ToString() == "1") || (row["IsPrivileges"].ToString().ToLower() == "true")) { model.IsPrivileges = true; } else { model.IsPrivileges = false; } } if (row["IsSend"] != null && row["IsSend"].ToString() != "") { model.IsSend = int.Parse(row["IsSend"].ToString()); } if (row["ShareCount"] != null && row["ShareCount"].ToString() != "") { model.ShareCount = int.Parse(row["ShareCount"].ToString()); } if (row["CollectionCount"] != null && row["CollectionCount"].ToString() != "") { model.CollectionCount = int.Parse(row["CollectionCount"].ToString()); } if (row["ComCount"] != null && row["ComCount"].ToString() != "") { model.ComCount = int.Parse(row["ComCount"].ToString()); } if (row["FoodCount"] != null && row["FoodCount"].ToString() != "") { model.FoodCount = int.Parse(row["FoodCount"].ToString()); } if (row["IsGroup"] != null && row["IsGroup"].ToString() != "") { if ((row["IsGroup"].ToString() == "1") || (row["IsGroup"].ToString().ToLower() == "true")) { model.IsGroup = true; } else { model.IsGroup = false; } } if (row["QRcodeUrl"] != null) { model.QRcodeUrl = row["QRcodeUrl"].ToString(); } if (row["Bus"] != null) { model.Bus = row["Bus"].ToString(); } if (row["MinPrice"] != null && row["MinPrice"].ToString() != "") { model.MinPrice = decimal.Parse(row["MinPrice"].ToString()); } if (row["MaxPrice"] != null && row["MaxPrice"].ToString() != "") { model.MaxPrice = decimal.Parse(row["MaxPrice"].ToString()); } if (row["CarPark"] != null && row["CarPark"].ToString() != "") { if ((row["CarPark"].ToString() == "1") || (row["CarPark"].ToString().ToLower() == "true")) { model.CarPark = true; } else { model.CarPark = false; } } if (row["Box"] != null && row["Box"].ToString() != "") { if ((row["Box"].ToString() == "1") || (row["Box"].ToString().ToLower() == "true")) { model.Box = true; } else { model.Box = false; } } if (row["PayCar"] != null && row["PayCar"].ToString() != "") { if ((row["PayCar"].ToString() == "1") || (row["PayCar"].ToString().ToLower() == "true")) { model.PayCar = true; } else { model.PayCar = false; } } if (row["WIFI"] != null && row["WIFI"].ToString() != "") { if ((row["WIFI"].ToString() == "1") || (row["WIFI"].ToString().ToLower() == "true")) { model.WIFI = true; } else { model.WIFI = false; } } if (row["NoSmoke"] != null && row["NoSmoke"].ToString() != "") { if ((row["NoSmoke"].ToString() == "1") || (row["NoSmoke"].ToString().ToLower() == "true")) { model.NoSmoke = true; } else { model.NoSmoke = false; } } if (row["ChildrenChair"] != null && row["ChildrenChair"].ToString() != "") { if ((row["ChildrenChair"].ToString() == "1") || (row["ChildrenChair"].ToString().ToLower() == "true")) { model.ChildrenChair = true; } else { model.ChildrenChair = false; } } if (row["SendDesc"] != null) { model.SendDesc = row["SendDesc"].ToString(); } if (row["TakeRange"] != null && row["TakeRange"].ToString() != "") { model.TakeRange = decimal.Parse(row["TakeRange"].ToString()); } if (row["KCVIP"] != null && row["KCVIP"].ToString() != "") { if ((row["KCVIP"].ToString() == "1") || (row["KCVIP"].ToString().ToLower() == "true")) { model.KCVIP = true; } else { model.KCVIP = false; } } if (row["Onlineorder"] != null && row["Onlineorder"].ToString() != "") { model.Onlineorder = int.Parse(row["Onlineorder"].ToString()); } } return model; }