protected void btnSubmit_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } MasterDetailMiniSummarySetting rec = new MasterDetailMiniSummarySetting(this.ModuleId); rec.ModuleId = this.ModuleId; rec.StartingPageId = PagePicker1.SelectedNavigationId; if (string.IsNullOrEmpty(tbNumRows.Text.Trim())) { rec.NumRows = 10; } else { rec.NumRows = Convert.ToInt32(tbNumRows.Text.Trim()); } rec.ShowElapsedTime = cbShowElapsedTime.Checked; rec.FeaturedOnly = cbShowFeaturedOnly.Checked; rec.Save(); LeavePage(); }
/// <summary> /// Checks that the custom module data exists. If the custom module /// object cannot be retrieved (e.g., this is the initial creation of /// the module), then a new module object is created using the module /// id assigned by the CMS. /// </summary> override protected void EnsureModule() { MasterDetailMiniSummarySetting module = MasterDetailMiniSummarySetting.FetchByID(this.ModuleId); if (null == module) { module = new MasterDetailMiniSummarySetting(); module.ModuleId = this.ModuleId; module.Save(); } }
public void Insert(int ModuleId, int?StartingPageId, int?NumRows, bool?ShowElapsedTime, bool?FeaturedOnly) { MasterDetailMiniSummarySetting item = new MasterDetailMiniSummarySetting(); item.ModuleId = ModuleId; item.StartingPageId = StartingPageId; item.NumRows = NumRows; item.ShowElapsedTime = ShowElapsedTime; item.FeaturedOnly = FeaturedOnly; item.CreatedOn = DateTime.Now; item.CreatedBy = UserName; item.Save(UserName); }