Example #1
0
        public List <CSBAdWord> GetAdWords()
        {
            List <CSBAdWord> adWords = new List <CSBAdWord>();

            SqlConnection sqlConnection = new SqlConnection();

            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            try
            {
                sqlConnection.Command.CommandText = "SELECT hitbl_FilterAdWords_FAW.*, hitbl_FilterAdCampaigns_FAC.FAC_Company FROM hitbl_FilterAdWords_FAW JOIN hitbl_FilterAdCampaigns_FAC ON hitbl_FilterAdWords_FAW.FAW_CampaignId = hitbl_FilterAdCampaigns_FAC.FAC_ID ORDER BY FAW_Word";
                sqlDataReader = sqlConnection.Command.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    CSBAdWord adWord = new CSBAdWord();
                    adWord.AdWordId            = (Guid)sqlDataReader["FAW_ID"];
                    adWord.Word                = (string)sqlDataReader["FAW_Word"];
                    adWord.IsExact             = (bool)sqlDataReader["FAW_IsExactMatch"];
                    adWord.Action              = (AdWordFilterActions)Enum.Parse(typeof(AdWordFilterActions), sqlDataReader["FAW_Action"].ToString());
                    adWord.CampaignId          = (Guid)sqlDataReader["FAW_CampaignId"];
                    adWord.CampaignDescription = (string)sqlDataReader["FAC_Company"];
                    adWords.Add(adWord);
                }
            }
            catch (Exception e)
            {
                throw new SoapException("Anfrage konnte nicht bearbeitet werden -> " + e.Message, SoapException.ServerFaultCode);
            }
            finally
            {
                try { sqlDataReader.Close(); }
                finally { sqlConnection.Close(); }
            }

            return(adWords);
        }
Example #2
0
        public bool SaveAdWord(CSBAdWord adWord)
        {
            SqlConnection sqlConnection = new SqlConnection();

            try
            {
                sqlConnection.Command.CommandText = "hisp_Filter_AdWords_Save";
                sqlConnection.Command.CommandType = CommandType.StoredProcedure;
                sqlConnection.Command.Parameters.Add("@WordId", SqlDbType.UniqueIdentifier);
                sqlConnection.Command.Parameters["@WordId"].Value = adWord.AdWordId;
                sqlConnection.Command.Parameters.Add("@Word", SqlDbType.NVarChar);
                sqlConnection.Command.Parameters["@Word"].Value = adWord.Word;
                sqlConnection.Command.Parameters.Add("@IsExact", SqlDbType.Bit);
                sqlConnection.Command.Parameters["@IsExact"].Value = adWord.IsExact;
                sqlConnection.Command.Parameters.Add("@Action", SqlDbType.NVarChar);
                sqlConnection.Command.Parameters["@Action"].Value = adWord.Action.ToString();
                sqlConnection.Command.Parameters.Add("@CampaignId", SqlDbType.UniqueIdentifier);
                sqlConnection.Command.Parameters["@CampaignId"].Value = adWord.CampaignId;
                sqlConnection.Command.ExecuteNonQuery();
                return(true);
            }
            catch
            {
                return(false);
            }
            finally { sqlConnection.Close(); }
        }
Example #3
0
 public bool SaveAdWord(CSBAdWord adWord)
 {
     if (authHeader != null)
     {
         return(adCampaigns.SaveAdWord(adWord));
     }
     else
     {
         throw new Exception("No authentication header found!");
     }
 }