블로그 이미지
Magic_kit
study 관련자료를 한곳으로 자기 개발 목적으로 재태크 재무 관리 목적으로 일상생활의 팁을 공유 하기 위하여 블로그를 개설 하였습니다.

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Category

Recent Post

Recent Comment

Archive

2009. 10. 27. 02:32 .Net Project/ASP.NET 3.5 Sp1
반응형
ReplyDelete.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Delete.aspx.cs"
         Inherits
="Reply_Delete" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <h3> 삭제</h3>

        <div>

            <asp:Label ID="lblNum" runat="server"
                 ForeColor
="Red"></asp:Label>

             글을 삭제하시겠습니까?<br />

            암호 :

            <asp:TextBox ID="txtPassword" runat="server"
                 TextMode
="Password"></asp:TextBox>

            <asp:Button ID="btnDelete" runat="server" Text="삭제"

                onclick="btnDelete_Click1" />

            <br />

            <asp:Label ID="lblError" runat="server"
                 ForeColor
="Red"></asp:Label>

        </div>

    </div>

    </form>

</body>

</html>


ReplyDelete.Cs 
using System;

using Reply.Bsl;

using Reply.Entity;

 

public partial class Reply_Delete : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        // 넘겨져 번호 검사

        if (String.IsNullOrEmpty(Request["Num"]))

        {

 

            Response.Write("잘못된 요청입니다.");

            Response.End();

 

        }

        else

        {

            // 레이블에 넘겨져 번호 출력

            this.lblNum.Text = Request["Num"];

        }

    }

 

    protected void btnDelete_Click1(object sender, EventArgs e)

    {

        ReplyBiz rb = new ReplyBiz(); // 트랜잭션 처리 클래스에서 객체 생성

 

        ReplyEntity re = rb.SelectReplyByNum
                         (
Convert.ToInt32(Request["Num"]));

 

        int result = rb.DeleteReply
                     (
Convert.ToInt32(Request["Num"]), txtPassword.Text);

        if (result == -1)

        {

            lblError.Text = "암호가 틀립니다.";

        }

        else

        {

            Response.Redirect("List.aspx");

        }

    }

} 







반응형
posted by Magic_kit