예제 #1
0
        protected void gvRegistrations_Sorting(object sender, GridViewSortEventArgs e)
        {
            DataTable dtRegs = Session ["HousingRegs"] as DataTable;

            foreach (GridViewRow i in gvRegistrations.Rows)
            {
                HiddenField hidRegistrationID = (HiddenField)i.FindControl("hidRegistrationID");
                TextBox     tbAssignHousing   = (TextBox)i.FindControl("tbAssignHousing");
                DataRow []  FoundRows         = dtRegs.Select("RegistrationID = " + hidRegistrationID.Value);
                if (FoundRows.Length > 0)
                {
                    FoundRows [0] ["AssignHousing"] = tbAssignHousing.Text;
                }
            }
            Session ["HousingRegs"] = dtRegs;

            if (e.SortExpression == ViewState ["SortField"].ToString())
            {
                // Fixed issue with sorting. Had an extra ! in the next line so it would never sort right.  JBradshaw  8/14/2018
                if (String.IsNullOrEmpty(ViewState ["SortDir"].ToString()))
                {
                    ViewState ["SortDir"] = "DESC";
                }
                else
                {
                    ViewState ["SortDir"] = "";
                }
            }
            else
            {
                ViewState ["SortField"] = e.SortExpression;
                ViewState ["SortDir"]   = "";
            }

            string sSort = ViewState ["SortField"].ToString() + " " + ViewState ["SortDir"].ToString();

            DataView dvDisplay = new DataView(dtRegs, "", sSort, DataViewRowState.CurrentRows);

            gvRegistrations.DataSource = dvDisplay;
            gvRegistrations.DataBind();
            DisplaySorting();

            Classes.cUserOption Option = new Classes.cUserOption();
            Option.LoginUsername = Session["UserName"].ToString();
            Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
            Option.ObjectName    = "gvRegistrations";
            Option.ObjectOption  = "SortField";
            Option.OptionValue   = ViewState["SortField"].ToString();
            Option.SaveOptionValue();

            Option = new Classes.cUserOption();
            Option.LoginUsername = Session["UserName"].ToString();
            Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
            Option.ObjectName    = "gvRegistrations";
            Option.ObjectOption  = "SortDir";
            Option.OptionValue   = ViewState["SortDir"].ToString();
            Option.SaveOptionValue();
        }
예제 #2
0
 protected void ddlEventDate_SelectedIndexChanged(object sender, EventArgs e)
 {
     Classes.cUserOption Option = new Classes.cUserOption();
     Option.LoginUsername = Session["UserName"].ToString();
     Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
     Option.ObjectName    = "ddlEventDate";
     Option.ObjectOption  = "SelectedValue";
     Option.OptionValue   = ddlEventDate.SelectedValue;
     Option.SaveOptionValue();
     //			ViewState["EventDate"] = ddlEventDate.SelectedValue;
 }
예제 #3
0
 protected void ddlEvent_SelectedIndexChanged(object sender, EventArgs e)
 {
     Classes.cUserOption Option = new Classes.cUserOption();
     Option.LoginUsername = Master.UserName;
     Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
     Option.ObjectName    = "ddlEvent";
     Option.ObjectOption  = "SelectedValue";
     Option.OptionValue   = ddlEvent.SelectedValue;
     Option.SaveOptionValue();
     ViewState["Event"] = ddlEvent.SelectedValue;
     BindData();
 }
예제 #4
0
 protected void ddlCharacterName_SelectedIndexChanged(object sender, EventArgs e)
 {
     Classes.cUserOption Option = new Classes.cUserOption();
     if (ddlCharacterName.SelectedIndex == 0)
     {
         Option.DeleteOption(Session["UserName"].ToString(), HttpContext.Current.Request.Url.AbsolutePath, "ddlCharacterName", "SelectedValue");
     }
     else
     {
         Option.LoginUsername = Session["UserName"].ToString();
         Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
         Option.ObjectName    = "ddlCharacterName";
         Option.ObjectOption  = "SelectedValue";
         Option.OptionValue   = ddlCharacterName.SelectedValue;
         Option.SaveOptionValue();
     }
 }
