protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string strAbuseResourceFileID = Request.Params["r"]; string strAbuseURL = Request.Params["url"]; Member member = (Member)Session["Member"]; if (strAbuseResourceFileID != null && member!=null) { if(strAbuseURL==null) { strAbuseURL = string.Empty; } Abuse abuse = new Abuse(); abuse.MemberID = member.MemberID; abuse.ResourceFileID = strAbuseResourceFileID; abuse.DTCreated = DateTime.Now; abuse.URL = strAbuseURL; abuse.Save(); AbuseCompleted = true; } } }
/// <summary> /// Takes an prepopulated IDataReader and creates an array of Abuses /// </summary> public static List<Abuse> PopulateObject(IDataReader dr) { ColumnFieldList list = new ColumnFieldList(dr); List<Abuse> arr = new List<Abuse>(); Abuse obj; while (dr.Read()) { obj = new Abuse(); if (list.IsColumnPresent("AbuseID")) { obj._abuseID = (int)dr["AbuseID"]; } if (list.IsColumnPresent("MemberID")) { obj._memberID = (int)dr["MemberID"]; } if (list.IsColumnPresent("ResourceFileID")) { obj._resourceFileID = (string)dr["ResourceFileID"]; } if (list.IsColumnPresent("URL")) { obj._uRL = (string)dr["URL"]; } if (list.IsColumnPresent("DTCreated")) { obj._dTCreated = (DateTime)dr["DTCreated"]; } arr.Add(obj); } dr.Close(); return arr; }