// Save the new or updated Input form private void Save() { ifObj = HyperCatalog.Business.InputForm.GetByKey(ifId); if (ifObj == null) { ifObj = new HyperCatalog.Business.InputForm(-1, string.Empty, string.Empty, string.Empty, SessionState.User.Id, null, SessionState.User.Id, null, ' ', false); } ifObj.Name = txtInputFormName.Text; ifObj.ShortName = txtInputFormShortName.Text; ifObj.Description = txtDescription.Text; ifObj.InputFormTypeCode = Convert.ToChar(ddlInputFormType.SelectedValue); // If the current item is not null and the inputform active status is changed, force current item to reload input forms if (ifObj.IsActive != cbIsActive.Checked && SessionState.CurrentItem != null) { SessionState.CurrentItem.InputForms.Clear(); SessionState.CurrentItem.InputForms = null; } ifObj.IsActive = cbIsActive.Checked; if (!ifObj.Save()) { SessionState.ClearAppInputForms(); lbError.CssClass = "hc_error"; lbError.Text = HyperCatalog.Business.InputForm.LastError; lbError.Visible = true; } else { if (!panelId.Visible) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>Redirect(" + ifObj.Id + ");</script>"); } else { lbError.Text = "Data saved!"; lbError.CssClass = "hc_success"; lbError.Visible = true; } } }
// Delete current Input form private void Delete() { if (panelId.Visible) { ifObj = HyperCatalog.Business.InputForm.GetByKey(ifId); if (ifObj != null) { if (!ifObj.Delete(HyperCatalog.Shared.SessionState.User.Id)) { SessionState.ClearAppInputForms(); lbError.CssClass = "hc_error"; lbError.Text = HyperCatalog.Business.InputForm.LastError; lbError.Visible = true; } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>"); } } } }