예제 #5
0
        protected void gvPELList_Sorting(object sender, GridViewSortEventArgs e)
        {
            Classes.cUserOption Option = new Classes.cUserOption();
            Option.LoadOptionValue(Master.UserName, HttpContext.Current.Request.Url.AbsolutePath, "gvPELList", "SortField");
            string sSortField = Option.OptionValue;

            Option.LoadOptionValue(Master.UserName, HttpContext.Current.Request.Url.AbsolutePath, "gvPELList", "SortDir");
            string sSortDir = Option.OptionValue;

            if (e.SortExpression == sSortField)
            {
                if (String.IsNullOrEmpty(sSortDir))
                {
                    sSortDir = "DESC";
                }
                else
                {
                    sSortDir = "";
                }
            }
            else
            {
                sSortField = e.SortExpression;
                sSortDir   = "";
            }

            Option = new Classes.cUserOption();
            Option.LoginUsername = Master.UserName;
            Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
            Option.ObjectName    = "gvPELList";
            Option.ObjectOption  = "SortField";
            Option.OptionValue   = sSortField;
            Option.SaveOptionValue();

            Option = new Classes.cUserOption();
            Option.LoginUsername = Master.UserName;
            Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
            Option.ObjectName    = "gvPELList";
            Option.ObjectOption  = "SortDir";
            Option.OptionValue   = sSortDir;
            Option.SaveOptionValue();
        }
        protected void gvRegistrations_Sorting(object sender, GridViewSortEventArgs e)
        {
            string sField = ViewState["SortField"].ToString();
            string sDir   = ViewState["SortDir"].ToString();

            if (e.SortExpression == sField)
            {
                if (String.IsNullOrEmpty(sDir))
                {
                    ViewState["SortDir"] = "DESC";
                }
                else
                {
                    ViewState["SortDir"] = "";
                }
            }
            else
            {
                ViewState["SortField"] = e.SortExpression;
                ViewState["SortDir"]   = "";
            }

            PopulateGrid();

            Classes.cUserOption Option = new Classes.cUserOption();
            Option.LoginUsername = Session["UserName"].ToString();
            Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
            Option.ObjectName    = "gvRegistrations";
            Option.ObjectOption  = "SortField";
            Option.OptionValue   = ViewState["SortField"].ToString();
            Option.SaveOptionValue();

            Option = new Classes.cUserOption();
            Option.LoginUsername = Session["UserName"].ToString();
            Option.PageName      = HttpContext.Current.Request.Url.AbsolutePath;
            Option.ObjectName    = "gvRegistrations";
            Option.ObjectOption  = "SortDir";
            Option.OptionValue   = ViewState["SortDir"].ToString();
            Option.SaveOptionValue();
        }
