Beispiel #1
0
 protected void btnAddRecord_Click(object sender, EventArgs e)
 {
     tblSection objtblSection = new tblSection()
     {
         SectionName = txtSectionName.Text,
         Description = txtDescription.Text,
         IsActive = chkStatus.Checked
     };
     objAdamEntities.tblSections.AddObject(objtblSection);
     if (objAdamEntities.SaveChanges() == 1)
     {
         BindGrid();
         System.Text.StringBuilder sb = new System.Text.StringBuilder();
         sb.Append(@"<script type='text/javascript'>");
         sb.Append("alert('Record Added Successfully');");
         sb.Append("$('#addModal').modal('hide');");
         sb.Append(@"</script>");
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AddHideModalScript", sb.ToString(), false);
     }
     else
     {
     //todo
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the tblSections EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblSections(tblSection tblSection)
 {
     base.AddObject("tblSections", tblSection);
 }
 /// <summary>
 /// Create a new tblSection object.
 /// </summary>
 /// <param name="sectionId">Initial value of the SectionId property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 public static tblSection CreatetblSection(global::System.Int32 sectionId, global::System.Boolean isActive)
 {
     tblSection tblSection = new tblSection();
     tblSection.SectionId = sectionId;
     tblSection.IsActive = isActive;
     return tblSection;
 }