protected void GVTopics_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("EditTopic")) { Entity.FAQTopicInfo oFAQTopicInfo = new Entity.FAQTopicInfo(); BLL.FAQTopicLib oFAQTopicLib = new BLL.FAQTopicLib(); oFAQTopicInfo = oFAQTopicLib.GetAllFAQTopicsById(Convert.ToInt32(e.CommandArgument)); if (oFAQTopicInfo != null) { txtTopic.Text = oFAQTopicInfo.StrFaqTopic; ViewState["Int_FAQTopicId"] = e.CommandArgument.ToString(); } oFAQTopicInfo = null; oFAQTopicInfo = null; } else if (e.CommandName.Equals("DeleteTopic")) { BLL.FAQTopicLib oFAQTopicLib = new BLL.FAQTopicLib(); oFAQTopicLib.DeleteFAQTopicDetails(Convert.ToInt32(e.CommandArgument)); lblMsg.Text = "Forum Topic has been deleted successfully."; oFAQTopicLib = null; ClearControls(); BindFAQTopics(); } }
private void AddUpdateFAQTopics() { BLL.FAQTopicLib oFAQTopicLib = new BLL.FAQTopicLib(); Entity.FAQTopicInfo oFAQTopicInfo = new Entity.FAQTopicInfo(); oFAQTopicInfo.Int_FAQTopicId = 0; oFAQTopicInfo.DtCreatedOn = DateTime.Now; oFAQTopicInfo.StrFaqTopic = txtTopic.Text.Trim(); oFAQTopicInfo.StrCreatedBy = AppLib.GetLoggedInUserName(); if (ViewState["Int_FAQTopicId"] != null) { oFAQTopicInfo.Int_FAQTopicId = Convert.ToInt32(ViewState["Int_FAQTopicId"]); if (oFAQTopicLib.UpdateFAQTopicDetails(oFAQTopicInfo)) { lblMsg.Text = "FAQ Topic has been updated successfully."; ViewState["intNewsLetterId"] = null; ViewState["strOldFileName"] = null; ClearControls(); BindFAQTopics(); } else { lblMsg.Text = "FAQ Topic already exists."; } } else { if (oFAQTopicLib.SaveFAQTopicDetails(oFAQTopicInfo)) { lblMsg.Text = "FAQ Topic has been added successfully."; ClearControls(); BindFAQTopics(); } else { lblMsg.Text = "FAQ Topic already exists."; } } oFAQTopicLib = null; oFAQTopicInfo = null; }
private void BindFAQTopics() { BLL.FAQTopicLib oFAQTopicLib = new BLL.FAQTopicLib(); GVTopics.DataSource = oFAQTopicLib.GetAllFAQTopics(); GVTopics.DataBind(); oFAQTopicLib = null; }