Ejemplo n.º 1
0
 public static KeyWord LoadKeyWord(IDataReader reader)
 {
     KeyWord kw = new KeyWord();
     kw.Id = ReadInt32(reader, "KeyWordID");
     kw.BlogId = ReadInt32(reader, "BlogId");
     kw.OpenInNewWindow = (bool)reader["OpenInNewWindow"];
     kw.ReplaceFirstTimeOnly = (bool)reader["ReplaceFirstTimeOnly"];
     kw.CaseSensitive = (bool)reader["CaseSensitive"];
     kw.Text = ReadString(reader, "Text");
     kw.Rel = ReadString(reader, "Rel");
     if(reader["Title"] != DBNull.Value)
     {
         kw.Title = CheckNullString(reader["Title"]);
     }
     kw.Url = ReadString(reader, "Url");
     kw.Word = ReadString(reader, "Word");
     return kw;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Preforms a forward scan and replace for a given pattern. 
 /// Can specify only to match first fine and if the pattern is CaseSensitive
 /// </summary>
 private static string ReplaceFormat(string source, KeyWord keyword)
 {
     return Scan(source, keyword.Word, keyword.GetFormat, true, keyword.ReplaceFirstTimeOnly,
                 keyword.CaseSensitive);
 }
Ejemplo n.º 3
0
 public abstract int InsertKeyWord(KeyWord keyWord);
Ejemplo n.º 4
0
 public abstract bool UpdateKeyWord(KeyWord keyWord);
Ejemplo n.º 5
0
 public void CanSetAndGetSimpleProperties()
 {
     var keyword = new KeyWord();
     UnitTestHelper.AssertSimpleProperties(keyword);
 }
 public void Create(int index)
 {
     KeyWord keyword = new KeyWord();
     keyword.BlogId = Config.CurrentBlog.Id;
     keyword.Text = "The Keyword" + index;
     keyword.Title = "Blah";
     keyword.Word = "The Word " + index;
     keyword.Rel = "Rel" + index;
     keyword.Url = "http://localhost/";
     KeyWords.CreateKeyWord(keyword);
 }
Ejemplo n.º 7
0
 public override bool UpdateKeyWord(KeyWord keyWord)
 {
     return _procedures.UpdateKeyWord(keyWord.Id,
                                      keyWord.Word,
                                      keyWord.Rel,
                                      keyWord.Text,
                                      keyWord.ReplaceFirstTimeOnly,
                                      keyWord.OpenInNewWindow,
                                      keyWord.CaseSensitive,
                                      keyWord.Url,
                                      keyWord.Title,
                                      BlogId);
 }
Ejemplo n.º 8
0
        private void UpdateLink()
        {
            string successMessage = Constants.RES_SUCCESSNEW;

            try
            {
                KeyWord kw = new KeyWord();

                kw.Title = txbTitle.Text;
                kw.Url = txbUrl.Text;
                kw.Text = txbText.Text;
                kw.OpenInNewWindow = chkNewWindow.Checked;
                kw.ReplaceFirstTimeOnly = chkFirstOnly.Checked;
                kw.CaseSensitive = chkCaseSensitive.Checked;
                kw.Rel = txbRel.Text;
                kw.Word = txbWord.Text;

                if (KeyWordID > 0)
                {
                    successMessage = Constants.RES_SUCCESSEDIT;
                    kw.Id = KeyWordID;
                    KeyWords.UpdateKeyWord(kw);
                }
                else
                {
                    KeyWordID = KeyWords.CreateKeyWord(kw);
                }

                if (KeyWordID > 0)
                {
                    BindList();
                    this.Messages.ShowMessage(successMessage);
                }
                else
                    this.Messages.ShowError(Constants.RES_FAILUREEDIT
                        + " There was a baseline problem posting your KeyWord.");
            }
            catch(Exception ex)
            {
                this.Messages.ShowError(String.Format(Constants.RES_EXCEPTION,
                    Constants.RES_FAILUREEDIT, ex.Message));
            }
            finally
            {
                Results.Visible = true;
            }
        }
Ejemplo n.º 9
0
        private void UpdateLink()
        {
            string successMessage = Constants.RES_SUCCESSNEW;

            try
            {
                var keyword = new KeyWord
                {
                    Title = txbTitle.Text,
                    Url = txbUrl.Text,
                    Text = txbText.Text,
                    ReplaceFirstTimeOnly = chkFirstOnly.Checked,
                    CaseSensitive = chkCaseSensitive.Checked,
                    Rel = txbRel.Text,
                    Word = txbWord.Text
                };

                if (KeyWordID > 0)
                {
                    successMessage = Constants.RES_SUCCESSEDIT;
                    keyword.Id = KeyWordID;
                    Repository.UpdateKeyWord(keyword);
                }
                else
                {
                    KeyWordID = Repository.InsertKeyWord(keyword);
                }

                if (KeyWordID > 0)
                {
                    BindList();
                    Messages.ShowMessage(successMessage);
                }
                else
                {
                    Messages.ShowError(Constants.RES_FAILUREEDIT
                                       + " There was a baseline problem posting your KeyWord.");
                }
            }
            catch (Exception ex)
            {
                Messages.ShowError(String.Format(Constants.RES_EXCEPTION,
                                                 Constants.RES_FAILUREEDIT, ex.Message));
            }
            finally
            {
                Results.Visible = true;
            }
        }
Ejemplo n.º 10
0
 public override bool UpdateKeyWord(KeyWord keyWord)
 {
     return DbProvider.Instance().UpdateKeyWord(keyWord);
 }
Ejemplo n.º 11
0
 public override int InsertKeyWord(KeyWord keyWord)
 {
     return DbProvider.Instance().InsertKeyWord(keyWord);
 }
Ejemplo n.º 12
0
		public static int CreateKeyWord(KeyWord kw)
		{
			return ObjectProvider.Instance().InsertKeyWord(kw);
		}
Ejemplo n.º 13
0
		public static void UpdateKeyWord(KeyWord kw)
		{
			ObjectProvider.Instance().UpdateKeyWord(kw);
		}