Пример #1
0
Файл: BBS.cs Проект: youye00/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);
    }
Пример #2
0
        protected void DelReplay(object sender, System.EventArgs e)
        {
            BBSClass  bbsclass = new BBSClass();
            BBSReplay replay   = new BBSReplay();

            replay.ReplayId = Int32.Parse(((LinkButton)sender).CommandArgument.ToString());
            replay.ItemID   = itemid;
            try
            {
                replay.DelAttachment(Server.MapPath(".") + "\\Attachment\\");
                bbsclass.DelReplay(replay);
                BindData();
                Content.Value = "";
            }
            catch (Exception ex)
            {
                UDS.Components.Error.Log(ex.ToString());
                Server.Transfer("../../Error.aspx");
            }
        }
Пример #3
0
 protected void DelReplay(object sender,System.EventArgs e)
 {
     BBSClass bbsclass = new BBSClass();
     BBSReplay replay = new BBSReplay();
     replay.ReplayId = Int32.Parse(((LinkButton)sender).CommandArgument.ToString());
     replay.ItemID = itemid;
     try
     {
         replay.DelAttachment(Server.MapPath(".")+"\\Attachment\\");
         bbsclass.DelReplay(replay);
         BindData();
         Content.Value = "";
     }
     catch(Exception ex)
     {
         UDS.Components.Error.Log(ex.ToString());
         Server.Transfer("../../Error.aspx");
     }
 }
Пример #4
0
Файл: BBS.cs Проект: 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);
 }
Пример #5
0
    /// <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();
            }
        }
    }