protected void SaveRecord(bool newRecord) { // new record / exiting record // object oldEntity = null; if (newRecord) { CRM_FundraisingGiftProfile = new CRM_FundraisingGiftProfile(); CRM_FundraisingGiftProfile.IsArchived = false; CRM_FundraisingGiftProfile.CRM_PersonID = Entity.ID; db.CRM_FundraisingGiftProfiles.InsertOnSubmit(CRM_FundraisingGiftProfile); } else { oldEntity = CRM_FundraisingGiftProfile.ShallowCopy(); } CRM_FundraisingGiftProfile.ProfileName = txtName.Text; CRM_FundraisingGiftProfile.IsActive = chkIsActive.Checked; CRM_FundraisingGiftProfile.AmountToCharge = Convert.ToDecimal(txtAmountToCharge.Text); CRM_FundraisingGiftProfile.StartDate = txtStartDate.Value; CRM_FundraisingGiftProfile.EndDate = txtEndDate.Value; CRM_FundraisingGiftProfile.DayOfMonth = Convert.ToInt32(ddlDayOfMonth.SelectedValue); CRM_FundraisingGiftProfile.EveryXMonth = Convert.ToInt32(ddlMonthlyIntervals.SelectedValue); CRM_FundraisingGiftProfile.PaymentReference = txtPaymentReference.Text; if (newRecord) { CRM_FundraisingGiftProfile.NextPaymentDate = txtStartDate.Value; } else { CRM_FundraisingGiftProfile.NextPaymentDate = txtNextDate.Value; } db.SubmitChanges(); if (oldEntity != null) { CRM.Code.History.History.RecordLinqUpdate(db, AdminUser, oldEntity, CRM_FundraisingGiftProfile); db.SubmitChanges(); } else { CRM.Code.History.History.RecordLinqInsert(AdminUser, CRM_FundraisingGiftProfile); } }
protected void Page_Load(object sender, EventArgs e) { CRM_FundraisingGiftProfile = Entity.CRM_FundraisingGiftProfiles.SingleOrDefault(c => c.ID.ToString() == Request.QueryString["pid"]); btnSubmit.EventHandler = btnSubmit_Click; btnSubmitChanges.EventHandler = btnSubmitChanges_Click; btnDelete.EventHandler = btnDelete_Click; btnReinstate.EventHandler = btnReinstate_Click; // confirmations // confirmationDelete.StandardDeleteHidden("gift profile", btnRealDelete_Click); // process // CRMContext = CRM_FundraisingGiftProfile; ucLogNotes.INotes = CRM_FundraisingGiftProfile; ucNavPerson.Entity = Entity; if (!IsPostBack) { FormDropdowns(); if (CRM_FundraisingGiftProfile != null) { PopulateFields(); } else { pnlGiftAidLogs.Visible = false; txtStartDate.Value = UKTime.Now; txtEndDate.Value = UKTime.Now.AddYears(1); pnlNextDate.Visible = false; } } }