Exemplo n.º 1
0
 protected bool Save()
 {
     if (!this.Validata()) return false;
     LAnnounceData model = new LAnnounceData();
     LAnnounceBB announceBB = new LAnnounceBB();
     try
     {
         if (this.State == "1")
         {
             this.SetModel(ref model);
             this.IdValue = announceBB.AddRecord(model);
         }
         else if (this.State == "2")
         {
             model = announceBB.GetModel(this.IdValue);
             this.SetModel(ref model);
             announceBB.ModifyRecord(model);
         }
         return true;
     }
     catch (Exception ex)
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
         return false;
     }
     finally
     {
         announceBB.Dispose();
     }
 }