protected void Page_Load(object sender, EventArgs e) { RunSecurity(CRM.Code.Models.Admin.AllowedSections.NotSet); int id = 0; if (int.TryParse(Request.QueryString["id"], out id)) { Entity = db.CRM_AttendanceEvents.FirstOrDefault(a => a.ID == id); } // buttons // btnDelete.EventHandler = btnDelete_Click; btnSubmit.EventHandler = btnSubmit_Click; btnSubmitChanges.EventHandler = btnSubmitChanges_Click; confirmationDelete.StandardDeleteHidden("Attendance Event", btnRealDelete_Click); if (!Page.IsPostBack) { if (Entity != null) { PopulateFields(); } } }
protected void SaveRecord(bool newRecord) { if (newRecord) { Entity = new CRM_AttendanceEvent(); db.CRM_AttendanceEvents.InsertOnSubmit(Entity); } Entity.Name = txtName.Text; db.SubmitChanges(); }