Skip
-
1/10/2012 7:52:44 AM
RE:Returning Wrong Form
I have written custom code and I am sure that is where the problem is at. I am back to programming in .net after a 10 year break writing Coldfusion code.
I have created a new document type for the calendar events. The document type holds the alternative form id.
Here is the code.
private void SetupControl() { if (this.StopProcessing) { //Do nothing } else { if (!IsPostBack) { EventNode = CMSContext.CurrentDocument; RegForm = 0; //Get form ID from the event record. RegForm = ValidationHelper.GetInteger(DataHelper.GetDataRowValue(EventNode.DataRow, "EventRegistrationFormID"), 0); if (RegForm > 0) { var AltForm = AlternativeFormInfoProvider.GetAlternativeFormInfo(RegForm);
if (AltForm != null) { customTableForm.CustomTableId = AltForm.FormClassID; customTableForm.AlternativeFormFullName = AltForm.FullName; this.hdAltForm.Value = AltForm.FullName; customTableForm.SiteName = SiteName; customTableForm.UseColonBehindLabel = UseColonBehindLabel; customTableForm.ItemID = 0;
customTableForm.ShowPrivateFields = true; customTableForm.OnAfterSave += customTableForm_OnAfterSave; customTableForm.OnAfterValidate += customTableForm_OnAfterValidate; customTableForm.BasicForm.SubmitButton.Visible = false; } if (ValidationHelper.GetBoolean(CMSContext.CurrentDocument.GetValue("EventPayRequired"), true)) { uxCreditCardProcess.Visible = true; } } else { Views.SetActiveView(NoReg); } } } }
protected void customTableForm_OnAfterValidate() { if (CreditCardInformationRequired) { // Call the validation on the credit card form // Invalid credit card information, stop processing // Add validation message if handled here and not on the credit card form if (!uxCreditCardProcess.CCValidate()) { customTableForm.StopProcessing = false; } } }
private void customTableForm_OnBeforeSave() { }
private void customTableForm_OnAfterSave() { lblInfo.Text = ResHelper.GetString("general.changessaved"); lblInfo.Visible = true; customTableForm.Visible = false;
// Before saving Custom Table data, submit the credit card information (if needed) for authorization if (ValidationHelper.GetBoolean(CMSContext.CurrentDocument.GetValue("EventPayRequired"), true)) { // The credit card would have been validated on submit of the page // Take their money! var vGlNumber = CMSContext.CurrentDocument.GetValue("GLNumber");
// TODO: Change call to pass parameters if (uxCreditCardProcess.Submit2Gateway()) { // TODO: Save the authorization code
Views.SetActiveView(Success); } else { // Submission failed, stop the Custom Table Form customTableForm.StopProcessing = true; } }
// EditingFormControl fc = (EditingFormControl)customTableForm.BasicForm.FieldEditingControls["AuthCode"]; // fc.Value = uxCreditCardProcess.AuthorizationCode; var x = customTableForm.BasicForm.EditedObject as CMS.DataEngine.SimpleDataClass; if (x != null) { var p = new CustomTableItemProvider(UserInfoProvider.GetFullUserInfo(53)); var item = p.GetItem((int)x.DataRow[0], "deac_Reg_CustomTable.BigBroSis"); item.SetValue("AuthCode", uxCreditCardProcess.AuthorizationCode); item.SetValue("CardNumber", uxCreditCardProcess.Last4CardNo); item.Update(); } } protected void btnRegister_Click(object sender, EventArgs e) { customTableForm.AlternativeFormFullName = hdAltForm.Value; bool bsave = customTableForm.BasicForm.SaveData(""); }
|