예제 #7
0
        protected void BindData()
        {
            SortedList sParams       = new SortedList();
            DataTable  dtCharHistory = new DataTable();

            int iSessionID = 0;

            int.TryParse(Session ["CampaignID"].ToString(), out iSessionID);
            sParams.Add("@CampaignID", iSessionID);

            dtCharHistory = Classes.cUtilities.LoadDataTable("uspGetCampaignCharacterHistory", sParams, "LARPortal", Session ["UserName"].ToString(), "PELApprovalList.Page_PreRender");

            if (!IsPostBack)
            {
                ddlCharacterName.DataSource     = dtCharHistory;
                ddlCharacterName.DataTextField  = "CharacterAKA";
                ddlCharacterName.DataValueField = "CharacterAKA";
                ddlCharacterName.DataBind();

                if (dtCharHistory.Rows.Count > 1)
                {
                    ListItem liNoFilter = new ListItem();
                    liNoFilter.Text  = "No Filter";
                    liNoFilter.Value = "";
                    ddlCharacterName.Items.Insert(0, liNoFilter);
                }
            }

            string sSelectedChar = "";
            string sStatus       = "";
            string sRowFilter    = "";

            Classes.cUserOption Option = new Classes.cUserOption();
            Option.LoadOptionValue(Session["UserName"].ToString(), HttpContext.Current.Request.Url.AbsolutePath, "ddlCharacterName", "SelectedValue");
            sSelectedChar = Option.OptionValue;

            Option.LoadOptionValue(Session["UserName"].ToString(), HttpContext.Current.Request.Url.AbsolutePath, "ddlStatus", "SelectedValue");
            sStatus = Option.OptionValue;

            if (!string.IsNullOrEmpty(sSelectedChar))
            {
                ddlCharacterName.ClearSelection();
                foreach (ListItem lItem in ddlCharacterName.Items)
                {
                    if (lItem.Value == sSelectedChar)
                    {
                        sRowFilter = "(CharacterAKA = '" + lItem.Value.Replace("'", "''") + "')";
                        ddlCharacterName.ClearSelection();
                        lItem.Selected = true;
                    }
                }
                if (ddlCharacterName.SelectedIndex < 0)
                {
                    ddlCharacterName.SelectedIndex = 0;
                }
            }
            else
            {
                if (sStatus.Length > 0)
                {
                    ddlStatus.ClearSelection();
                    foreach (ListItem lItem in ddlStatus.Items)
                    {
                        if (lItem.Value == sStatus)
                        {
                            switch (sStatus)
                            {
                            case "A":
                                sRowFilter = "(DateHistoryApproved is not null)";
                                break;

                            case "S":
                                sRowFilter = "(DateHistoryApproved is null) and (DateHistorySubmitted is not null)";
                                break;

                            default:
                                sRowFilter = "(DateHistorySubmitted is not null)";
                                break;
                            }
                        }
                    }
                    if (ddlStatus.SelectedIndex < 0)
                    {
                        ddlStatus.SelectedIndex = 0;
                    }
                }
            }

            if (dtCharHistory.Columns ["HistoryStatus"] == null)
            {
                dtCharHistory.Columns.Add("HistoryStatus", typeof(string));
            }

            if (dtCharHistory.Columns ["ShortHistory"] == null)
            {
                dtCharHistory.Columns.Add("ShortHistory", typeof(string));
            }

            foreach (DataRow dRow in dtCharHistory.Rows)
            {
                string sRawHistory     = dRow ["CharacterHistory"].ToString();
                string ScrubbedHistory = ScrubHtml(sRawHistory);

                if (ScrubbedHistory.Length > 100)
                {
                    dRow ["ShortHistory"] = ScrubbedHistory.Substring(0, 95) + "...";
                }
                else
                {
                    dRow ["ShortHistory"] = ScrubbedHistory;
                }
                if (dRow ["DateHistoryApproved"] == DBNull.Value)
                {
                    dRow ["HistoryStatus"] = "Submitted";
                }
                else
                {
                    dRow ["HistoryStatus"] = "Approved";
                }
            }

            DataView dvPELs = new DataView(dtCharHistory, sRowFilter, "CharacterAKA", DataViewRowState.CurrentRows);

            gvHistoryList.DataSource = dvPELs;
            gvHistoryList.DataBind();
        }
