Beispiel #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();
            }
        }
    }
    private void SaveTags(int iPostID)
    {
        string[] strTags = txtPostTags.Text.Split(',');
        for (int i = 0; i < strTags.Length; i++)
        {
            if (strTags[i].Trim() != "")
            {
                string code = BSHelper.CreateCode(strTags[i].Trim());
                string name = strTags[i].Trim();

                BSTerm bsTerm = BSTerm.GetTerm(code, TermTypes.Tag);
                if (bsTerm == null)
                {
                    bsTerm      = new BSTerm();
                    bsTerm.Name = name;
                    bsTerm.Code = code;
                    bsTerm.Type = TermTypes.Tag;
                    bsTerm.Save();
                }

                bsTerm.Objects.Add(iPostID);
                bsTerm.Save();
            }
        }
    }
Beispiel #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string TermID  = Request.QueryString["TermID"];
        int    iTermID = 0;

        int.TryParse(TermID, out iTermID);

        if (!String.IsNullOrEmpty(txtCatName.Text.Trim()) && iTermID > 0)
        {
            BSTerm bsTerm = BSTerm.GetTerm(iTermID);
            bsTerm.Name        = txtCatName.Text;
            bsTerm.Description = txtCatDescription.Text;
            bsTerm.Code        = BSHelper.CreateCode(txtCatName.Text);
            //term.SubID = int.Parse(ddlParentCategory.SelectedValue);

            if (bsTerm.Save())
            {
                MessageBox1.Message = Language.Admin["CategorySaved"];
                MessageBox1.Type    = MessageBox.ShowType.Information;
                gvItems.DataBind();
                txtName.Text        = string.Empty;
                txtDescription.Text = string.Empty;
            }
            else
            {
                MessageBox1.Message = Language.Admin["CategoryError"];
            }
        }
        else
        {
            Response.Redirect("Categories.aspx");
        }
    }
Beispiel #4
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (txtName.Text.Trim() != "")
        {
            BSTerm bsTerm = new BSTerm();
            bsTerm.Name        = txtName.Text;
            bsTerm.Description = txtDescription.Text;
            bsTerm.Type        = BSTerm.GetTermType(CategoryType);
            bsTerm.Code        = BSHelper.CreateCode(bsTerm.Name);

            bsTerm.SubID = int.Parse(ddlParentCategory.SelectedValue);

            if (bsTerm.Save())
            {
                MessageBox1.Message = Language.Admin["CategorySaved"];
                MessageBox1.Type    = MessageBox.ShowType.Information;
                gvItems.DataBind();
                txtName.Text        = string.Empty;
                txtDescription.Text = string.Empty;
            }
            else
            {
                MessageBox1.Message = Language.Admin["CategoryError"];
            }
        }
    }
Beispiel #5
0
    private void SaveTags(int iPostID)
    {
        string[] strTags = txtPostTags.Text.Split(',');
        for (int i = 0; i < strTags.Length; i++)
        {
            if (strTags[i].Trim() != "")
            {
                string code = BSHelper.CreateCode(strTags[i].Trim());
                string name = strTags[i].Trim();

                BSTerm bsTerm = BSTerm.GetTerm(code, TermTypes.Tag);
                if (bsTerm== null)
                {
                    bsTerm = new BSTerm();
                    bsTerm.Name = name;
                    bsTerm.Code = code;
                    bsTerm.Type = TermTypes.Tag;
                    bsTerm.Save();
                }

                bsTerm.Objects.Add(iPostID);
                bsTerm.Save();
            }
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int iTermID = 0;

        int.TryParse(Request["TermID"], out iTermID);

        if (iTermID > 0)
        {
            BSTerm bsTerm = BSTerm.GetTerm(iTermID);

            bsTerm.Name = txtCatName.Text;
            bsTerm.Code = BSHelper.CreateCode(txtCatName.Text);
            if (bsTerm.Save())
            {
                MessageBox1.Message = Language.Admin["TagSaved"];
                MessageBox1.Type    = MessageBox.ShowType.Information;
                gvItems.DataBind();
                txtName.Text = string.Empty;
            }
            else
            {
                MessageBox1.Message = "Error";
            }
        }
        else
        {
            Response.Redirect("Categories.aspx");
        }
    }
Beispiel #7
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();
             }
         }
     }
 }
Beispiel #9
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (txtName.Text.Trim() != "")
        {
            BSTerm bsTerm = new BSTerm();
            bsTerm.Name = txtName.Text;
            bsTerm.Description = txtDescription.Text;
            bsTerm.Type = BSTerm.GetTermType(CategoryType);
            bsTerm.Code = BSHelper.CreateCode(bsTerm.Name);

            bsTerm.SubID = int.Parse(ddlParentCategory.SelectedValue);

            if (bsTerm.Save())
            {
                MessageBox1.Message = Language.Admin["CategorySaved"];
                MessageBox1.Type = MessageBox.ShowType.Information;
                gvItems.DataBind();
                txtName.Text = string.Empty;
                txtDescription.Text = string.Empty;
            }
            else
                MessageBox1.Message = Language.Admin["CategoryError"];
        }
    }