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_AttendancePersonTypes.FirstOrDefault(a => a.ID == id); } // buttons // btnDelete.EventHandler = btnDelete_Click; btnSubmit.EventHandler = btnSubmit_Click; btnSubmitChanges.EventHandler = btnSubmitChanges_Click; btnReinstate.EventHandler = btnReinstate_Click; confirmationDelete.StandardDeleteHidden("Attendance Type", btnRealDelete_Click); if (!Page.IsPostBack) { if (Entity != null) { PopulateFields(); } } }
protected void SaveRecord(bool newRecord) { if (newRecord) { Entity = new CRM_AttendancePersonType(); Entity.OrderNo = Ordering.GetNextOrderID(db.CRM_AttendancePersonTypes); Entity.IsArchived = false; db.CRM_AttendancePersonTypes.InsertOnSubmit(Entity); } Entity.Name = txtName.Text; Entity.IsActive = chkIsActive.Checked; db.SubmitChanges(); }