Exemplo n.º 1
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            tbl_Search.Visible  = false;
            dgrd_Result.Visible = true;

            SqlDataReader dr_result = null;

            UDS.Components.BBSClass bbs    = new UDS.Components.BBSClass();
            BBSSearchOption         option = new BBSSearchOption();

            option.searchtype = (rbtn_author.Checked)?BBSSearchType.author:BBSSearchType.title;
            switch (ddl_Time.SelectedValue)
            {
            case "0":
                option.TimeBound = TimeSpan.MaxValue;
                break;

            case "d":
                option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim() == "")?"1":tbx_Time.Text.Trim()), 0, 0, 0);
                break;

            case "w":
                option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim() == "")?"1":tbx_Time.Text.Trim()) * 7, 0, 0, 0);
                break;

            case "m":
                option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim() == "")?"1":tbx_Time.Text.Trim()) * 30, 0, 0, 0);
                break;

            case "y":
                option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim() == "")?"1":tbx_Time.Text.Trim()) * 365, 0, 0, 0);
                break;
            }

            option.BoardID = Int32.Parse(dll_Board.SelectedValue);

            UDS.Components.BBSClass bbs1 = new UDS.Components.BBSClass();
            if (Request.Cookies["UDSBBSAdmin"].Value == "1")
            {
                dr_board = bbs1.GetAllBBSBoard();
            }
            else
            {
                dr_board = bbs1.GetBBSBoard(Request.Cookies["UserName"].Value);
            }

            dr_result = bbs.Find(tbx_Key.Text.Trim(), option, UDS.Components.Tools.ConvertDataReaderToDataTable(dr_board));
            DataTable dt_result = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_result);

            dgrd_Result.DataSource = dt_result.DefaultView;
            dgrd_Result.DataBind();
        }
Exemplo n.º 2
0
        private void BindBoard()
        {
            UDS.Components.BBSClass bbs = new UDS.Components.BBSClass();
            if(Request.Cookies["UDSBBSAdmin"].Value=="1")
                dll_Board.DataSource  = bbs.GetAllBBSBoard();
            else
                dll_Board.DataSource  = bbs.GetBBSBoard( Server.UrlDecode(Request.Cookies["UserName"].Value));

            dll_Board.DataTextField = "Board_Name";
            dll_Board.DataValueField = "Board_ID";
            dll_Board.DataBind();

            dll_Board.Items.Insert(0,new ListItem("ȫ����̳","0"));
        }
Exemplo n.º 3
0
        private void BindBoard()
        {
            UDS.Components.BBSClass bbs = new UDS.Components.BBSClass();
            if (Request.Cookies["UDSBBSAdmin"].Value == "1")
            {
                dll_Board.DataSource = bbs.GetAllBBSBoard();
            }
            else
            {
                dll_Board.DataSource = bbs.GetBBSBoard(Request.Cookies["UserName"].Value);
            }

            dll_Board.DataTextField  = "Board_Name";
            dll_Board.DataValueField = "Board_ID";
            dll_Board.DataBind();

            dll_Board.Items.Insert(0, new ListItem("全部论坛", "0"));
        }
