protected void SetColors()
    {
        var dt = new DataTable();

        dt = OleDbTools.GetDataTable("SELECT SignInFormControl, SignInFormColor FROM SignInFormColor");
        foreach (DataRow row in dt.Rows)
        {
            string myControl = row.ItemArray[0].ToString();
            if (myControl == "Page Background")
            {
                pagebody.Attributes.Add("bgcolor", row.ItemArray[1].ToString());
            }
            else
            {
                this.Session[myControl + "Color"] = row.ItemArray[1].ToString();
            }
        }
        PhotoPanel.BackColor           = System.Drawing.ColorTranslator.FromHtml(this.Session["Section BackgroundColor"].ToString());
        PersonalInfoPanel.BackColor    = System.Drawing.ColorTranslator.FromHtml(this.Session["Section BackgroundColor"].ToString());
        AddressPanel.BackColor         = System.Drawing.ColorTranslator.FromHtml(this.Session["Section BackgroundColor"].ToString());
        lblPersonalInfoPanel.ForeColor = System.Drawing.ColorTranslator.FromHtml(this.Session["Section TextColor"].ToString());
        lblAddressPanel.ForeColor      = System.Drawing.ColorTranslator.FromHtml(this.Session["Section TextColor"].ToString());
        CertifiedDiver.ForeColor       = System.Drawing.ColorTranslator.FromHtml(this.Session["Section TextColor"].ToString());
        lblCamera.ForeColor            = System.Drawing.ColorTranslator.FromHtml(this.Session["Section TextColor"].ToString());
        lblFileUpload.ForeColor        = System.Drawing.ColorTranslator.FromHtml(this.Session["Section TextColor"].ToString());
    }
        public Country(string CountryID)
        {
            _CountryID = CountryID;
            DataTable srs = new DataTable();

            srs          = OleDbTools.GetDataTable("Select CountryName from Country Where CountryID = " + _CountryID);
            _CountryName = srs.Rows[0]["CountryName"].ToString();
        }
 public State(string StateID)
 {
     _StateID = StateID;
     if (StateID == "0")
     {
         _StateName = "--Select--";
     }
     else
     {
         DataTable srs;
         srs        = OleDbTools.GetDataTable("Select StateName from State Where StateID = " + StateID);
         _StateName = srs.Rows[0]["StateName"].ToString();
     }
 }
    protected void prevCustClick(Object Sender, EventArgs E)
    {
        CustomerNumberError.Style["color"] = "red";
        if (CustomerNumber.Text == null)
        {
            CustomerNumberError.Visible = true;
            CustomerNumberError.Text    = "Please provide a customer number.";
            FirstName.Text = "";
            LastName.Text  = "";
            prevCustomerModal.Style["display"] = "table";
            return;
        }
        float output;

        if (!float.TryParse(CustomerNumber.Text, out output))
        {
            CustomerNumberError.Visible = true;
            CustomerNumberError.Text    = "Please enter a valid number.";
            FirstName.Text = "";
            LastName.Text  = "";
            prevCustomerModal.Style["display"] = "table";
            return;
        }
        var dt = new DataTable();

        dt = OleDbTools.GetDataTable("SELECT * FROM Customer WHERE CustomerID = " + CustomerNumber.Text);
        if (dt.Rows.Count > 0)
        {
            DataRow dr = dt.Rows[0];
            InitializeCustomer(dr);
            CustomerNumberError.Text           = "Customer " + FirstName.Text + " " + LastName.Text + " Found";
            CustomerNumberError.Style["color"] = "green";
            CustomerNumberHidden.Value         = CustomerNumber.Text;
            prevCustomerModal.Style["display"] = "none";
        }
        else
        {
            CustomerNumberError.Style["color"] = "red";
            CustomerNumberError.Text           = "Customer Number not found.";
            FirstName.Text = "";
            LastName.Text  = "";
            prevCustomerModal.Style["display"] = "table";
        }
    }
        public static void InitCountries()
        {
            Countries = new List <Country>();
            DataTable srs = new DataTable();

            srs = OleDbTools.GetDataTable("Select * from Country Left JOIN [State] on State.CountryID = Country.CountryID ORDER BY CountryName, StateName");
            double PrevCountryID = -999;

            foreach (DataRow dr in srs.Rows)
            {
                if (PrevCountryID != Convert.ToDouble(dr["Country.CountryID"]))
                {
                    Countries.Add(new Country(dr["Country.CountryID"].ToString(), dr["CountryName"].ToString(), (dr["StateID"] != DBNull.Value)));

                    PrevCountryID = Convert.ToDouble(dr["Country.CountryID"]);
                }
                if ((dr["StateID"] != DBNull.Value))
                {
                    Countries[Countries.Count - 1]._States.Add(new State(dr["StateID"].ToString(), dr["StateName"].ToString()));
                }
            }
        }
    static void InitCountries()
    {
        List <Country> Countries = new List <Country>();
        DataTable      srs       = new DataTable();

        srs = OleDbTools.GetDataTable("Select * from Country Left JOIN [State] on State.CountryID = Country.Country ID ORDER BY CountryName, StateName");
        double PrevCountryID = -999;

        foreach (dr in srs.Rows)
        {
            if (PrevCountryID != dr[CountryID])
            {
                Countries.Add(new Country(dr[CountryID], dr[CountryName], Not(dr[StateID] = DBNull)));

                PrevCountryID = dr[CountryID];
            }
            if ((dr[StateID] != DBNull))
            {
                Countries(Countries.Count - 1).States.Add(new State(dr[StateID], dr[StateName]));
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.Session["imgFilePath"] = "";
            Country.InitCountries();
            CountryID.DataSource = Country.Countries;
            CountryID.DataBind();
            Insurance.SelectedValue       = "-1";
            CertifiedDiver.SelectedValue  = "-1";
            EmergencyCountryID.DataSource = Country.Countries;
            EmergencyCountryID.DataBind();
            NationalityCountryID.DataSource = Country.Countries;
            NationalityCountryID.DataBind();
            HowHearTextID.DataBind();
            WhereStayID.DataBind();
            DiveLevelID.DataBind();
            DiveOrgID.DataBind();
            LanguageID.DataBind();
            CheckinInstructorID.DataBind();
            //Add blank item at index 0
            CountryID.Items.Insert(0, new ListItem("--Select--", "0"));
            CountryID.SelectedIndex = -1;
            EmergencyCountryID.Items.Insert(0, new ListItem("--Select--", "0"));
            EmergencyCountryID.SelectedIndex = -1;
            NationalityCountryID.Items.Insert(0, new ListItem("--Select--", "0"));
            NationalityCountryID.SelectedIndex = -1;
            Gender.Items.Insert(0, new ListItem("--Select--", "0"));
            DiveOrgID.Items.Insert(0, new ListItem("--Select--", "0"));
            DiveLevelID.Items.Insert(0, new ListItem("--Select--", "0"));
            WhereStayID.Items.Insert(0, new ListItem("--Select--", "0"));
            HowHearTextID.Items.Insert(0, new ListItem("--Select--", "0"));
            LanguageID.Items.Insert(0, new ListItem("--Select--", "0"));
            CheckinInstructorID.Items.Insert(0, new ListItem("--Select--", "0"));

            var Termsdt = new DataTable();
            Termsdt = OleDbTools.GetDataTable("SELECT TermsText, ShowTerms, [Language] FROM GlobalSettings, [Language] WHERE GlobalSettings.LanguageID = [Language].LanguageID");
            if (Termsdt.Rows[0]["ShowTerms"].ToString() == "True")
            {
                this.Session["ShowTerms"] = true;
                pTerms.InnerHtml          = Termsdt.Rows[0].ItemArray[0].ToString().Replace(System.Environment.NewLine, "<br />");
            }
            else
            {
                this.Session["ShowTerms"] = false;
            }
            SetColors();

            string language = Termsdt.Rows[0]["Language"].ToString();
            optLanguage.SelectedValue = language;

            var sectionsdt = new DataTable();
            sectionsdt = OleDbTools.GetDataTable("SELECT * FROM RegisterFormSection");
            var fieldsdt = new DataTable();
            fieldsdt = OleDbTools.GetDataTable("SELECT * FROM RegisterFormField WHERE RegisterFormSectionID in (Select RegisterFormSectionID From RegisterFormSection WHERE Display=True)");
            this.Session["sectionsdt"] = sectionsdt;
            this.Session["fieldsdt"]   = fieldsdt;
            ChangeForm();
            if (useCamera.ToLower() == "yes")
            {
                FileUploadValidator.Enabled = false;
            }
        }
    }