Exemplo n.º 1
0
    private void PopulateFederations()
    {
        _objGen = new General();
        DataSet dsFed = _objGen.get_AllFederationsFJCFunding();


        //var results = from myRow in dsFed.Tables[0].AsEnumerable()
        //where myRow.Field<int>("allowAdminPaymentProcessing") == 1
        //select myRow;



        // 2013-01-03 Temporarily allow a few fedadmin to do payment processing
        string FedID = (string)Session["FedId"];

        //DataRow[] drsss = dsFed.Tables[0].Select("ID = " + FedID);

        //bool isAllow = (bool)drsss[0]["allowAdminPaymentProcessing"];

        if (FedID == "35" || FedID == "5" || FedID == "37" || FedID == "23" || FedID == "89" || FedID == "49" || FedID == "11" || FedID == "12" || FedID == "32" || FedID == "36" || FedID == "26")
        {
            var       dict = new Dictionary <string, string>();
            DataRow[] drs  = dsFed.Tables[0].Select("ID = " + FedID);

            dict.Add(FedID, drs[0]["Federation"].ToString());

            lstFederations.DataSource     = dict;
            lstFederations.DataTextField  = "Value";
            lstFederations.DataValueField = "Key";
            lstFederations.DataBind();
        }
        else if (Session["RoleID"].ToString() == "6")
        {
            // Movement Camps Admin
            lstFederations.DataSource     = MovementDAL.GetMovementFedIDsByUserID(Convert.ToInt32(Session["UsrID"]));
            lstFederations.DataTextField  = "Federation";
            lstFederations.DataValueField = "ID";
            lstFederations.DataBind();
            if ((lstFederations.Items.Count != 0))
            {
                lstFederations.Items.Insert(0, new ListItem("--Select--", "-1"));
            }
        }
        else
        {
            lstFederations.DataSource     = dsFed;
            lstFederations.DataTextField  = "Federation";
            lstFederations.DataValueField = "ID";

            lstFederations.DataBind();
            if ((lstFederations.Items.Count != 0))
            {
                lstFederations.Items.Insert(0, new ListItem("--Select--", "-1"));
            }
        }
    }
