public DataTable getWebsites(BALCampaignDetails obj) { try { SqlConnection cn = new SqlConnection(strcon); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand("ProCampaignDetails", cn); da.SelectCommand.Parameters.Clear(); da.SelectCommand.Parameters.AddWithValue("@Action", obj._Action); da.SelectCommand.CommandType = CommandType.StoredProcedure; cn.Open(); da.SelectCommand.ExecuteReader(); DataTable dt = new DataTable(); cn.Close(); da.Fill(dt); if (dt != null) { return(dt); } else { return(null); } } catch (Exception) { return(null); } }
public int InsertBlockWebDetails(BALCampaignDetails obj) { try { SqlConnection cn = new SqlConnection(strcon); SqlDataAdapter da = new SqlDataAdapter(); da.InsertCommand = new SqlCommand("ProCampaignDetails", cn); da.InsertCommand.Parameters.Clear(); da.InsertCommand.Parameters.AddWithValue("@Action", obj._Action); da.InsertCommand.Parameters.AddWithValue("@campid", obj._CampId); da.InsertCommand.Parameters.AddWithValue("@websiteName", obj._WebSiteName); da.InsertCommand.CommandType = CommandType.StoredProcedure; cn.Open(); int a = da.InsertCommand.ExecuteNonQuery(); cn.Close(); return(a); if (a != 0) { return(1); } else { return(0); } } catch (Exception ex) { return(0); } }