示例#1
0
    private void CheckTag()
    {
        DataTable dt = new DataTable();

        condition = DataExtension.AndConditon(GroupsItemsTSql.GetGroupsItemsByIid(iid), GroupsTSql.GetGroupsByVgapp(app));
        dt        = GroupsItems.GetAllData("", "groups.igid", condition, "");

        string listIgid = ",";

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            listIgid += dt.Rows[i][GroupsColumns.IgidColumn].ToString() + ",";
        }

        for (int i = 0; i < cblListTag.Items.Count; i++)
        {
            if (listIgid.IndexOf("," + cblListTag.Items[i].Value + ",") > -1)
            {
                cblListTag.Items[i].Selected = true;
            }
            else
            {
                cblListTag.Items[i].Selected = false;
            }
        }
    }
    /// <summary>
    /// Hiện thị các tag cho 1 blog
    /// </summary>
    /// <param name="iid"></param>
    /// <returns></returns>
    private static string ShowTags(string iid)
    {
        string s = "";

        string condition = DataExtension.AndConditon(
            GroupsItemsTSql.GetGroupsItemsByIid(iid),
            GroupsTSql.GetGroupsByVgapp(TatThanhJsc.OtherModul.CodeApplications.Tag));
        DataTable dt = GroupsItems.GetAllData("", "groups.*", condition, GroupsColumns.IgorderColumn);

        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                s += "<a href='" + (UrlExtension.WebisteUrl + RewriteExtension.Tag + "/" + dt.Rows[i][GroupsColumns.VGSEOLINKSEARCHColumn] + RewriteExtension.Extensions).ToLower() + "' title='" + dt.Rows[i][GroupsColumns.VgnameColumn] + @"'>" + dt.Rows[i][GroupsColumns.VgnameColumn] + @"</a>, ";
            }
            s = s.Remove(s.Length - ", ".Length);
        }
        return(s);
    }
    private void CheckOtherIgid(string iid)
    {
        DataTable dt = GroupsItems.GetGroupsItems("", GroupsItemsColumns.IgidColumn,
                                                  GroupsItemsTSql.GetGroupsItemsByIid(iid), "");

        string listigid = ",";

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            listigid += dt.Rows[i][GroupsColumns.IgidColumn].ToString() + ",";
        }
        //hdIgid.Value = listigid;
        foreach (ListItem item in cbListCates.Items)
        {
            if (listigid.IndexOf("," + item.Value + ",") > -1)
            {
                item.Selected = true;
            }
        }
    }
示例#4
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        //Xoá các bản ghi trong groups_items có vgapp là TatThanhJsc.OtherModul.CodeApplications.Tag
        DataTable dt = new DataTable();

        condition = DataExtension.AndConditon(GroupsItemsTSql.GetGroupsItemsByIid(iid), GroupsTSql.GetGroupsByVgapp(app));
        dt        = GroupsItems.GetAllData("", GroupsItemsColumns.IgiidColumn, condition, "");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            //Response.Write(dt.Rows[i][GroupsItemsColumns.IgiidColumn].ToString());
            GroupsItems.DeleteGroupsItems(GroupsItemsTSql.GetGroupsItemsByIgiid(dt.Rows[i][GroupsItemsColumns.IgiidColumn].ToString()));
        }

        //Thêm các bản ghi vào groups_items
        for (int i = 0; i < cblListTag.Items.Count; i++)
        {
            if (cblListTag.Items[i].Selected)
            {
                GroupsItems.InsertGroupsItems(cblListTag.Items[i].Value, iid, "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "0");
            }
        }

        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('Đã lưu tag');window.close();", true);
    }