public static int Insert(MySearch s) { DBAccess db = new DBAccess(); db.AddParameter("@sSearchCriteria", s.Criteria); db.AddParameter("@iCountryID", s.CountryID); db.AddParameter("@iStateID", s.StateID); db.AddParameter("@iCity", s.City); db.AddParameter("@sUserName", s.UserName); SqlParameter p = new SqlParameter("@iMySearchID", SqlDbType.Int); p.Direction = ParameterDirection.Output; db.AddParameter(p); int retval = db.ExecuteNonQuery("JobsDb_MySearches_Insert"); if (retval == 1) { return(int.Parse(p.Value.ToString())); } else { return(-1); } }
public static int Delete(MySearch s) { DBAccess db = new DBAccess(); db.AddParameter("@iMySearchID", s.MySearchID); return(db.ExecuteNonQuery("JobsDb_MySearches_Delete")); }
public static MySearch GetMySearch(int mysearchid) { DBAccess db = new DBAccess(); db.AddParameter("@iMySearchID", mysearchid); SqlDataReader dr = (SqlDataReader)db.ExecuteReader("JobsDb_MySearches_SelectOne"); if (dr.HasRows) { MySearch s = new MySearch(); while (dr.Read()) { s.MySearchID = dr.GetInt32(dr.GetOrdinal("mysearchid")); s.Criteria = dr.GetString(dr.GetOrdinal("SearchCriteria")); s.CountryID = dr.GetInt32(dr.GetOrdinal("CountryID")); s.StateID = dr.GetInt32(dr.GetOrdinal("StateID")); s.City = dr.GetString(dr.GetOrdinal("City")); s.UserName = dr.GetString(dr.GetOrdinal("UserName")); } dr.Close(); return(s); } else { return(null); } }
protected void ImageButton3_Click(object sender, ImageClickEventArgs e) { MySearch s = new MySearch(); s.Criteria = txtSkills.Text; s.CountryID = int.Parse(ddlCountry.SelectedValue); s.StateID = int.Parse(ddlState.SelectedValue); s.City = txtCity.Text; s.UserName = Profile.UserName; MySearch.Insert(s); }
public static int Insert(MySearch s) { DBAccess db = new DBAccess(); db.AddParameter("@sSearchCriteria", s.Criteria); db.AddParameter("@iCountryID", s.CountryID); db.AddParameter("@iStateID", s.StateID); db.AddParameter("@iCity", s.City); db.AddParameter("@sUserName", s.UserName); SqlParameter p = new SqlParameter("@iMySearchID", SqlDbType.Int); p.Direction = ParameterDirection.Output; db.AddParameter(p); int retval=db.ExecuteNonQuery("JobsDb_MySearches_Insert"); if (retval == 1) { return int.Parse(p.Value.ToString()); } else { return -1; } }
public static MySearch GetMySearch(int mysearchid) { DBAccess db = new DBAccess(); db.AddParameter("@iMySearchID", mysearchid); SqlDataReader dr = (SqlDataReader)db.ExecuteReader("JobsDb_MySearches_SelectOne"); if (dr.HasRows) { MySearch s = new MySearch(); while (dr.Read()) { s.MySearchID = dr.GetInt32(dr.GetOrdinal("mysearchid")); s.Criteria = dr.GetString(dr.GetOrdinal("SearchCriteria")); s.CountryID = dr.GetInt32(dr.GetOrdinal("CountryID")); s.StateID = dr.GetInt32(dr.GetOrdinal("StateID")); s.City = dr.GetString(dr.GetOrdinal("City")); s.UserName = dr.GetString(dr.GetOrdinal("UserName")); } dr.Close(); return s; } else { return null; } }
public static int Delete(MySearch s) { DBAccess db = new DBAccess(); db.AddParameter("@iMySearchID", s.MySearchID); return db.ExecuteNonQuery("JobsDb_MySearches_Delete"); }