예제 #1
0
    public void SaveTags(int ObjectID)
    {
        string strTags = txtTags.Value;
        Regex  rex     = new Regex("\\{(.*?)\\}");

        BSTerm.RemoveTo(TermTypes.Tag, ObjectID);

        foreach (Match item in rex.Matches(strTags))
        {
            Regex  rx       = new Regex("'(.*?)'");
            string strText  = rx.Matches(item.Value)[1].Value;
            string strValue = rx.Matches(item.Value)[0].Value;

            strText  = strText.Substring(1, strText.Length - 2);
            strValue = strValue.Substring(1, strValue.Length - 2);

            string code = BSHelper.CreateCode(strText);

            BSTerm bsTerm = BSTerm.GetTerm(code, TermTypes.Tag);
            if (bsTerm == null)
            {
                bsTerm      = new BSTerm();
                bsTerm.Name = strText;
                bsTerm.Code = code;
                bsTerm.Type = TermTypes.Tag;
                bsTerm.Objects.Add(ObjectID);
                bsTerm.Save();
            }
            else
            {
                bsTerm.Objects.Add(ObjectID);
                bsTerm.Save();
            }
        }
    }
 public void SaveData(int ObjectID)
 {
     using (DataProcess dp = new DataProcess())
     {
         BSTerm.RemoveTo(TermTypes.Category, ObjectID);
         for (int i = 0; i < cblCats.Items.Count; i++)
         {
             if (cblCats.Items[i].Selected == true)
             {
                 BSTerm bsTerm = BSTerm.GetTerm(Convert.ToInt32(cblCats.Items[i].Value));
                 bsTerm.Objects.Add(ObjectID);
                 bsTerm.Save();
             }
         }
     }
 }