protected override void OnLoad(EventArgs e) { base.OnLoad(e); var classId = QueryHelper.GetInteger("classId", 0); var dataClass = DataClassInfoProvider.GetDataClassInfo(classId); if (dataClass == null) { return; } if (UseBindingTemplates(dataClass)) { plcNormalInfo.Visible = false; chkUseIdHashtable.Visible = false; txtInfoCode.Height = 600; txtInfoProviderCode.Height = 600; } // Setup the Macro source drpDisplayNameColumn.MacroSource = drpCodeNameColumn.MacroSource = drpGuidColumn.MacroSource = drpLastModifiedColumn.MacroSource = drpBinaryColumn.MacroSource = drpSiteIdColumn.MacroSource = "Flatten(\";(none)\", GetClassFields(\"" + dataClass.ClassName + "\"))"; if (!RequestHelper.IsPostBack()) { // Load code generation settings from data class var settings = dataClass.ClassCodeGenerationSettingsInfo; txtNamespace.Text = String.IsNullOrEmpty(settings.NameSpace) ? BaseAbstractInfoProvider.GetCodeName(PredefinedObjectType.RESOURCE, dataClass.ClassResourceID) : settings.NameSpace; if (string.IsNullOrEmpty(settings.ObjectType)) { txtObjectType.Text = dataClass.ClassName.ToLowerInvariant(); } else { txtObjectType.Text = settings.ObjectType; } drpDisplayNameColumn.Text = settings.DisplayNameColumn; drpCodeNameColumn.Text = settings.CodeNameColumn; drpGuidColumn.Text = settings.GuidColumn; drpLastModifiedColumn.Text = settings.LastModifiedColumn; drpBinaryColumn.Text = settings.BinaryColumn; drpSiteIdColumn.Text = settings.SiteIdColumn; chkUseIdHashtable.Checked = settings.UseIdHashtable; chkUseNameHashtable.Checked = settings.UseNameHashtable; chkUseGuidHashtable.Checked = settings.UseGuidHashtable; var moduleCodeName = BaseAbstractInfoProvider.GetCodeName(PredefinedObjectType.RESOURCE, dataClass.ClassResourceID); var savePath = "~/" + (SystemContext.IsWebApplicationProject ? "Old_App_Code" : "App_Code") + "/CMSModules/" + TrimCmsPrefix(moduleCodeName) + ""; ucSaveFsSelector.Value = savePath; if (Directory.Exists(savePath)) { ucSaveFsSelector.DefaultPath = savePath; } GenerateCode(dataClass); } btnGenerateCode.Click += (sender, args) => { SaveCodeGenerationSettings(dataClass); GenerateCode(dataClass); }; btnSaveCode.Click += (sender, args) => SaveCode(); btnSaveCode.OnClientClick = "if (!confirm('" + GetString("codegenerators.saveconfirmation") + "')) { return false }"; }