Exemplo n.º 4
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            tbl_Search.Visible = false;
            dgrd_Result.Visible = true;

            SqlDataReader dr_result = null;
            UDS.Components.BBSClass bbs = new UDS.Components.BBSClass();
            BBSSearchOption option = new BBSSearchOption();
            option.searchtype = (rbtn_author.Checked)?BBSSearchType.author:BBSSearchType.title;
            switch(ddl_Time.SelectedValue)
            {
                case "0":
                    option.TimeBound = TimeSpan.MaxValue;
                    break;
                case "d":
                    option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim()=="")?"1":tbx_Time.Text.Trim()),0,0,0);
                    break;
                case "w":
                    option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim()=="")?"1":tbx_Time.Text.Trim())*7,0,0,0);
                    break;
                case "m":
                    option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim()=="")?"1":tbx_Time.Text.Trim())*30,0,0,0);
                    break;
                case "y":
                    option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim()=="")?"1":tbx_Time.Text.Trim())*365,0,0,0);
                    break;
            }

            option.BoardID = Int32.Parse(dll_Board.SelectedValue);

            UDS.Components.BBSClass bbs1 = new UDS.Components.BBSClass();
            if(Request.Cookies["UDSBBSAdmin"].Value=="1")
                dr_board  = bbs1.GetAllBBSBoard();
            else
                dr_board  = bbs1.GetBBSBoard( Server.UrlDecode(Request.Cookies["UserName"].Value));

            dr_result = bbs.Find(tbx_Key.Text.Trim(),option,UDS.Components.Tools.ConvertDataReaderToDataTable(dr_board));
            DataTable dt_result = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_result);
            dgrd_Result.DataSource = dt_result.DefaultView;
            dgrd_Result.DataBind();
        }
Exemplo n.º 5
0
Arquivo: BBS.cs Projeto: hoku85/UDS
 /// <summary>
 /// ɾ������
 /// </summary>
 public void DelAttachment(string attachmentmd)
 {
     UDS.Components.Database data = new UDS.Components.Database ();
     //ɾ�����лظ�����
     //�õ����лظ�
     UDS.Components.BBSClass bbs = new UDS.Components.BBSClass();
     SqlDataReader dr1 = null;
     dr1 = bbs.ReadBBSForumItemReplay(this);
     while(dr1.Read())
     {
         BBSReplay replay = new BBSReplay();
         replay.ReplayId = Int32.Parse(dr1["replay_id"].ToString());
         replay.DelAttachment(attachmentmd);
     }
     //ɾ�����ӱ������
     SqlParameter[] prams = {
                                data.MakeInParam("@itemid",  SqlDbType.Int, 4,this.ItemID),
     };
     SqlDataReader dr = null;
     data.RunProc ("sp_BBS_GetItemAttachment",prams,out dr);
     while(dr.Read())
     {
         System.IO.File.Delete(attachmentmd+"\\"+dr["filename"].ToString());
     }
     data.Close();
     SqlParameter[] prams1 = {
                                 data.MakeInParam("@itemid",  SqlDbType.Int, 4,this.ItemID),
     };
     data.RunProc("sp_BBS_DelAttachmentToItem",prams1);
 }
Exemplo n.º 6
0
Arquivo: BBS.cs Projeto: blfsir/benzoa
    /// <summary>
    /// 删除附件
    /// </summary>
    public void DelAttachment(string attachmentmd)
    {
        UDS.Components.Database data = new UDS.Components.Database();
        try
        {
            //删除所有回复附件
            //得到所有回复
            UDS.Components.BBSClass bbs = new UDS.Components.BBSClass();
            SqlDataReader dr1 = null;
            dr1 = bbs.ReadBBSForumItemReplay(this);
            try
            {
                while (dr1.Read())
                {
                    BBSReplay replay = new BBSReplay();
                    replay.ReplayId = Int32.Parse(dr1["replay_id"].ToString());
                    replay.DelAttachment(attachmentmd);
                }
            }
            finally
            {
                dr1.Close();
                dr1.Dispose();
            }
            //删除贴子本身附件
            SqlParameter[] prams = {
                                   data.MakeInParam("@itemid",  SqlDbType.Int, 4,this.ItemID),
        };
            SqlDataReader dr = null;
            try
            {
                data.RunProc("sp_BBS_GetItemAttachment", prams, out dr);
                while (dr.Read())
                {
                    System.IO.File.Delete(attachmentmd + "\\" + dr["filename"].ToString());
                }
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                    dr.Dispose();
                }
            }

            SqlParameter[] prams1 = {
                                    data.MakeInParam("@itemid",  SqlDbType.Int, 4,this.ItemID),
        };
            data.RunProc("sp_BBS_DelAttachmentToItem", prams1);
        }
        finally
        {
            if (data != null)
            {
                data.Close();
                data.Dispose();
            }
        }
    }