/// <summary> /// Handles the OnBeforeSave event of the EditForm control. /// </summary> protected void EditForm_OnBeforeSave(object sender, EventArgs ea) { var ctx = UIContext; // If edited object is empty, but action is edit and object ID is set -> modifying non existence object -> redirect if (((ctx.EditedObject == null) || (((BaseInfo)ctx.EditedObject).Generalized.ObjectID <= 0)) && (ctx.ObjectID != 0) && ctx["Action"].ToString("") == "edit") { ctx.EditedObject = null; } BaseInfo bi = EditForm.EditedObject; dnChanged = bi.ItemChanged(bi.Generalized.DisplayNameColumn) || ResHelper.ContainsLocalizationMacro(bi.Generalized.ObjectDisplayName); // Modify check bool allowed = EditForm.Enabled; if (DelayedModifyCheck && newItem) { allowed = CheckEditPermissions(bi); } if (!allowed) { ShowError(GetString("ui.notauthorizemodified")); EditForm.StopProcessing = true; } if (newItem) { if (!bi.Generalized.CheckLicense(ObjectActionEnum.Insert)) { EditForm.StopProcessing = true; ShowError(GetString("licenseversion.createobject")); return; } // If parent column is specified manually, add parent object ID to it (f.e. category hierarchy leveling, parent is not set in TYPEINFO) String parentColumn = ValidationHelper.GetString(ctx["parentcolumn"], String.Empty); if (parentColumn != String.Empty) { bi.SetValue(parentColumn, ctx["parentobjectid"]); } } // Refresh header properties check foreach (String str in ParentRefreshProperties.Split(';')) { if (EditForm.EditedObject.ItemChanged(str)) { itemChanged = true; break; } } }