public Result <FAQGroup> Get(Guid ID) { try { FAQGroup obj = new FAQGroup(); SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@ID", ID); using (SqlConnection con = new SqlConnection(SQLHelper.GetConnectionString())) { using (SqlDataReader dr = SQLHelper.ExecuteReader(con, CommandType.StoredProcedure, "app.spGetFaqGroup", param)) { while (dr.Read()) { obj.CreatorID = SQLHelper.CheckGuidNull(dr["CreatorID"]); obj.CreationDate = SQLHelper.CheckDateTimeNull(dr["CreationDate"]); obj.ID = SQLHelper.CheckGuidNull(dr["ID"]); obj.ApplicationID = SQLHelper.CheckGuidNull(dr["ApplicationID"]); obj.Title = SQLHelper.CheckStringNull(dr["Title"]); } } } return(Result <FAQGroup> .Successful(data : obj)); } catch { return(Result <FAQGroup> .Failure()); } }
protected void rptFAQGroup_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } Accordion acc = (Accordion)e.Item.FindControl("accFAQGroup"); FAQGroup fg = (FAQGroup)e.Item.DataItem; acc.DataSource = fg.Items; acc.DataBind(); // Auto-expand if it contains the selected FAQ item int i = 0; foreach (FAQItem fi in fg.Items) { if (fi.idFAQ == SelectedFAQItem) { acc.SelectedIndex = i; } i++; } }
public IHttpActionResult Edit(FAQGroup model) { try { return(Ok(_service.Edit(model))); } catch { return(NotFound()); } }
protected void Page_Load(object sender, EventArgs e) { Master.SelectedTab = tabID.tabUnknown; if (!IsPostBack) { SelectedFAQItem = util.GetIntParam(Request, "q", 0); bool fBypassCache = util.GetIntParam(Request, "ut", 0) != 0; rptFAQGroup.DataSource = fBypassCache ? FAQGroup.CategorizeFAQItems(FAQItem.AllFAQItems) : FAQGroup.CategorizedFAQs; rptFAQGroup.DataBind(); } }
protected void btnSearch_Click(object sender, EventArgs e) { IEnumerable <FAQGroup> results; if (String.IsNullOrWhiteSpace(mfbSearchbox.SearchText)) { results = FAQGroup.CategorizedFAQs; } else { results = FAQGroup.CategorizedFAQItemsContainingWords(mfbSearchbox.SearchText); if (!results.Any()) { lblErr.Text = Resources.LocalizedText.FAQSearchNoResults; results = FAQGroup.CategorizedFAQs; } } rptFAQGroup.DataSource = results; rptFAQGroup.DataBind(); }
private Result <FAQGroup> Modify(bool isNewrecord, FAQGroup model) { try { using (SqlConnection con = new SqlConnection(SQLHelper.GetConnectionString())) { SqlParameter[] param = new SqlParameter[5]; param[0] = new SqlParameter("@ID", model.ID); param[1] = new SqlParameter("@CreatorID", _requestInfo.UserId); param[2] = new SqlParameter("@ApplicationID", _requestInfo.ApplicationId); param[3] = new SqlParameter("@Title", model.Title); param[4] = new SqlParameter("@isNewRecord", isNewrecord); SQLHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "app.spModifyFaqGroup", param); return(Get(model.ID)); } } catch { return(Result <FAQGroup> .Failure()); } }
public Result <FAQGroup> Edit(FAQGroup model) => _dataSource.Update(model);
public Result <FAQGroup> Add(FAQGroup model) => _dataSource.Insert(model);
public Result <FAQGroup> Update(FAQGroup model) { return(Modify(false, model)); }
public Result <FAQGroup> Insert(FAQGroup model) { model.ID = Guid.NewGuid(); return(Modify(true, model)); }