protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string idValue = Request.Params["id"];
         if (idValue != null)
         {
             int id = Convert.ToInt32(idValue);
             LMessageSortBB messageSortBB = new LMessageSortBB();
             try
             {
                 LMessageSortData messageSortData = new LMessageSortData();
                 messageSortData = messageSortBB.GetModel(id);
                 //����й��������˴�Ҫ��֤�Ƿ�����ɾ��
                 messageSortBB.DeleteRecord(id);
                 this.ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
             }
             catch (Exception ex)
             {
                 this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3)", true);
                 return;
             }
             finally
             {
                 messageSortBB.Dispose();
             }
         }
     }
 }
Пример #2
0
    /// <summary>
    /// ���ݱ���
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        LMessageSortData model = new LMessageSortData();
        LMessageSortBB messageSortBB = new LMessageSortBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                this.IdValue = messageSortBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = messageSortBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                messageSortBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            messageSortBB.Dispose();
        }

        Response.Redirect("LMessageSortList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main", false);
    }
 /// <summary>
 /// չʾ����
 /// </summary>
 /// <param name="id">��¼Id</param>
 private void ShowInfo(int id)
 {
     LMessageSortBB messageSortBB = new LMessageSortBB();
     LMessageSortData model = new LMessageSortData();
     try
     {
         model = messageSortBB.GetModel(id);
         this.sortNm.Text = model.sortNm;
     }
     finally
     {
         messageSortBB.Dispose();
     }
 }