Exemplo n.º 2
0
    private void PopulateSrchControls()
    {
        DataSet dsYears;

        _objGen = new General();
        if (ddlCampYear.Items.Count <= 0)
        {
            dsYears = _objGen.GetAllCampYears();
            ddlCampYear.Items.Clear();
            ddlCampYear.DataSource     = dsYears;
            ddlCampYear.DataTextField  = "CampYear";
            ddlCampYear.DataValueField = "ID";
            ddlCampYear.DataBind();

            if (_CampYear != "")
            {
                ddlCampYear.SelectedIndex = (int)Application["CampYear"] - 2008 - 1;
            }
        }


        if (_strRoleID == _strFJCAdmin || _strRoleID == _strApprover) //FJC Admin
        {
            //Populate Federation dropdown with all Federations
            DataSet dsFed;

            dsFed = _objGen.get_AllFederations();

            //***********
            //TV: 02/2009 - Issue # 4-002: changed Federation from DropDownList to multi-select ListBox

            lstFederations.Items.Clear();
            lstFederations.DataSource     = dsFed;
            lstFederations.DataTextField  = "Federation";
            lstFederations.DataValueField = "ID";
            lstFederations.DataBind();
            if ((lstFederations.Items.Count != 0))
            {
                lstFederations.Items.Insert(0, new ListItem("--Select--", "-1"));
            }
            //***********

            //Populate Camp List with all the Camps
            DataSet dsCamps;
            _objGen = new General();
            dsCamps = _objGen.get_AllCampsList(ddlCampYear.SelectedItem.Text);
            lstCamps.Items.Clear();
            lstCamps.DataSource     = dsCamps;
            lstCamps.DataTextField  = "Camp";
            lstCamps.DataValueField = "ID";
            lstCamps.DataBind();
            if ((lstCamps.Items.Count != 0))
            {
                lstCamps.Items.Insert(0, new ListItem("--Select--", "-1"));
            }

            //DataSet dsYears;
            //dsYears = _objGen.GetAllCampYears();
            //ddlCampYear.DataSource = dsYears;
            //ddlCampYear.DataTextField = "CampYear";
            //ddlCampYear.DataValueField = "ID";
            //ddlCampYear.DataBind();

            //if (_CampYear != "")
            //{
            //    ddlCampYear.SelectedIndex = ddlCampYear.Items.Count - 1;
            //}

            //Populate Users dropdown with all users
            DataSet dsModifiedBy;
            _objGen                      = new General();
            dsModifiedBy                 = _objGen.get_Users();
            ddlModifiedBy.DataSource     = dsModifiedBy;
            ddlModifiedBy.DataTextField  = "Name";
            ddlModifiedBy.DataValueField = "ID";
            ddlModifiedBy.DataBind();
            if ((ddlModifiedBy.Items.Count != 0))
            {
                ddlModifiedBy.Items.Insert(0, new ListItem("--Select--", "-1"));
            }
        }

        else if (_strRoleID == _strFedAdmin || _strRoleID == _strFed_CampAdmin) //Federation Admin OR Fed/Camp Admin
        {
            //***********
            //TV: 02/2009 - Issue # 4-002: changed Federation from DropDownList to multi-select ListBox

            //Populate Federation dropdown with the Federation of user and  disable it
            DataSet dsFedDetails = new DataSet();
            lstFederations.Items.Clear();
            if (_strFedID != "")
            {
                if (_strFedName != null)
                {
                    lstFederations.Items.Insert(0, new ListItem(_strFedName, _strFedID));
                }
                else
                {
                    dsFedDetails = _objGen.GetFederationDetails(_strFedID);
                    if (dsFedDetails != null)
                    {
                        lstFederations.Items.Insert(0, new ListItem(dsFedDetails.Tables[0].Rows[0]["Name"].ToString(), _strFedID));
                    }
                }
                txtHidFederations.Text       = _strFedID;
                lstFederations.SelectedValue = _strFedID;
            }
            else
            {
                lstFederations.Items.Insert(0, new ListItem("--Select--", "-1"));
            }



            lstFederations.Enabled = false;
            //***********

            //Populate Camp List with Camps associated with the Federation
            DataSet dsFedCamps;
            _objGen = new General();
            if (IsFederationHasAllCamps())
            {
                dsFedCamps              = _objGen.get_AllCampsList(ddlCampYear.SelectedItem.Text);
                lstCamps.DataSource     = dsFedCamps;
                lstCamps.DataTextField  = "Camp";
                lstCamps.DataValueField = "ID";
            }
            else
            {
                //***********
                //TV: 02/2009 - Issue # 4-002: changed Federation from DropDownList to multi-select ListBox,
                //call new overloaded method in the General class which accepts a comma delimted list of FedIDs

                //dsFedCamps = _objGen.GetFedCamps(Convert.ToInt32(_strFedID));
                dsFedCamps = _objGen.GetFedCamps(_strFedID, ddlCampYear.SelectedItem.Text);
                //***********

                lstCamps.DataSource     = dsFedCamps;
                lstCamps.DataTextField  = "Camp";
                lstCamps.DataValueField = "CampID";
            }

            lstCamps.DataBind();
            if ((lstCamps.Items.Count != 0))
            {
                lstCamps.Items.Insert(0, new ListItem("--Select--", "-1"));
            }

            //Populate Users dropdown with users associated with the Federation
            DataSet dsModifiedBy;
            _objGen                      = new General();
            dsModifiedBy                 = _objGen.GetUsersByFederation(_strFedID);
            ddlModifiedBy.DataSource     = dsModifiedBy;
            ddlModifiedBy.DataTextField  = "Name";
            ddlModifiedBy.DataValueField = "ID";
            ddlModifiedBy.DataBind();
            if ((ddlModifiedBy.Items.Count != 0))
            {
                ddlModifiedBy.Items.Insert(0, new ListItem("--Select--", "-1"));
            }
        }

        else if (_strRoleID == _strCampDir) //Camp Director
        {
            //***********
            //TV: 02/2009 - Issue # 4-002: changed Federation from DropDownList to multi-select ListBox

            //Set Federation dropdown to nothin and disable it
            lstFederations.Items.Clear();
            lstFederations.Items.Insert(0, new ListItem("--Select--", "-1"));
            lstFederations.Enabled = false;
            //***********

            //Populate Camp List with Camps associated with the Camp Director
            DataSet dsUsrCamps;
            _objGen    = new General();
            dsUsrCamps = _objGen.GetUserCamps(Convert.ToInt32(_strUsrID), Convert.ToInt32(Session["CampYear"]));
            lstCamps.Items.Clear();
            lstCamps.DataSource     = dsUsrCamps;
            lstCamps.DataTextField  = "Camp";
            lstCamps.DataValueField = "CampID";
            lstCamps.DataBind();
            if ((lstCamps.Items.Count != 0))
            {
                lstCamps.Items.Insert(0, new ListItem("--Select--", "-1"));
            }

            //Set Users dropdown to nothin and disable it
            ddlModifiedBy.Items.Insert(0, new ListItem("--Select--", "-1"));
            ddlModifiedBy.Enabled = false;
        }
        else if (_strRoleID == _strMovementAdmin) //Movement Camps admin
        {
            var dt = MovementDAL.GetMovementFedIDsByUserID(Convert.ToInt32(Session["UsrID"]));
            lstFederations.Items.Clear();
            lstFederations.DataSource     = dt;
            lstFederations.DataTextField  = "Federation";
            lstFederations.DataValueField = "ID";
            lstFederations.DataBind();
            if ((lstFederations.Items.Count != 0))
            {
                lstFederations.Items.Insert(0, new ListItem("--Select--", "-1"));
            }

            var result = (from myRow in dt.AsEnumerable()
                          select myRow.ItemArray[0].ToString()).ToArray();
            string fedIds = string.Join(",", result);

            var dsFedCamps = _objGen.GetFedCamps(fedIds, ddlCampYear.SelectedItem.Text);
            lstCamps.DataSource     = dsFedCamps;
            lstCamps.DataTextField  = "Camp";
            lstCamps.DataValueField = "CampID";

            lstCamps.DataBind();
            if ((lstCamps.Items.Count != 0))
            {
                lstCamps.Items.Insert(0, new ListItem("--Select--", "-1"));
            }

            //Populate Users dropdown with users associated with the Federation
            _objGen = new General();
            var dsModifiedBy = _objGen.GetUsersByFederation(_strFedID);
            ddlModifiedBy.DataSource     = dsModifiedBy;
            ddlModifiedBy.DataTextField  = "Name";
            ddlModifiedBy.DataValueField = "ID";
            ddlModifiedBy.DataBind();
            if ((ddlModifiedBy.Items.Count != 0))
            {
                ddlModifiedBy.Items.Insert(0, new ListItem("--Select--", "-1"));
            }
        }

        //Populate Status List
        DataSet dsStatus;

        _objGen                  = new General();
        dsStatus                 = _objGen.get_AllStatus();
        lstStatus.DataSource     = dsStatus;
        lstStatus.DataTextField  = "Status";
        lstStatus.DataValueField = "ID";
        lstStatus.DataBind();
        if ((lstStatus.Items.Count != 0))
        {
            lstStatus.Items.Insert(0, new ListItem("--Select--", "-1"));
        }

        //Populate Sort Column Names Dropdown
        ddlColums.Items.Insert(0, new ListItem("--Select--", "-1"));
        ddlColums.Items.Add(new ListItem("First Name", "FirstName"));
        ddlColums.Items.Add(new ListItem("Last Name", "LastName"));
        ddlColums.Items.Add(new ListItem("Email ID", "PersonalEmail"));
        ddlColums.Items.Add(new ListItem("FJCID", "FJCID"));
        ddlColums.Items.Add(new ListItem("Federation", "Federation"));
        ddlColums.Items.Add(new ListItem("Age", "Age"));
        ddlColums.Items.Add(new ListItem("Grade", "Grade"));
        ddlColums.Items.Add(new ListItem("Zip", "Zip"));
        ddlColums.Items.Add(new ListItem("Date Created", "CreatedDate"));
        ddlColums.Items.Add(new ListItem("Date Submitted", "SubmittedDate"));
        ddlColums.Items.Add(new ListItem("Last Updated Date", "ModifiedDate"));
        ddlColums.Items.Add(new ListItem("Modified By", "Admin"));
        ddlColums.Items.Add(new ListItem("Status", "Status"));

        //Populate Sort Order Dropdown
        ddlSortOrder.Items.Insert(0, new ListItem("--Select--", "-1"));
        ddlSortOrder.Items.Add(new ListItem("Ascending", "Asc"));
        ddlSortOrder.Items.Add(new ListItem("Descending", "Desc"));
    }
