protected void btnUpdate_Click(object sender, EventArgs e) { FeedRepository rfeed = new FeedRepository(); Utility Util = new Utility(); Feed feed = new Feed(); feed.Author = Author.Value; feed.Title = title.Value; feed.Summary = Summary.Value; feed.Description = Description.Value; feed.Link = Link.Value; feed.CategoryID = Int16.Parse(CategoryName.SelectedValue); feed.FeedID = Int32.Parse(FeedID.Value); feed.isValid = Int16.Parse(FeedState.SelectedValue); feed.DisplayIn = ""; for (int i = 0; i < CheckBoxDisplayIn.Items.Count; i++) { if (CheckBoxDisplayIn.Items[i].Selected) { if (feed.DisplayIn.Length > 0) feed.DisplayIn += ","; feed.DisplayIn += CheckBoxDisplayIn.Items[i].Value; } } if (feed.DisplayIn.Length == 0) feed.DisplayIn = "-1"; rfeed.Update(feed); feed = null; Util = null; rfeed = null; }
protected void Page_Load(object sender, EventArgs e) { FeedRepository feed = new FeedRepository(); Utility Util = new Utility(); //Page.Validate( = false; if (!Page.IsPostBack) { feed.FillUp((int)Util.Val(Request.QueryString["id"])); title.Value = feed.Title; Author.Value = feed.Author; Link.Value = feed.Link; Summary.Value = feed.Summary; Description.Value = feed.Description; GetDropdownCategoryList(feed.CategoryID); GetDropdownStateList(feed.isValid); GetCheckBoxDisplayInList(feed.DisplayIn); FeedID.Value = Util.Val(Request.QueryString["id"]).ToString(); if (constant.FeedCategory[feed.CategoryID].Name == "JOBS") { isJob.Visible = false; } } feed = null; Util = null; }
public void AddFeed(short state) { Feed feed = new Feed(); Utility Util = new Utility(); feed.Author = "Administrator"; foreach (sCategory cat in constant.FeedCategory) { if(cat.Name == "JOBS") feed.CategoryID = cat.ID; } feed.Title = Util.FormatTextForInput(Request.Form[JobTitle.UniqueID]); feed.Link = constant.JobsPageBase + Util.FormatTextForInput(Request.Form[JobLink.UniqueID]); string tmp = ""; GenerateSummary(ref tmp); testsummary.Text = tmp; feed.Summary = tmp; //feed. GenerateDetails(ref tmp); testdetails.Text = tmp; feed.Description = tmp; feed.isValid = state; feed.DisplayIn = "-1"; SummaryPreview.Visible = true; DetailPreview.Visible = true; if ((state == 1) || (state == 2)) { FeedRepository feedrep = new FeedRepository(); if (feedrep.isFeedLinkDuplicate(feed.Link, feed.CategoryID) == 0) { feedrep.Add(feed); } else { lblWarningMessage.Visible = true; lblWarningMessage.Text = "Error!! FeedLink is Duplicate"; } feedrep = null; } Util = null; feed = null; }