예제 #8
0
        protected void BindData()
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            SortedList sParams = new SortedList();

            sParams.Add("@CampaignID", Master.CampaignID);

            DataTable dtPELs = Classes.cUtilities.LoadDataTable("uspGetPELsToApprove", sParams, "LARPortal", Master.UserName, lsRoutineName + ".uspGetPELsToApprove");

            if (dtPELs.Columns["AddendumImage"] == null)
            {
                dtPELs.Columns.Add("AddendumImage", typeof(string));
            }
            if (dtPELs.Columns["StaffCommentsImages"] == null)
            {
                dtPELs.Columns.Add("StaffCommentsImage", typeof(string));
            }

            foreach (DataRow dRow in dtPELs.Rows)
            {
                if (dRow["Addendum"].ToString() == "Y")
                {
                    dRow["AddendumImage"] = "../img/checkbox.png";
                }
                else
                {
                    dRow["AddendumImage"] = "../img/uncheckbox.png";
                }

                if (dRow["StaffComments"].ToString() == "Y")
                {
                    dRow["StaffCommentsImage"] = "../img/checkbox.png";
                }
                else
                {
                    dRow["StaffCommentsImage"] = "../img/uncheckbox.png";
                }
            }

            string sCharacterNameFilter = "";
            string sEventDateFilter     = "";
            string sEventNameFilter     = "";
            string sPELStatusFilter     = "";
            string sSortField           = "";
            string sSortDir             = "ASC";

            Classes.cUserOptions OptionsLoader = new Classes.cUserOptions();
            OptionsLoader.LoadUserOptions(Session["UserName"].ToString(), HttpContext.Current.Request.Url.AbsolutePath);
            foreach (Classes.cUserOption Option in OptionsLoader.UserOptionList)
            {
                if ((Option.ObjectName.ToUpper() == "DDLCHARACTERNAME") &&
                    (Option.ObjectOption.ToUpper() == "SELECTEDVALUE"))
                {
                    sCharacterNameFilter = Option.OptionValue;
                }
                else if ((Option.ObjectName.ToUpper() == "DDLEVENTDATE") &&
                         (Option.ObjectOption.ToUpper() == "SELECTEDVALUE"))
                {
                    sEventDateFilter = Option.OptionValue;
                }
                else if ((Option.ObjectName.ToUpper() == "DDLEVENTNAME") &&
                         (Option.ObjectOption.ToUpper() == "SELECTEDVALUE"))
                {
                    sEventNameFilter = Option.OptionValue;
                }
                else if ((Option.ObjectName.ToUpper() == "DDLSTATUS") &&
                         (Option.ObjectOption.ToUpper() == "SELECTEDVALUE"))
                {
                    sPELStatusFilter = Option.OptionValue;
                }
                else if ((Option.ObjectName.ToUpper() == "GVPELLIST") &&
                         (Option.ObjectOption.ToUpper() == "SORTFIELD"))
                {
                    sSortField = Option.OptionValue;
                }
                else if ((Option.ObjectName.ToUpper() == "GVPELLIST") &&
                         (Option.ObjectOption.ToUpper() == "SORTDIR"))
                {
                    sSortDir = Option.OptionValue;
                }
            }

            if (sSortField.Length == 0)
            {
                sSortField = "PELStatus";
                Classes.cUserOption Option = new Classes.cUserOption();
                Option.SaveOptionValue(Session["UserName"].ToString(), HttpContext.Current.Request.Url.AbsolutePath, "gvPELList", "SortField", sSortField, "");
            }

            foreach (DataRow dRow in dtPELs.Rows)
            {
                if (dRow["RoleAlignment"].ToString() != "PC")
                {
                    dRow["CharacterAKA"] = dRow["RoleAlignment"].ToString();
                }
            }

            // While creating the filter am also saving the selected values so we can go back and have the drop down list use them.
            string sRowFilter = "(1 = 1)";      // This is so it's easier to build the filter string. Now can always say 'and ....'

            if (sCharacterNameFilter.Length > 0)
            {
                sRowFilter += " and (CharacterAKA = '" + sCharacterNameFilter.Replace("'", "''") + "')";
            }

            if (sEventDateFilter.Length > 0)
            {
                sRowFilter += " and (EventStartDate = '" + sEventDateFilter + "')";
            }

            if (sEventNameFilter.Length > 0)
            {
                sRowFilter += " and (EventName = '" + sEventNameFilter.Replace("'", "''") + "')";
            }

            if (sPELStatusFilter.Length > 0)
            {
                sRowFilter += " and (PELStatus = '" + sPELStatusFilter.Replace("'", "''") + "')";
            }



            DataView dvPELs = new DataView(dtPELs);

            try
            {
                dvPELs.RowFilter = sRowFilter;
            }
            catch (Exception ex)
            {
                // Means there was something wrong - probably somebody mucked with the filter to we are going to clear the row filter.
                sRowFilter = "";
            }

            try
            {
                string sSortString = sSortField + " " + sSortDir;
                if (sSortField.ToUpper().StartsWith("PELSTATUS"))
                {
                    sSortString += ", DateSubmitted";
                }
                dvPELs.Sort = sSortString;
            }
            catch (Exception ex)
            {
                // Means there was something wrong - probably somebody mucked with the sort order to we are going to clear the row filter.
                sSortField = "";
                sSortDir   = "";
            }

            dvPELs.RowStateFilter = DataViewRowState.CurrentRows;

            gvPELList.DataSource = dvPELs;
            gvPELList.DataBind();

            // Now get the list of event names so the person can filter on it.
            DataView  view             = new DataView(dtPELs, sRowFilter, "EventName", DataViewRowState.CurrentRows);
            DataTable dtDistinctEvents = view.ToTable(true, "EventName");

            ddlEventName.DataSource     = dtDistinctEvents;
            ddlEventName.DataTextField  = "EventName";
            ddlEventName.DataValueField = "EventName";
            ddlEventName.DataBind();
            ddlEventName.Items.Insert(0, new ListItem("No Filter", ""));
            ddlEventName.SelectedIndex = -1;
            if (sEventNameFilter.Length > 0)
            {
                foreach (ListItem li in ddlEventName.Items)
                {
                    if (li.Value == sEventNameFilter)
                    {
                        ddlEventName.ClearSelection();
                        li.Selected = true;
                    }
                    else
                    {
                        li.Selected = false;
                    }
                }
            }
            if (ddlEventName.SelectedIndex == -1)     // Didn't find what was selected.
            {
                ddlEventName.SelectedIndex = 0;
            }

            view = new DataView(dtPELs, sRowFilter, "CharacterAKA", DataViewRowState.CurrentRows);
            DataTable dtDistinctChars = view.ToTable(true, "CharacterAKA");

            ddlCharacterName.DataSource     = dtDistinctChars;
            ddlCharacterName.DataTextField  = "CharacterAKA";
            ddlCharacterName.DataValueField = "CharacterAKA";
            ddlCharacterName.DataBind();
            ddlCharacterName.Items.Insert(0, new ListItem("No Filter", ""));
            ddlCharacterName.SelectedIndex = -1;
            if (sCharacterNameFilter.Length > 0)
            {
                foreach (ListItem li in ddlCharacterName.Items)
                {
                    if (li.Value == sCharacterNameFilter)
                    {
                        ddlCharacterName.ClearSelection();
                        li.Selected = true;
                    }
                    else
                    {
                        li.Selected = false;
                    }
                }
            }
            if (ddlCharacterName.SelectedIndex == -1)     // Didn't find what was selected.
            {
                ddlCharacterName.SelectedIndex = 0;
            }

            view = new DataView(dtPELs, sRowFilter, "EventStartDate", DataViewRowState.CurrentRows);
            DataTable dtDistinctDates = view.ToTable(true, "EventStartDateStr");

            ddlEventDate.DataSource     = dtDistinctDates;
            ddlEventDate.DataTextField  = "EventStartDateStr";
            ddlEventDate.DataValueField = "EventStartDateStr";
            ddlEventDate.DataBind();
            ddlEventDate.Items.Insert(0, new ListItem("No Filter", ""));
            ddlEventDate.SelectedIndex = -1;
            if (sEventDateFilter.Length > 0)
            {
                foreach (ListItem li in ddlEventDate.Items)
                {
                    if (li.Value == sEventDateFilter)
                    {
                        ddlEventDate.ClearSelection();
                        li.Selected = true;
                    }
                    else
                    {
                        li.Selected = false;
                    }
                }
            }
            if (ddlEventDate.SelectedIndex == -1)     // Didn't find what was selected.
            {
                ddlEventDate.SelectedIndex = 0;
            }

            view = new DataView(dtPELs, sRowFilter, "PELStatus desc", DataViewRowState.CurrentRows);
            DataTable dtDistinctStatus = view.ToTable(true, "PELStatus");

            ddlStatus.DataSource     = dtDistinctStatus;
            ddlStatus.DataTextField  = "PELStatus";
            ddlStatus.DataValueField = "PELStatus";
            ddlStatus.DataBind();
            ddlStatus.Items.Insert(0, new ListItem("No Filter", ""));
            ddlStatus.SelectedIndex = -1;
            if (sPELStatusFilter.Length > 0)
            {
                foreach (ListItem li in ddlStatus.Items)
                {
                    if (li.Value == sPELStatusFilter)
                    {
                        ddlStatus.ClearSelection();
                        li.Selected = true;
                    }
                    else
                    {
                        li.Selected = false;
                    }
                }
            }
            if (ddlStatus.SelectedIndex == -1)     // Didn't find what was selected.
            {
                ddlStatus.SelectedIndex = 0;
            }

            DisplaySorting(sSortField, sSortDir);
        }