[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

Need help understanding some code

Can someone help me to figure out some code that I am maintaining. I have cut and pasted a portion of the code below. And then cut and pasted the code to which it is referring. So please look at line 9 below. They create this object named "filterState" that they seem to be associating with controls on a web form. What is going on here? If I look at the class that "filterState" derives from(ClientAlertFilterState), then it looks like they are dong something will cookies that I don't understand. If anyone can make clear sense of the code, I would appreciate it.

1namespace FreefallNet.Web.Controls.Filters
2{
3    public partial class ClientGeneralFilter : BaseFilter
4    {
5        [Injectable]
6        protected IClientService ClientService { get; set; }
7
9        private readonly ClientAlertFilterState filterState = new ClientAlertFilterState();
10        protected DropDownList category, status, severityType, alertType;
11        protected CalendarDatePicker dateFrom, dateTo;
12        protected CheckBox confirmed;
13        protected override FilterState FilterState
14        {
15            get { return filterState; }
16        }
17
18        protected override FilterExpandableGroup FilterExpandableGroup
19        {
20           get { return filterAlerts; }
21        }
22        public int? Category { get { return GetIntValue(filterState.CategoryFilter); } }
23
24        public int? Status { get { return GetIntValue(filterState.StatusFilter); } }
25
26        public int? Alert { get { return GetIntValue(filterState.AlertTypeFilter); } }
27
28        public int? Severity { get { return GetIntValue(filterState.SeverityFilter); } }
29
30        public DateTime? DateFrom { get { return filterState.DateFromFilter; } }
31
32        public DateTime? DateTo { get { return filterState.DateToFilter; } }
33
34        public bool? Confirmed
35        {
36            get { return filterState.ConfirmedFilter; }
37        }
------------------------------------------------------------------
using System;
namespace FreefallNet.Core.View.Filters
{
    public class ClientAlertFilterState : FilterState
    {
        private readonly string cookieName = "ca";
        #region Properties
       
        protected override string CookieName
        {
            get { return cookieName; }
        }
 
        public string CategoryFilter
        {
            get { return GetCookieValue(cookieName, "cat"); }
            set { SetCookieValue(cookieName, "cat", value); }
        }
 
        public string StatusFilter
        {
            get { return GetCookieValue(cookieName, "stat"); }
            set { SetCookieValue(cookieName, "stat", value); }
        }
 
        public string AlertTypeFilter
        {
            get { return GetCookieValue(cookieName, "al"); }
            set { SetCookieValue(cookieName, "al", value); }
        }
 
        public string SeverityFilter
        {
            get { return GetCookieValue(cookieName, "sev"); }
            set { SetCookieValue(cookieName, "sev", value); }
        }
 
        public DateTime? DateFromFilter
        {
            get { return GetCookieValue(cookieName, "df", s => DateTime.Parse(s)); }
            set { SetCookieValue(cookieName, "df", value); }
        }
 
        public DateTime? DateToFilter
        {
            get { return GetCookieValue(cookieName, "dt", s => DateTime.Parse(s)); }
            set { SetCookieValue(cookieName, "dt", value); }
        }
 
        public bool? ConfirmedFilter
        {
            get { return GetCookieValue(cookieName, "cf", s => bool.Parse(s)); }
            set { SetCookieValue(cookieName, "cf", value); }
        }
 
        #endregion
    }
}

Open in new window

0
brgdotnet
Asked:
brgdotnet
1 Solution
 
aibusinesssolutionsCommented:
It looks like you just pasted the constructors for the public properties, but no functions.  My guess is it is just creating a cookie with the name "ca", and setting the properties of that cookie.
0
 
brgdotnetAuthor Commented:
Well could you look again, because actually I pasted into the snippet sections of code from two different files. See my line seperator above on line 37.

------------------------------------------------------------------
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now