Exemplo n.º 3
0
    private void SetVals()
    {
        var strRole = (string)Session["RoleID"];
        var userId  = Convert.ToInt32(Session["UsrID"]);

        if (strRole == ConfigurationManager.AppSettings["CAMPDIRECTOR"])
        {
            //If logged in role is Camp Director show records for his camp(s) with status Elligible by Staff
            var     strUserCamps = string.Empty;
            DataSet dsUserCamps  = _objGen.GetUserCamps(userId, Convert.ToInt32(Session["CampYear"].ToString()));
            for (int i = 0; i <= dsUserCamps.Tables[0].Rows.Count - 1; i++)
            {
                if (strUserCamps == string.Empty)
                {
                    strUserCamps = dsUserCamps.Tables[0].Rows[i]["CampId"].ToString();
                }
                else
                {
                    strUserCamps = strUserCamps + "," + dsUserCamps.Tables[0].Rows[i]["CampId"].ToString();
                }
            }

            _objCamperDet.Camplist     = strUserCamps;
            _objCamperDet.FederationID = (string)ConfigurationManager.AppSettings["JWest"] + "," + (string)ConfigurationManager.AppSettings["JWestLA"];
            _objCamperDet.Status       = "7,10";
        }
        else if (strRole == ConfigurationManager.AppSettings["FEDADMIN"])
        {
            //If logged in role is Federation Admin, show records for his federation with status -
            //Elligible, Pending School Eligibility, Not Registered, Being Researched, Camp Full, Payment Review
            _objCamperDet.FederationID = (string)Session["FedId"];
            _objCamperDet.Status       = "1,2,6,7,9,12,14,20,21,42,43,45";
            if (_objCamperDet.FederationID == ((int)FederationEnum.PJL).ToString())
            {
                _objCamperDet.Status += ",46,47,48,49";
            }
        }
        else if (strRole == ConfigurationManager.AppSettings["FJCADMIN"])
        {
            //If logged in role is FJC Admin, show records for his federation with status -
            //Elligible, Pending School Eligibility, Not Registered, Being Researched, Camp Full, Payment Review
            _objCamperDet.FederationID = (string)ConfigurationManager.AppSettings["JWest"] + "," + (string)ConfigurationManager.AppSettings["JWestLA"];
            _objCamperDet.Status       = "1,2,6,9,12,14,20,21,27,43,45";
        }
        else if (strRole == ConfigurationManager.AppSettings["APPROVER"])
        {
            //if logged in role is Approver, show records with status - Second Approval
            _objCamperDet.Status = "15,16";
        }
        else if (strRole == "6") // Movement Camp Admin is 6
        {
            DataTable dt     = MovementDAL.GetMovementFedIDsByUserID(userId);
            var       result = (from myRow in dt.AsEnumerable()
                                select myRow.ItemArray[0].ToString()).ToArray();
            string fedIds = string.Join(",", result);

            _objCamperDet.FederationID = fedIds;
            _objCamperDet.Status       = "1,2,6,7,9,12,14,20,21,42,43,45";
        }

        //Show only items with WorkQueue Flag as true
        _objCamperDet.WorkQueue = true;
    }