public void UpdateAdRecord(AdRecordInfo adRecord) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@page", SqlDbType.NVarChar) }; pt[0].Value = adRecord.ID; pt[1].Value = adRecord.Page; ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateAdRecord", pt); }
public static void UpdateAdRecord(AdRecordInfo adRecord) { AdRecordInfo info = ReadAdRecord(adRecord.ID, 0); dal.UpdateAdRecord(adRecord); if (adRecord.AdID != info.AdID) { AdBLL.ChangeAdCount(info.AdID, ChangeAction.Minus); AdBLL.ChangeAdCount(adRecord.AdID, ChangeAction.Plus); } }
public int AddAdRecord(AdRecordInfo adRecord) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@adID", SqlDbType.Int), new SqlParameter("@iP", SqlDbType.NVarChar), new SqlParameter("@date", SqlDbType.DateTime), new SqlParameter("@page", SqlDbType.NVarChar), new SqlParameter("@userID", SqlDbType.Int), new SqlParameter("@userName", SqlDbType.NVarChar) }; pt[0].Value = adRecord.AdID; pt[1].Value = adRecord.IP; pt[2].Value = adRecord.Date; pt[3].Value = adRecord.Page; pt[4].Value = adRecord.UserID; pt[5].Value = adRecord.UserName; return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddAdRecord", pt))); }
public void PrepareAdRecordModel(SqlDataReader dr, List <AdRecordInfo> adRecordList) { while (dr.Read()) { AdRecordInfo item = new AdRecordInfo(); item.ID = dr.GetInt32(0); item.AdID = dr.GetInt32(1); item.IP = dr[2].ToString(); item.Date = dr.GetDateTime(3); item.Page = dr[4].ToString(); item.UserID = dr.GetInt32(5); item.UserName = dr[6].ToString(); adRecordList.Add(item); } }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); string url = RequestHelper.GetQueryString <string>("URL"); AdRecordInfo adRecord = new AdRecordInfo(); adRecord.AdID = RequestHelper.GetQueryString <int>("AdID"); adRecord.IP = ClientHelper.IP; adRecord.Date = RequestHelper.DateNow; adRecord.Page = Request.ServerVariables["HTTP_REFERER"]; adRecord.UserID = base.UserID; adRecord.UserName = base.UserName; AdRecordBLL.AddAdRecord(adRecord); ResponseHelper.Redirect(url); }
public AdRecordInfo ReadAdRecord(int id, int userID) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.NVarChar), new SqlParameter("@userID", SqlDbType.Int) }; pt[0].Value = id; pt[1].Value = userID; AdRecordInfo info = new AdRecordInfo(); using (SqlDataReader reader = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadAdRecord", pt)) { if (reader.Read()) { info.ID = reader.GetInt32(0); info.AdID = reader.GetInt32(1); info.IP = reader[2].ToString(); info.Date = reader.GetDateTime(3); info.Page = reader[4].ToString(); info.UserID = reader.GetInt32(5); info.UserName = reader[6].ToString(); } } return(info); }
public static int AddAdRecord(AdRecordInfo adRecord) { adRecord.ID = dal.AddAdRecord(adRecord); AdBLL.ChangeAdCount(adRecord.AdID, ChangeAction.Plus); return(adRecord.ID); }