protected void ok_Click(object sender, EventArgs e) { if (dbContentClipID == 0) { obj = new DbContentClip(); } else { obj = new DbContentClip(dbContentClipID); } obj.Title = tbTitle.Text; obj.Description = tbDescription.Text; obj.Keywords = tbKeywords.Text; obj.Icon = tbIcon.Text; obj.Body = ftbBody.Text; obj.PublishDate = dePublishDate.Date; obj.ExpirationDate = deExpirationDate.Date; obj.ArchiveDate = deArchiveDate.Date; obj.Priority = int.Parse(tbPriority.Text); obj.SortOrder = int.Parse(tbSortOrder.Text); obj.CommentsEnabled = cbCommentsEnabled.Checked; obj.NotifyOnComments = cbNotifyOnComments.Checked; obj.OverrideUrl = tbOverrideUrl.Text; obj.MenuLabel = tbMenuLabel.Text; obj.MenuTooltip = tbMenuTooltip.Text; obj.MenuEnabled = cbMenuEnabled.Checked; obj.MenuOrder = int.Parse(tbMenuOrder.Text); obj.MenuLeftIcon = tbMenuLeftIcon.Text; obj.MenuLeftIconOver = tbMenuLeftIconOver.Text; obj.MenuRightIcon = tbMenuRightIcon.Text; obj.MenuRightIconOver = tbMenuRightIconOver.Text; obj.MenuBreak = cbMenuBreak.Checked; if (msStatus.SelectedItem != null && msStatus.SelectedItem.Value != "Null") { obj.Status = DbContentStatus.NewPlaceHolder( int.Parse(msStatus.SelectedItem.Value)); } else { obj.Status = null; } if (msParentCatalog.SelectedItem != null && msParentCatalog.SelectedItem.Value != "Null") { obj.ParentCatalog = DbContentCatalog.NewPlaceHolder( int.Parse(msParentCatalog.SelectedItem.Value)); } else { obj.ParentCatalog = null; } if (msRating.SelectedItem != null && msRating.SelectedItem.Value != "Null") { obj.Rating = DbContentRating.NewPlaceHolder( int.Parse(msRating.SelectedItem.Value)); } else { obj.Rating = null; } if (msReferences.IsChanged) { obj.References = new DbContentClipCollection(); foreach (ListItem i in msReferences.Items) { if (i.Selected) { obj.References.Add(DbContentClip.NewPlaceHolder(int.Parse(i.Value))); } } } if (msAuthors.IsChanged) { obj.Authors = new GreyFoxUserCollection(); foreach (ListItem i in msAuthors.Items) { if (i.Selected) { obj.Authors.Add(GreyFoxUser.NewPlaceHolder(int.Parse(i.Value))); } } } if (msEditors.IsChanged) { obj.Editors = new GreyFoxUserCollection(); foreach (ListItem i in msEditors.Items) { if (i.Selected) { obj.Editors.Add(GreyFoxUser.NewPlaceHolder(int.Parse(i.Value))); } } } if (editOnAdd) { dbContentClipID = obj.Save(); } else { obj.Save(); } if (resetOnAdd) { tbTitle.Text = string.Empty; tbDescription.Text = string.Empty; tbKeywords.Text = string.Empty; tbIcon.Text = string.Empty; ftbBody.Text = string.Empty; dePublishDate.Date = DateTime.Now; deExpirationDate.Date = DateTime.Now; deArchiveDate.Date = DateTime.Now; tbPriority.Text = string.Empty; tbSortOrder.Text = string.Empty; cbCommentsEnabled.Checked = false; cbNotifyOnComments.Checked = false; tbOverrideUrl.Text = string.Empty; tbMenuLabel.Text = string.Empty; tbMenuTooltip.Text = string.Empty; cbMenuEnabled.Checked = false; tbMenuOrder.Text = string.Empty; tbMenuLeftIcon.Text = string.Empty; tbMenuLeftIconOver.Text = string.Empty; tbMenuRightIcon.Text = string.Empty; tbMenuRightIconOver.Text = string.Empty; cbMenuBreak.Checked = false; msStatus.SelectedIndex = 0; msParentCatalog.SelectedIndex = 0; msRating.SelectedIndex = 0; } OnUpdated(EventArgs.Empty); }
protected void ok_Click(object sender, EventArgs e) { if (dbContentHitID == 0) { obj = new DbContentHit(); } else { obj = new DbContentHit(dbContentHitID); } obj.UserAgent = tbUserAgent.Text; obj.UserHostAddress = tbUserHostAddress.Text; obj.UserHostName = tbUserHostName.Text; obj.RequestDate = DateTime.Parse(tbRequestDate.Text); obj.RequestReferrer = tbRequestReferrer.Text; obj.IsUnique = cbIsUnique.Checked; if (msUser.SelectedItem != null && msUser.SelectedItem.Value != "Null") { obj.User = GreyFoxUser.NewPlaceHolder( int.Parse(msUser.SelectedItem.Value)); } else { obj.User = null; } if (msRequestContent.SelectedItem != null && msRequestContent.SelectedItem.Value != "Null") { obj.RequestContent = DbContentClip.NewPlaceHolder( int.Parse(msRequestContent.SelectedItem.Value)); } else { obj.RequestContent = null; } if (editOnAdd) { dbContentHitID = obj.Save(); } else { obj.Save(); } if (resetOnAdd) { tbUserAgent.Text = string.Empty; tbUserHostAddress.Text = string.Empty; tbUserHostName.Text = string.Empty; tbRequestDate.Text = DateTime.Now.ToString(); tbRequestReferrer.Text = string.Empty; cbIsUnique.Checked = false; msUser.SelectedIndex = 0; msRequestContent.SelectedIndex = 0; } OnUpdated(EventArgs.Empty); }