Beispiel #1
0
    //to make the step1, step2, step 3 of the Questionnaire readonly if the camper has already
    //submitted the application (or) the application has been modified by the Admin
    private void MakeQuestionnaireReadonly()
    {
        string            strFJCID;
        DataSet           dsApplSubmitInfo = new DataSet();
        CamperApplication objCamperAppl    = new CamperApplication();
        DataRow           dr;
        Panel             PnlQuestion;
        string            strSubmittedDate;
        int iModifiedBy;
        int iCount;

        try
        {
            if (Session["FJCID"] != null)
            {
                strFJCID         = Session["FJCID"].ToString();
                strSubmittedDate = string.Empty;
                iModifiedBy      = Convert.ToInt32(CamperUserId);
                if (!string.IsNullOrEmpty(strFJCID) && UserId == CamperUserId)
                {
                    dsApplSubmitInfo = objCamperAppl.GetApplicationSubmittedInfo(strFJCID);
                    iCount           = dsApplSubmitInfo.Tables[0].Rows.Count;
                    if (iCount > 0)
                    {
                        dr = dsApplSubmitInfo.Tables[0].Rows[0];
                        //to get the submitted date
                        if (!dr["SUBMITTEDDATE"].Equals(DBNull.Value))
                        {
                            strSubmittedDate = dr["SUBMITTEDDATE"].ToString();
                        }

                        //to get the modified by user6
                        if (!dr["MODIFIEDUSER"].Equals(DBNull.Value))
                        {
                            iModifiedBy = Convert.ToInt32(dr["MODIFIEDUSER"]);
                        }

                        //to get the modified by user6
                        int status = 0;
                        if (!dr["Status"].Equals(DBNull.Value))
                        {
                            status = Convert.ToInt32(dr["Status"]);
                        }

                        //Camper Application has been submitted (or) the Application has been modified by a Admin
                        if (!string.IsNullOrEmpty(strSubmittedDate) || (iModifiedBy != Convert.ToInt32(CamperUserId) && iModifiedBy > 0 && status != (int)StatusInfo.WinnerPJLottery))
                        {
                            //to disable the controls in the panel (Panel1 and Panel2 in all the questionnaire)
                            for (int i = 1; i <= 2; i++)
                            {
                                PnlQuestion = (Panel)Content.FindControl("Panel" + i.ToString());
                                if (PnlQuestion != null)
                                {
                                    //PnlQuestion.Enabled = false;
                                    foreach (Control ctl in PnlQuestion.Controls)
                                    {
                                        switch (ctl.GetType().Name.ToUpper())
                                        {
                                        case "BUTTON":     //enable the buttons to navigate
                                            ((Button)ctl).Enabled = true;
                                            break;

                                        case "LABEL":
                                            ((Label)ctl).Enabled = false;
                                            break;

                                        case "TEXTBOX":
                                            ((TextBox)ctl).Enabled = false;
                                            break;

                                        case "RADIOBUTTON":
                                            ((RadioButton)ctl).Enabled = false;
                                            break;

                                        case "RADIOBUTTONLIST":
                                            ((RadioButtonList)ctl).Enabled = false;
                                            break;

                                        case "CHECKBOX":
                                            ((CheckBox)ctl).Enabled = false;
                                            break;

                                        case "CHECKBOXLIST":
                                            ((CheckBoxList)ctl).Enabled = false;
                                            break;

                                        case "DROPDOWNLIST":
                                            ((DropDownList)ctl).Enabled = false;
                                            break;

                                        case "PANEL":
                                            ((Panel)ctl).Enabled = false;
                                            break;

                                        case "CUSTOMVALIDATOR":
                                            ((CustomValidator)ctl).Enabled = false;
                                            break;

                                        case "REQUIREDFIELDVALIDATOR":
                                            ((RequiredFieldValidator)ctl).Enabled = false;
                                            break;

                                        case "RANGEVALIDATOR":
                                            ((RangeValidator)ctl).Enabled = false;
                                            break;

                                        case "ENROLLMENT_REGISTERCONTROLS_ASCX":
                                            if (ctl.Controls.Count > 1)
                                            {
                                                for (int cnt = 0; cnt < ctl.Controls.Count; cnt++)
                                                {
                                                    if (ctl.Controls[cnt].GetType().Name.ToUpper() == "RADIOBUTTON")
                                                    {
                                                        ((RadioButton)ctl.Controls[cnt]).Enabled = false;
                                                    }

                                                    if (ctl.Controls[cnt].GetType().Name.ToUpper() == "LABEL")
                                                    {
                                                        ((Label)ctl.Controls[cnt]).Enabled = false;
                                                    }
                                                }
                                            }
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        finally
        {
            objCamperAppl    = null;
            dsApplSubmitInfo = null;
        }
    }
Beispiel #2
0
    private void getGenders(string strFJCID, string Gender)
    {
        DataSet dtGenders;

        dtGenders                = CamperAppl.get_Genders();
        ddlGender.DataSource     = dtGenders;
        ddlGender.DataTextField  = "Description";
        ddlGender.DataValueField = "ID";
        ddlGender.DataBind();

        //Site x = Page.Master as Site;
        MasterPage x = Page.Master;;


        if (Session["CamperLoginID"] == null) //admin user
        {
            if (Gender.Equals(string.Empty))  //gender was not selected
            {
                ddlGender.Items.Insert(0, new ListItem("", "-1"));
                lblStarGender.Text = "&nbsp;&nbsp;";
            }
            else //gender was selected
            {
                ddlGender.Items.Insert(0, new ListItem("", "-1"));
                ddlGender.SelectedValue = Gender;
                lblStarGender.Text      = "&nbsp;&nbsp;";
            }
        }
        else // camper
        {
            if (string.IsNullOrEmpty(strFJCID)) //new camper
            {
                ddlGender.Items.Insert(0, new ListItem("-- Select --", "0"));
                lblStarGender.Text = "*";
            }
            else if (Gender.Equals(string.Empty)) //gender was not selected
            {
                CamperApplication objCamperAppl    = new CamperApplication();
                DataSet           dsApplSubmitInfo = objCamperAppl.GetApplicationSubmittedInfo(strFJCID);

                if (dsApplSubmitInfo.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = dsApplSubmitInfo.Tables[0].Rows[0];

                    //get submitted date
                    string strSubmittedDate = string.Empty;;
                    if (!dr["SUBMITTEDDATE"].Equals(DBNull.Value))
                    {
                        strSubmittedDate = dr["SUBMITTEDDATE"].ToString();
                    }

                    //to get the modified by user6
                    int    iModifiedBy;
                    string CamperUserId = ConfigurationManager.AppSettings["CamperModifiedBy"].ToString();
                    iModifiedBy = Convert.ToInt32(CamperUserId);
                    if (!dr["MODIFIEDUSER"].Equals(DBNull.Value))
                    {
                        iModifiedBy = Convert.ToInt32(dr["MODIFIEDUSER"]);
                    }

                    //Camper Application has been submitted (or) the Application has been modified by a Admin
                    if (!string.IsNullOrEmpty(strSubmittedDate) || (iModifiedBy != Convert.ToInt32(CamperUserId) && iModifiedBy > 0))
                    {
                        ddlGender.Items.Insert(0, new ListItem("", "-1"));
                        lblStarGender.Text = "&nbsp;&nbsp;";
                    }
                    else
                    {
                        ddlGender.Items.Insert(0, new ListItem("-- Select --", "0"));
                        lblStarGender.Text = "*";
                    }
                }
                else //should not happen
                {
                    ddlGender.Items.Insert(0, new ListItem("-- Select --", "0"));
                    lblStarGender.Text = "*";
                }
            }
            else //gender was selected
            {
                ddlGender.SelectedValue = Gender;
                lblStarGender.Text      = "*";
            }
        }
    }