コード例 #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        SFileSaveTypeData model = new SFileSaveTypeData();
        SFileSaveTypeBB fileSaveTypeBB = new SFileSaveTypeBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                fileSaveTypeBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = fileSaveTypeBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                fileSaveTypeBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            fileSaveTypeBB.Dispose();
        }

        Response.Redirect("SFileSaveTypeList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main", false);
    }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             this.IdValue = Request.Params["id"];
         }
         if (Request.Params["state"] != null && Request.Params["state"].Trim() != string.Empty)
         {
             this.State = Request.Params["state"].ToString();
             switch (this.State)
             {
                 case "1":   //add
                     break;
                 case "2":   //update
                     //���ؿؼ�
                     SFileSaveTypeBB fileSaveTypeBB = new SFileSaveTypeBB();
                     SFileSaveTypeData fileSaveTypeData = new SFileSaveTypeData();
                     try
                     {
                         fileSaveTypeData = fileSaveTypeBB.GetModel(this.IdValue);
                         //����й��������˴�Ҫ��֤�Ƿ������޸�
                         this.ShowInfo(this.IdValue);
                     }
                     finally
                     {
                         fileSaveTypeBB.Dispose();
                     }
                     break;
                 default:
                     break;
             }
         }
     }
 }