protected void SaveRecord(bool newRecord) { // new record / exiting record // object oldEntity = null; if (newRecord) { Entity = new CRM_Family(); db.CRM_Families.InsertOnSubmit(Entity); } else { oldEntity = Entity.ShallowCopy(); } Entity.Name = txtName.Text; db.SubmitChanges(); if (oldEntity != null) { CRM.Code.History.History.RecordLinqUpdate(AdminUser, oldEntity, Entity); db.SubmitChanges(); } else { CRM.Code.History.History.RecordLinqInsert(AdminUser, Entity); } }
protected void Page_Load(object sender, EventArgs e) { Entity = db.CRM_Families.SingleOrDefault(o => o.ID.ToString() == Request.QueryString["id"]); // buttons // btnDelete.EventHandler = btnDelete_Click; btnSubmit.EventHandler = btnSubmit_Click; btnSubmitChanges.EventHandler = btnSubmitChanges_Click; ucLogHistory.IHistory = Entity; ucLogNotes.INotes = Entity; ucACFamily.EventHandler = lnkSelect_Click; ucACFamily.Config = new AutoCompleteConfig(JSONSet.DataSets.person); ucFamilyPersons.Type = typeof(CRM_FamilyPerson); if (Entity != null) { PopulateFields(); PopulateFamilyList(); } else { ucFamilyPersons.Visible = false; } // confirmations // confirmationDelete.StandardDeleteHidden("family record", btnRealDelete_Click); }