Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
    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());
     }
 }
Ejemplo n.º 4
0
    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();
        }
    }
Ejemplo n.º 5
0
    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();
    }
Ejemplo n.º 6
0
        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()); }
        }
Ejemplo n.º 7
0
 public Result <FAQGroup> Edit(FAQGroup model) => _dataSource.Update(model);
Ejemplo n.º 8
0
 public Result <FAQGroup> Add(FAQGroup model) => _dataSource.Insert(model);
Ejemplo n.º 9
0
 public Result <FAQGroup> Update(FAQGroup model)
 {
     return(Modify(false, model));
 }
Ejemplo n.º 10
0
 public Result <FAQGroup> Insert(FAQGroup model)
 {
     model.ID = Guid.NewGuid();
     return(Modify(true, model));
 }