protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //-------------------------------------------------------------------------------------------------------------------
            // Adding meta Discription
            HtmlMeta objMeta = new HtmlMeta();
            objMeta.Name    = "Description";
            objMeta.Content = WebConfig.GetValues("MetaDiscription");
            this.Header.Controls.Add(objMeta);
            //-------------------------------------------------------------------------------------------------------------------
            // Adding meta KeyWords
            objMeta         = new HtmlMeta();
            objMeta.Name    = "keywords";
            objMeta.Content = WebConfig.GetValues("MetaKeword");
            this.Header.Controls.Add(objMeta);
            //-------------------------------------------------------------------------------------------------------------------
            //Connect To database
            //Laod Religion
            //-------------------------------------------------------------------------------------------------------------------
            LB_Religion.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Religion);;
            LB_Religion.DataTextField  = "Item";
            LB_Religion.DataValueField = "Value";
            LB_Religion.DataBind();
            LB_Religion.Items.RemoveAt(0);
            //Laod Caste
            //-------------------------------------------------------------------------------------------------------------------
            LB_Caste.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Cast);;
            LB_Caste.DataTextField  = "Item";
            LB_Caste.DataValueField = "Value";
            LB_Caste.DataBind();
            LB_Caste.Items.RemoveAt(0);
            //Load Education
            //-------------------------------------------------------------------------------------------------------------------
            LB_Education.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Education);;
            LB_Education.DataTextField  = "Item";
            LB_Education.DataValueField = "Value";
            LB_Education.DataBind();
            LB_Education.Items.RemoveAt(0);
            //Load Occupation
            //-------------------------------------------------------------------------------------------------------------------
            LB_Occupation.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Occupation);;
            LB_Occupation.DataTextField  = "Item";
            LB_Occupation.DataValueField = "Value";
            LB_Occupation.DataBind();
            LB_Occupation.Items.RemoveAt(0);
            //Load Country
            //-------------------------------------------------------------------------------------------------------------------
            LB_Country.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Country);;
            LB_Country.DataTextField  = "Item";
            LB_Country.DataValueField = "Value";
            LB_Country.DataBind();
            LB_Country.Items.RemoveAt(0);
            //-------------------------------------------------------------------------------------------------------------------
            Int16 Int16Counter;
            DDL_Height_Min.Items.Insert(0, "-- Select --");
            DDL_Height_Max.Items.Insert(0, "-- Select --");
            for (Int16Counter = 90; Int16Counter <= 185; ++Int16Counter)
            {
                DDL_Height_Min.Items.Insert(Int16Counter - 89, Int16Counter + " CM");
                DDL_Height_Max.Items.Insert(Int16Counter - 89, Int16Counter + 1 + " CM");
            }
            //-------------------------------------------------------------------------------------------------------------------
        }
        else
        {
            //Adding Select
            //-------------------------------------------------------------------------------------------------------------------
            string strSQL = "SELECT MatrimonialMemberShip.MatrimonialID ";
            //-------------------------------------------------------------------------------------------------------------------
            // Adding Innerjoining statment depending on Photo
            //-------------------------------------------------------------------------------------------------------------------
            if (CB_needPhoto.Checked)
            {
                strSQL += "   FROM  UserAuthentication INNER JOIN "
                          + " UserBasicInformation ON MatrimonialMemberShip.ApplicationID = UserBasicInformation.ApplicationID INNER JOIN"
                          + " UserContactInformations ON MatrimonialMemberShip.ApplicationID = UserContactInformations.ApplicationID INNER JOIN"
                          + " UserEducationAndOccupation ON MatrimonialMemberShip.ApplicationID = UserEducationAndOccupation.ApplicationID INNER JOIN"
                          + " UserPhysicalAttributes ON MatrimonialMemberShip.ApplicationID = UserPhysicalAttributes.ApplicationID INNER JOIN"
                          + " UserAlbum ON MatrimonialMemberShip.ApplicationID = UserAlbum.ApplicationID";
            }
            else//-------------------------------------------------------------------------------------------------------------------
            {
                strSQL += "    FROM  UserAuthentication INNER JOIN"
                          + " UserBasicInformation ON MatrimonialMemberShip.ApplicationID = UserBasicInformation.ApplicationID INNER JOIN"
                          + " UserContactInformations ON MatrimonialMemberShip.ApplicationID = UserContactInformations.ApplicationID INNER JOIN"
                          + " UserEducationAndOccupation ON MatrimonialMemberShip.ApplicationID = UserEducationAndOccupation.ApplicationID INNER JOIN"
                          + " UserPhysicalAttributes ON MatrimonialMemberShip.ApplicationID = UserPhysicalAttributes.ApplicationID";
            }
            //-------------------------------------------------------------------------------------------------------------------
            // Adding Filter
            //-------------------------------------------------------------------------------------------------------------------
            string SQLWHERE = " WHERE (";
            //-------------------------------------------------------------------------------------------------------------------
            SQLWHERE += " ( ";
            //-------------------------------------------------------------------------------------------------------------------
            // Basic Deteils
            //-------------------------------------------------------------------------------------------------------------------
            SQLWHERE += " (( MatrimonialMemberShip.Membership = 5)OR(MatrimonialMemberShip.Membership = 6 ))  AND (MatrimonialMemberShip.Hidden IS NULL) ";
            //-------------------------------------------------------------------------------------------------------------------
            if (RB_Looking_male.Checked)
            {
                SQLWHERE += " AND ( UserBasicInformation.Gender = 1) ";
            }
            else
            {
                SQLWHERE += " AND ( UserBasicInformation.Gender = 0) ";
            }
            //-------------------------------------------------------------------------------------------------------------------
            SQLWHERE += " AND (DATEDIFF(year,UserBasicInformation.DOB, getdate()) BETWEEN " + TB_Age_Min.Text + " AND " + TB_Age_Max.Text + ") ";

            //-------------------------------------------------------------------------------------------------------------------
            SQLWHERE += " )"
                        + " AND";
            //-------------------------------------------------------------------------------------------------------------------

            // NonBasic Details
            SQLWHERE += " ( ";
            //-------------------------------------------------------------------------------------------------------------------
            //Height
            //-------------------------------------------------------------------------------------------------------------------
            string strOptionalAnd = " ";
            if (DDL_Height_Max.SelectedIndex > 0)
            {
                SQLWHERE      += "( UserPhysicalAttributes.Height BETWEEN " + (DDL_Height_Min.SelectedIndex + 90).ToString() + " AND " + (DDL_Height_Max.SelectedIndex + 90).ToString() + " )";
                strOptionalAnd = " AND "; //Setting Flag
            }
            //-------------------------------------------------------------------------------------------------------------------
            //          Maritals Status
            //-------------------------------------------------------------------------------------------------------------------
            if ((CB_MaritalStatus_UM.Checked) || (CB_MaritalStatus_Div.Checked) || (CB_MaritalStatus_WW.Checked) || (CB_MaritalStatus_Sep.Checked))
            {
                //Setting Flag
                string strOptionalOr = " ";
                SQLWHERE += strOptionalAnd + " ( ";
                if (CB_MaritalStatus_UM.Checked)
                {
                    SQLWHERE     += " UserBasicInformation.MaritalStatus = 1 ";
                    strOptionalOr = " OR ";//Setting Flag
                }
                if (CB_MaritalStatus_WW.Checked)
                {
                    SQLWHERE     += strOptionalOr + " UserBasicInformation.MaritalStatus = 2 ";
                    strOptionalOr = " OR ";//Setting Flag
                }
                if (CB_MaritalStatus_Div.Checked)
                {
                    SQLWHERE     += strOptionalOr + " UserBasicInformation.MaritalStatus = 3 ";
                    strOptionalOr = " OR ";//Setting Flag
                }
                if (CB_MaritalStatus_Sep.Checked)
                {
                    SQLWHERE += strOptionalOr + " UserBasicInformation.MaritalStatus = 4 ";
                }
                SQLWHERE      += " ) ";
                strOptionalAnd = " AND ";
            } //End OF MaritalStatus
            //-------------------------------------------------------------------------------------------------------------------
            //          SubCast
            //-------------------------------------------------------------------------------------------------------------------
            if (TB_Subcast.Text == null)
            {
                SQLWHERE      += " AND ( FREETEXT(UserBasicInformation.SubCast,'" + TB_Subcast.Text + "' )";
                strOptionalAnd = " AND "; //Setting Flag
            }
            //-------------------------------------------------------------------------------------------------------------------
            //Adding Religion
            //-------------------------------------------------------------------------------------------------------------------
            if (!CB_Religion_Any.Checked)
            {
                SQLWHERE += strOptionalAnd;
                SQLWHERE += " ( ";
                string strOptionalOr = " ";
                foreach (ListItem listItem in LB_Religion.Items)
                {
                    if (listItem.Selected)
                    {
                        strOptionalAnd = " AND ";
                        SQLWHERE      += strOptionalOr + " UserBasicInformation.Religion = " + listItem.Value;
                        strOptionalOr  = " OR ";
                    }
                }
                SQLWHERE += " ) ";
            }
            //-------------------------------------------------------------------------------------------------------------------
            //   Caste
            //-------------------------------------------------------------------------------------------------------------------
            if (!CB_Caste_Any.Checked)
            {
                SQLWHERE += strOptionalAnd;
                SQLWHERE += " ( ";
                string strOptionalOr = " ";
                foreach (ListItem listItem in LB_Caste.Items)
                {
                    if (listItem.Selected)
                    {
                        strOptionalAnd = " AND ";
                        SQLWHERE      += strOptionalOr + " UserBasicInformation.Cast = " + listItem.Value;
                        strOptionalOr  = " OR ";
                    }
                }
                SQLWHERE += " ) ";
            }

            //-------------------------------------------------------------------------------------------------------------------
            //      Education
            //-------------------------------------------------------------------------------------------------------------------

            if (!CB_Education_Any.Checked)
            {
                SQLWHERE += strOptionalAnd;
                SQLWHERE += " ( ";
                string strOptionalOr = " ";
                foreach (ListItem listItem in LB_Education.Items)
                {
                    if (listItem.Selected)
                    {
                        strOptionalAnd = " AND ";
                        SQLWHERE      += strOptionalOr + " UserEducationAndOccupation.Education = " + listItem.Value;
                        strOptionalOr  = " OR ";
                    }
                }
                SQLWHERE += " ) ";
            }
            //-------------------------------------------------------------------------------------------------------------------
            //  Occupation
            //-------------------------------------------------------------------------------------------------------------------
            if (!CB_Occupation_any.Checked)
            {
                SQLWHERE += strOptionalAnd;
                SQLWHERE += " ( ";
                string strOptionalOr = " ";
                foreach (ListItem listItem in LB_Occupation.Items)
                {
                    if (listItem.Selected)
                    {
                        strOptionalAnd = " AND ";
                        SQLWHERE      += strOptionalOr + "  UserEducationAndOccupation.Occupation = " + listItem.Value;
                        strOptionalOr  = " OR ";
                    }
                }
                SQLWHERE += " ) ";
            }
            //-------------------------------------------------------------------------------------------------------------------
            //      Country
            //-------------------------------------------------------------------------------------------------------------------
            if (!CB_Country_Any.Checked)
            {
                SQLWHERE += strOptionalAnd;
                SQLWHERE += " ( ";
                string strOptionalOr = " ";
                foreach (ListItem listItem in LB_Country.Items)
                {
                    if (listItem.Selected)
                    {
                        strOptionalAnd = " AND ";
                        SQLWHERE      += strOptionalOr + "  UserContactInformations.Country = " + listItem.Value;
                        strOptionalOr  = " OR ";
                    }
                }
                SQLWHERE += " ) ";
            }
            //-------------------------------------------------------------------------------------------------------------------
            //      Closing Query
            //-------------------------------------------------------------------------------------------------------------------
            SQLWHERE += " ) ) ";
            strSQL   += SQLWHERE;
            //-------------------------------------------------------------------------------------------------------------------
            string strRandom = RandomString.Generate(5, 7);
            Session.Add(strRandom, strSQL);
            //-------------------------------------------------------------------------------------------------------------------
            //Server.Transfer("" + strRandom);
            Response.Redirect("SearchResult.aspx?typ=5&str=" + strRandom);
            //-------------------------------------------------------------------------------------------------------------------
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Adding meta Discription
            HtmlMeta objMeta = new HtmlMeta();
            objMeta.Name    = "Description";
            objMeta.Content = WebConfig.GetValues("MetaDiscription");
            this.Header.Controls.Add(objMeta);

            // Adding meta KeyWords
            objMeta         = new HtmlMeta();
            objMeta.Name    = "keywords";
            objMeta.Content = WebConfig.GetValues("MetaKeword");
            this.Header.Controls.Add(objMeta);

            /// Text Counter Initiallisation

            txtCount.Text = TB_Expectations.MaxLength.ToString();

            TB_Expectations.Attributes.Add("onKeyUp", "javascript:document.getElementById('" + txtCount.ClientID + "').setAttribute('value', (" + TB_Expectations.MaxLength +
                                           " - parseInt(document.getElementById('" + TB_Expectations.ClientID + "').getAttribute('value').length)));");

            //load ddls
            //Getting Connection String

            //Connect To database
            LB_MaritalStatus.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.MaritalStatus);
            LB_MaritalStatus.DataTextField  = "Item";
            LB_MaritalStatus.DataValueField = "Value";
            LB_MaritalStatus.DataBind();
            LB_MaritalStatus.Items.RemoveAt(0);

            LB_Complexion.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Complexion);
            LB_Complexion.DataTextField  = "Item";
            LB_Complexion.DataValueField = "Value";
            LB_Complexion.DataBind();
            LB_Complexion.Items.RemoveAt(0);

            LB_MotherTongue.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.MotherTongue);
            LB_MotherTongue.DataTextField  = "Item";
            LB_MotherTongue.DataValueField = "Value";
            LB_MotherTongue.DataBind();
            LB_MotherTongue.Items.RemoveAt(0);

            LB_Religion.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Religion);
            LB_Religion.DataTextField  = "Item";
            LB_Religion.DataValueField = "Value";
            LB_Religion.DataBind();
            LB_Religion.Items.RemoveAt(0);

            LB_Caste.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Cast);
            LB_Caste.DataTextField  = "Item";
            LB_Caste.DataValueField = "Value";
            LB_Caste.DataBind();
            LB_Caste.Items.RemoveAt(0);
            LB_Caste.Items.RemoveAt(0);
            LB_Caste.Items.Insert(0, "Any");

            LB_Education.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Education);
            LB_Education.DataTextField  = "Item";
            LB_Education.DataValueField = "Value";
            LB_Education.DataBind();
            LB_Education.Items.RemoveAt(0);
            LB_Education.Items.Insert(0, "Any");


            LB_Edudetails.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.EduDetails);
            LB_Edudetails.DataTextField  = "Item";
            LB_Edudetails.DataValueField = "Value";
            LB_Edudetails.DataBind();
            LB_Edudetails.Items.RemoveAt(0);
            LB_Edudetails.Items.Insert(0, "Any");

            LB_AnnulIncome.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.AnnualIncomeRange);
            LB_AnnulIncome.DataTextField  = "Item";
            LB_AnnulIncome.DataValueField = "Value";
            LB_AnnulIncome.DataBind();
            LB_AnnulIncome.Items.RemoveAt(0);

            LB_Occupation.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Occupation);
            LB_Occupation.DataTextField  = "Item";
            LB_Occupation.DataValueField = "Value";
            LB_Occupation.DataBind();
            LB_Occupation.Items.RemoveAt(0);
            LB_Occupation.Items.Insert(0, "Any");

            LB_Citizenship.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Country);
            LB_Citizenship.DataTextField  = "Item";
            LB_Citizenship.DataValueField = "Value";
            LB_Citizenship.DataBind();
            LB_Citizenship.Items.RemoveAt(0);
            LB_Citizenship.Items.Insert(0, "Any");

            LB_CountryLiving.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Country);
            LB_CountryLiving.DataTextField  = "Item";
            LB_CountryLiving.DataValueField = "Value";
            LB_CountryLiving.DataBind();
            LB_CountryLiving.Items.RemoveAt(0);
            LB_CountryLiving.Items.Insert(0, "Any");

            LB_Rasident_State.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.State);
            LB_Rasident_State.DataTextField  = "Item";
            LB_Rasident_State.DataValueField = "Value";
            LB_Rasident_State.DataBind();
            LB_Rasident_State.Items.RemoveAt(0);
            LB_Rasident_State.Items.Insert(0, "Any");

            LB_Rasident_Status.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.ResidenceStatus);
            LB_Rasident_Status.DataTextField  = "Item";
            LB_Rasident_Status.DataValueField = "Value";
            LB_Rasident_Status.DataBind();
            LB_Rasident_Status.Items.RemoveAt(0);
            LB_Rasident_Status.Items.Insert(0, "Any");

            DDL_ChDosham.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.HoroManglic);
            DDL_ChDosham.DataTextField  = "Item";
            DDL_ChDosham.DataValueField = "Value";
            DDL_ChDosham.DataBind();
            DDL_ChDosham.Items.RemoveAt(5);


            DDL_EathingHabits.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Diet);
            DDL_EathingHabits.DataTextField  = "Item";
            DDL_EathingHabits.DataValueField = "Value";
            DDL_EathingHabits.DataBind();

            Int16 Int16Counter;
            DDL_Height_min.Items.Insert(0, "-- Select --");
            DDL_Height_Max.Items.Insert(0, "-- Select --");
            for (Int16Counter = 90; Int16Counter <= 185; ++Int16Counter)
            {
                DDL_Height_min.Items.Insert(Int16Counter - 89, Int16Counter + " CM");
                DDL_Height_Max.Items.Insert(Int16Counter - 89, Int16Counter + 1 + " CM");
            }


            TB_NonIndianState.Attributes.Add("visible", "false");
        }
        else
        {
            HttpCookieCollection objHttpCookieCollection = Request.Cookies;
            HttpCookie           objHttpCookie           = objHttpCookieCollection.Get("MatRegInfo");

            strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]);

            // Inserting data into database
            if (strApplicationID != null)
            {
                sbyte sbyteFlag = 0;
                sbyte sbyteChildrenStatus;
                sbyte sbytePhysicalStatus;

                //-------------------------------------------------------------------------------------------------------------
                if (RB_ChildrenNO.Checked)
                {
                    sbyteChildrenStatus = 1;
                }
                else if (RB_ChildrenYesLT.Checked)
                {
                    sbyteChildrenStatus = 2;
                }
                else if (RB_ChildrenYesNLT.Checked)
                {
                    sbyteChildrenStatus = 3;
                }
                else if (RB_ChildrenDM.Checked)
                {
                    sbyteChildrenStatus = 4;
                }
                else
                {
                    sbyteChildrenStatus = 0;
                }

                //-------------------------------------------------------------------------------------------------------------

                if (RB_phy_nor.Checked)
                {
                    sbytePhysicalStatus = 1;
                }
                else if (RB_phy_Dis.Checked)
                {
                    sbytePhysicalStatus = 2;
                }
                else if (RB_phy_DMater.Checked)
                {
                    sbytePhysicalStatus = 3;
                }
                else
                {
                    sbytePhysicalStatus = 0;
                }

                //-------------------------------------------------------------------------------------------------------------

                // Loading Values From LB

                string strMaritalStatusList = "";
                string Flag = "";
                // Marital Status
                foreach (ListItem objListItem in LB_MaritalStatus.Items)
                {
                    if (objListItem.Selected)
                    {
                        strMaritalStatusList += Flag + objListItem.Value;
                        Flag = "%";
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Complexion
                string strComplexionList = "";

                Flag = "";

                foreach (ListItem objListItem in LB_Complexion.Items)
                {
                    if (objListItem.Selected)
                    {
                        strComplexionList += Flag + objListItem.Value;
                        Flag = "%";
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Mother Tongue
                string strMotherTongueList = "";

                Flag = "";

                foreach (ListItem objListItem in LB_MotherTongue.Items)
                {
                    if (objListItem.Selected)
                    {
                        strMotherTongueList += Flag + objListItem.Value;
                        Flag = "%";
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Religion
                string strReligionList = "";
                if (CB_Religion_Any.Checked)
                {
                    strReligionList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Religion.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strReligionList += Flag + objListItem.Value;
                            Flag             = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                //Caste
                string strCasteList = "";
                if (CB_Caste_Any.Checked)
                {
                    strCasteList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Caste.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strCasteList += Flag + objListItem.Value;
                            Flag          = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Education
                string strEducationList = "";
                if (CB_Education_Any.Checked)
                {
                    strEducationList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Education.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strEducationList += Flag + objListItem.Value;
                            Flag              = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // EduDetails
                string strEduDetailsList = "";
                if (CB_EduDet.Checked)
                {
                    strEduDetailsList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Edudetails.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strEduDetailsList += Flag + objListItem.Value;
                            Flag = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Occupation
                string strOccupationList = "";
                if (CB_Occupation_any.Checked)
                {
                    strOccupationList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Occupation.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strOccupationList += Flag + objListItem.Value;
                            Flag = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Citizenship
                string strCitizenshipList = "";
                if (CB_IndianX.Checked)
                {
                    strCitizenshipList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Citizenship.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strCitizenshipList += Flag + objListItem.Value;
                            Flag = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Country Living in
                string strCountryLivinginList = "";
                if (CB_Indian.Checked)
                {
                    strCountryLivinginList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Citizenship.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strCountryLivinginList += Flag + objListItem.Value;
                            Flag = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Country Living in
                string strStateList = "";
                if (!CB_StatesInIndia.Checked)
                {
                    strStateList = TB_NonIndianState.Text + "#";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Rasident_State.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strStateList += Flag + objListItem.Value;
                            Flag          = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                //Residential Status
                string strResidentStatus = "";
                Flag = "";
                foreach (ListItem objListItem in LB_Rasident_Status.Items)
                {
                    if (objListItem.Selected)
                    {
                        strResidentStatus += Flag + objListItem.Value;
                        Flag = "%";
                    }
                }
                //--------------------------------------------------------------------------------------------------------------
                sbyteFlag = MatrimonialProfileManager.InsertMyExpectation(strApplicationID, TB_Expectations.Text);
                //--------------------------------------------------------------------------------------------------------------
                sbyteFlag += MatrimonialProfileManager.InsertPartnerPreferance(strApplicationID, strMaritalStatusList, sbyte.Parse(TB_Age_min.Text),
                                                                               sbyte.Parse(TB_Age_Max.Text), strComplexionList, sbyteChildrenStatus, (DDL_Height_min.SelectedIndex + 89), (DDL_Height_Max.SelectedIndex + 89),
                                                                               sbytePhysicalStatus, strMotherTongueList, strReligionList, strCasteList, DDL_ChDosham.SelectedIndex, DDL_EathingHabits.SelectedIndex,
                                                                               strEducationList, strEduDetailsList, LB_AnnulIncome.SelectedIndex, strOccupationList, strCitizenshipList, strCountryLivinginList,
                                                                               strStateList, strResidentStatus);
                //--------------------------------------------------------------------------------------------------------------

                if (sbyteFlag == 2)
                {
                    MatrimonialMemberShip.UpdateIndex(strApplicationID);
                    Server.Transfer("RegistrationConfirm.aspx");
                }
                else
                {
                    Server.Transfer("../Extras/ErrorReport.aspx");
                }
            }
            else
            {
            }
        }
    }
    private void LoadStep4()
    {
        L_Success.Visible = true;

        txtCount.Text = TB_Expectations.MaxLength.ToString();

        /// Text Counter Initiallisation

        TB_Expectations.Attributes.Add("onKeyUp",
                                       "javascript:document.getElementById('" + txtCount.ClientID +
                                       "').setAttribute('value', (" + TB_Expectations.MaxLength +
                                       " - parseInt(document.getElementById('" + TB_Expectations.ClientID +
                                       "').getAttribute('value').length)));");


        //load ddls
        //Getting Connection String

        LB_MaritalStatus.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.MaritalStatus);
        LB_MaritalStatus.DataTextField  = "Item";
        LB_MaritalStatus.DataValueField = "Value";
        LB_MaritalStatus.DataBind();
        LB_MaritalStatus.Items.RemoveAt(0);

        LB_Complexion.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Complexion);
        LB_Complexion.DataTextField  = "Item";
        LB_Complexion.DataValueField = "Value";
        LB_Complexion.DataBind();
        LB_Complexion.Items.RemoveAt(0);

        LB_MotherTongue.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.MotherTongue);
        LB_MotherTongue.DataTextField  = "Item";
        LB_MotherTongue.DataValueField = "Value";
        LB_MotherTongue.DataBind();
        LB_MotherTongue.Items.RemoveAt(0);

        LB_Religion.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Religion);
        LB_Religion.DataTextField  = "Item";
        LB_Religion.DataValueField = "Value";
        LB_Religion.DataBind();
        LB_Religion.Items.RemoveAt(0);

        LB_Caste.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Cast);
        LB_Caste.DataTextField  = "Item";
        LB_Caste.DataValueField = "Value";
        LB_Caste.DataBind();
        LB_Caste.Items.RemoveAt(0);
        LB_Caste.Items.RemoveAt(0);

        LB_Education.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Education);
        LB_Education.DataTextField  = "Item";
        LB_Education.DataValueField = "Value";
        LB_Education.DataBind();
        LB_Education.Items.RemoveAt(0);

        LB_Edudetails.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.EduDetails);;
        LB_Edudetails.DataTextField  = "Item";
        LB_Edudetails.DataValueField = "Value";
        LB_Edudetails.DataBind();
        LB_Edudetails.Items.RemoveAt(0);

        LB_AnnulIncome.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.AnnualIncomeRange);
        LB_AnnulIncome.DataTextField  = "Item";
        LB_AnnulIncome.DataValueField = "Value";
        LB_AnnulIncome.DataBind();
        LB_AnnulIncome.Items.RemoveAt(0);

        LB_Occupation.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Occupation);
        LB_Occupation.DataTextField  = "Item";
        LB_Occupation.DataValueField = "Value";
        LB_Occupation.DataBind();
        LB_Occupation.Items.RemoveAt(0);

        LB_Citizenship.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Country);
        LB_Citizenship.DataTextField  = "Item";
        LB_Citizenship.DataValueField = "Value";
        LB_Citizenship.DataBind();
        LB_Citizenship.Items.RemoveAt(0);

        LB_CountryLiving.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Country);
        LB_CountryLiving.DataTextField  = "Item";
        LB_CountryLiving.DataValueField = "Value";
        LB_CountryLiving.DataBind();
        LB_CountryLiving.Items.RemoveAt(0);

        LB_Rasident_State.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.State);
        LB_Rasident_State.DataTextField  = "Item";
        LB_Rasident_State.DataValueField = "Value";
        LB_Rasident_State.DataBind();
        LB_Rasident_State.Items.RemoveAt(0);
        LB_Rasident_State.Items.Insert(0, "Any");

        LB_Rasident_Status.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.ResidenceStatus);
        LB_Rasident_Status.DataTextField  = "Item";
        LB_Rasident_Status.DataValueField = "Value";
        LB_Rasident_Status.DataBind();
        LB_Rasident_Status.Items.RemoveAt(0);
        LB_Rasident_Status.Items.Insert(0, "Any");

        DDL_ChDosham.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.HoroManglic);
        DDL_ChDosham.DataTextField  = "Item";
        DDL_ChDosham.DataValueField = "Value";
        DDL_ChDosham.DataBind();
        DDL_ChDosham.Items.RemoveAt(5);

        DDL_EathingHabits.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Diet);
        DDL_EathingHabits.DataTextField  = "Item";
        DDL_EathingHabits.DataValueField = "Value";
        DDL_EathingHabits.DataBind();

        Int16 Int16Counter;

        DDL_Height_min.Items.Insert(0, "-- Select --");
        DDL_Height_Max.Items.Insert(0, "-- Select --");
        for (Int16Counter = 90; Int16Counter <= 185; ++Int16Counter)
        {
            DDL_Height_min.Items.Insert(Int16Counter - 89, Int16Counter + " CM");
            DDL_Height_Max.Items.Insert(Int16Counter - 89, Int16Counter + 1 + " CM");
        }


        // Loading Values From DataBase
        //---------------------------------------------------------------------------------------------------
        string strApplicationID = MatrimonialMemberShip.GetApplicationID(HF_MatID.Value);
        //---------------------------------------------------------------------------------------------------
        MatMember objMember = new MatMember(true, strApplicationID, false, false, false, false, false, false, false, false, false, true);
        //---------------------------------------------------------------------------------------------------
        int i;

        //---------------------------------------------------------------------------------------------------
        string[] strARRAY = objMember.PP_LookingFor.Split('%');
        if (strARRAY[0].Length != 0)
        {
            foreach (string index in strARRAY)
            {
                i = int.Parse(index);
                LB_MaritalStatus.Items[i - 1].Selected = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        TB_Age_min.Text = objMember.PP_AgeMin.ToString();
        TB_Age_Max.Text = objMember.PP_AgeMax.ToString();
        //---------------------------------------------------------------------------------------------------
        strARRAY = objMember.PP_Complexion.Split('%');
        if (strARRAY[0].Length != 0)
        {
            foreach (string index in strARRAY)
            {
                i = int.Parse(index);
                LB_Complexion.Items[i - 1].Selected = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        switch (objMember.PP_HaveChildren)
        {
        case 1: RB_ChildrenDM.Checked = true;
            break;

        case 2: RB_ChildrenNO.Checked = true;
            break;

        case 3: RB_ChildrenYesLT.Checked = true;
            break;

        case 4: RB_ChildrenYesNLT.Checked = true;
            break;
        }
        //---------------------------------------------------------------------------------------------------
        DDL_Height_min.SelectedIndex = objMember.PP_HeightMin;
        DDL_Height_Max.SelectedIndex = objMember.PP_HeightMax;
        //---------------------------------------------------------------------------------------------------
        switch (objMember.PP_PhysicalStatus)
        {
        case 1: RB_phy_nor.Checked = true;
            break;

        case 2: RB_phy_Dis.Checked = true;
            break;

        case 3: RB_phy_DMater.Checked = true;
            break;
        }
        //---------------------------------------------------------------------------------------------------
        strARRAY = objMember.PP_MotherTongue.Split('%');

        if (strARRAY[0].Length != 0)
        {
            foreach (string index in strARRAY)
            {
                i = int.Parse(index);
                LB_MotherTongue.Items[i - 1].Selected = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        TB_Expectations.Text = objMember.MyExpectations;
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_Religion.IndexOf("##") >= 0)
        {
            CB_Religion_Any.Checked = true;
        }
        else
        {
            CB_Caste_Any.Checked = false;
            strARRAY             = objMember.PP_Religion.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_Religion.Items[i - 1].Selected = true;
                }
                CB_Religion_Any.Checked = false;
            }
            else
            {
                CB_Religion_Any.Checked = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_Caste.IndexOf("##") >= 0)
        {
            CB_Caste_Any.Checked = true;
        }
        else
        {
            strARRAY = objMember.PP_Caste.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_Caste.Items[i - 1].Selected = true;
                }
                CB_Caste_Any.Checked = false;
            }
            else
            {
                CB_Caste_Any.Checked = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        DDL_ChDosham.SelectedIndex      = objMember.PP_Manglik;
        DDL_EathingHabits.SelectedIndex = objMember.Diet;
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_Education.IndexOf("##") >= 0)
        {
            CB_Education_Any.Checked = true;
        }
        else
        {
            strARRAY = objMember.PP_Education.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_Education.Items[i - 1].Selected = true;
                }
                CB_Education_Any.Checked = false;
            }
            else
            {
                CB_Education_Any.Checked = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_EducationDetails.IndexOf("##") >= 0)
        {
            CB_EduDet.Checked = true;
        }
        else
        {
            strARRAY = objMember.PP_EducationDetails.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_Edudetails.Items[i - 1].Selected = true;
                }
                CB_EduDet.Checked = false;
            }
            else
            {
                CB_EduDet.Checked = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        LB_AnnulIncome.SelectedIndex = objMember.PP_AnnualIncome;
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_Occupation.IndexOf("##") >= 0)
        {
            CB_Occupation_any.Checked = true;
        }
        else
        {
            strARRAY = objMember.PP_Occupation.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_Occupation.Items[i - 1].Selected = true;
                }
                CB_Occupation_any.Checked = false;
            }
            else
            {
                CB_Occupation_any.Checked = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_Citizenship.IndexOf("##") >= 0)
        {
            CB_IndianX.Checked = true;
        }
        else
        {
            strARRAY = objMember.PP_Citizenship.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_Citizenship.Items[i - 1].Selected = true;
                }
                CB_IndianX.Checked = false;
            }
            else
            {
                CB_IndianX.Checked = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_LivingIn.IndexOf("##") >= 0)
        {
            CB_Indian.Checked = true;
        }
        else
        {
            strARRAY = objMember.PP_LivingIn.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_CountryLiving.Items[i - 1].Selected = true;
                }
                CB_Indian.Checked = false;
            }
            else
            {
                CB_Indian.Checked = true;
            }
        }
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_ResidingState.IndexOf("##") >= 0)
        {
            CB_StatesInIndia.Checked = false;
            TB_NonIndianState.Text   = objMember.PP_ResidingState.Replace("##", "");
        }
        else
        {
            if (objMember.PP_ResidingState.ToLower().IndexOf("any") >= 0)
            {
                LB_Rasident_State.Items[0].Selected = true;
                CB_StatesInIndia.Checked            = true;
            }
            else
            {
                strARRAY = objMember.PP_ResidingState.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_Rasident_State.Items[i - 1].Selected = true;
                    }
                    CB_StatesInIndia.Checked = true;
                }
                else
                {
                    CB_StatesInIndia.Checked = false;
                }
            }
        }
        //---------------------------------------------------------------------------------------------------
        if (objMember.PP_ResidingState.ToLower().IndexOf("any") >= 0)
        {
            LB_Rasident_Status.Items[0].Selected = true;
        }
        else
        {
            strARRAY = objMember.PP_ResStatus.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_Rasident_Status.Items[i - 1].Selected = true;
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //---------------------------------------------------------------------------------------------------
            // Adding meta Discription
            HtmlMeta objMeta = new HtmlMeta();
            objMeta.Name    = "Description";
            objMeta.Content = WebConfig.GetValues("MetaDiscription");
            this.Header.Controls.Add(objMeta);
            // Adding meta KeyWords
            objMeta         = new HtmlMeta();
            objMeta.Name    = "keywords";
            objMeta.Content = WebConfig.GetValues("MetaKeword");
            this.Header.Controls.Add(objMeta);
            //---------------------------------------------------------------------------------------------------
            txtCount.Text = TB_Expectations.MaxLength.ToString();
            /// Text Counter Initiallisation
            TB_Expectations.Attributes.Add("onKeyUp",
                                           "javascript:document.getElementById('" + txtCount.ClientID +
                                           "').setAttribute('value', (" + TB_Expectations.MaxLength +
                                           " - parseInt(document.getElementById('" + TB_Expectations.ClientID +
                                           "').getAttribute('value').length)));");
            //---------------------------------------------------------------------------------------------------
            //load ddls
            //Getting Connection String
            LB_MaritalStatus.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.MaritalStatus);
            LB_MaritalStatus.DataTextField  = "Item";
            LB_MaritalStatus.DataValueField = "Value";
            LB_MaritalStatus.DataBind();
            LB_MaritalStatus.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_Complexion.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Complexion);
            LB_Complexion.DataTextField  = "Item";
            LB_Complexion.DataValueField = "Value";
            LB_Complexion.DataBind();
            LB_Complexion.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_MotherTongue.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.MotherTongue);
            LB_MotherTongue.DataTextField  = "Item";
            LB_MotherTongue.DataValueField = "Value";
            LB_MotherTongue.DataBind();
            LB_MotherTongue.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_Religion.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Religion);
            LB_Religion.DataTextField  = "Item";
            LB_Religion.DataValueField = "Value";
            LB_Religion.DataBind();
            LB_Religion.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_Caste.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Cast);
            LB_Caste.DataTextField  = "Item";
            LB_Caste.DataValueField = "Value";
            LB_Caste.DataBind();
            LB_Caste.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_Education.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Education);
            LB_Education.DataTextField  = "Item";
            LB_Education.DataValueField = "Value";
            LB_Education.DataBind();
            LB_Education.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_Edudetails.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.EduDetails);;
            LB_Edudetails.DataTextField  = "Item";
            LB_Edudetails.DataValueField = "Value";
            LB_Edudetails.DataBind();
            LB_Edudetails.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_AnnulIncome.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.AnnualIncomeRange);
            LB_AnnulIncome.DataTextField  = "Item";
            LB_AnnulIncome.DataValueField = "Value";
            LB_AnnulIncome.DataBind();
            LB_AnnulIncome.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_Occupation.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Occupation);
            LB_Occupation.DataTextField  = "Item";
            LB_Occupation.DataValueField = "Value";
            LB_Occupation.DataBind();
            LB_Occupation.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_Citizenship.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Country);
            LB_Citizenship.DataTextField  = "Item";
            LB_Citizenship.DataValueField = "Value";
            LB_Citizenship.DataBind();
            LB_Citizenship.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_CountryLiving.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Country);
            LB_CountryLiving.DataTextField  = "Item";
            LB_CountryLiving.DataValueField = "Value";
            LB_CountryLiving.DataBind();
            LB_CountryLiving.Items.RemoveAt(0);
            //---------------------------------------------------------------------------------------------------
            LB_Rasident_State.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.State);
            LB_Rasident_State.DataTextField  = "Item";
            LB_Rasident_State.DataValueField = "Value";
            LB_Rasident_State.DataBind();
            LB_Rasident_State.Items.RemoveAt(0);
            LB_Rasident_State.Items.Insert(0, "Any");
            //---------------------------------------------------------------------------------------------------
            LB_Rasident_Status.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.ResidenceStatus);
            LB_Rasident_Status.DataTextField  = "Item";
            LB_Rasident_Status.DataValueField = "Value";
            LB_Rasident_Status.DataBind();
            LB_Rasident_Status.Items.RemoveAt(0);
            LB_Rasident_Status.Items.Insert(0, "Any");
            //---------------------------------------------------------------------------------------------------
            DDL_ChDosham.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.HoroManglic);
            DDL_ChDosham.DataTextField  = "Item";
            DDL_ChDosham.DataValueField = "Value";
            DDL_ChDosham.DataBind();
            DDL_ChDosham.Items.RemoveAt(5);
            //---------------------------------------------------------------------------------------------------
            DDL_EathingHabits.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Diet);
            DDL_EathingHabits.DataTextField  = "Item";
            DDL_EathingHabits.DataValueField = "Value";
            DDL_EathingHabits.DataBind();
            //---------------------------------------------------------------------------------------------------
            Int16 Int16Counter;
            DDL_Height_min.Items.Insert(0, "-- Select --");
            DDL_Height_Max.Items.Insert(0, "-- Select --");
            for (Int16Counter = 90; Int16Counter <= 185; ++Int16Counter)
            {
                DDL_Height_min.Items.Insert(Int16Counter - 89, Int16Counter + " CM");
                DDL_Height_Max.Items.Insert(Int16Counter - 89, Int16Counter + 1 + " CM");
            }

            //---------------------------------------------------------------------------------------------------
            //Loading Member Informations
            HttpCookieCollection objHttpCookieCollection = Request.Cookies;
            HttpCookie           objHttpCookie           = objHttpCookieCollection.Get("MatCookie5639sb");
            //---------------------------------------------------------------------------------------------------
            string strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]);
            //---------------------------------------------------------------------------------------------------
            MatMember objMember = new MatMember(true, strApplicationID, false, false, false, false, false, false, false, false, false, true);
            //---------------------------------------------------------------------------------------------------
            int i;
            //---------------------------------------------------------------------------------------------------
            string[] strARRAY = objMember.PP_LookingFor.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_MaritalStatus.Items[i - 1].Selected = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            TB_Age_min.Text = objMember.PP_AgeMin.ToString();
            TB_Age_Max.Text = objMember.PP_AgeMax.ToString();
            //---------------------------------------------------------------------------------------------------
            strARRAY = objMember.PP_Complexion.Split('%');
            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_Complexion.Items[i - 1].Selected = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            switch (objMember.PP_HaveChildren)
            {
            case 1: RB_ChildrenDM.Checked = true;
                break;

            case 2: RB_ChildrenNO.Checked = true;
                break;

            case 3: RB_ChildrenYesLT.Checked = true;
                break;

            case 4: RB_ChildrenYesNLT.Checked = true;
                break;
            }
            //---------------------------------------------------------------------------------------------------
            DDL_Height_min.SelectedIndex = objMember.PP_HeightMin;
            DDL_Height_Max.SelectedIndex = objMember.PP_HeightMax;
            //---------------------------------------------------------------------------------------------------
            switch (objMember.PP_PhysicalStatus)
            {
            case 1: RB_phy_nor.Checked = true;
                break;

            case 2: RB_phy_Dis.Checked = true;
                break;

            case 3: RB_phy_DMater.Checked = true;
                break;
            }
            //---------------------------------------------------------------------------------------------------
            strARRAY = objMember.PP_MotherTongue.Split('%');

            if (strARRAY[0].Length != 0)
            {
                foreach (string index in strARRAY)
                {
                    i = int.Parse(index);
                    LB_MotherTongue.Items[i - 1].Selected = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            TB_Expectations.Text = objMember.MyExpectations;
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_Religion.IndexOf("##") >= 0)
            {
                CB_Religion_Any.Checked = true;
            }
            else
            {
                CB_Caste_Any.Checked = false;
                strARRAY             = objMember.PP_Religion.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_Religion.Items[i - 1].Selected = true;
                    }
                    CB_Religion_Any.Checked = false;
                }
                else
                {
                    CB_Religion_Any.Checked = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_Caste.IndexOf("##") >= 0)
            {
                CB_Caste_Any.Checked = true;
            }
            else
            {
                strARRAY = objMember.PP_Caste.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_Caste.Items[i - 1].Selected = true;
                    }
                    CB_Caste_Any.Checked = false;
                }
                else
                {
                    CB_Caste_Any.Checked = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            DDL_ChDosham.SelectedIndex      = objMember.PP_Manglik;
            DDL_EathingHabits.SelectedIndex = objMember.Diet;
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_Education.IndexOf("##") >= 0)
            {
                CB_Education_Any.Checked = true;
            }
            else
            {
                strARRAY = objMember.PP_Education.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_Education.Items[i - 1].Selected = true;
                    }
                    CB_Education_Any.Checked = false;
                }
                else
                {
                    CB_Education_Any.Checked = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_EducationDetails.IndexOf("##") >= 0)
            {
                CB_EduDet.Checked = true;
            }
            else
            {
                strARRAY = objMember.PP_EducationDetails.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_Edudetails.Items[i - 1].Selected = true;
                    }
                    CB_EduDet.Checked = false;
                }
                else
                {
                    CB_EduDet.Checked = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            LB_AnnulIncome.SelectedIndex = objMember.PP_AnnualIncome;
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_Occupation.IndexOf("##") >= 0)
            {
                CB_Occupation_any.Checked = true;
            }
            else
            {
                strARRAY = objMember.PP_Occupation.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_Occupation.Items[i - 1].Selected = true;
                    }
                    CB_Occupation_any.Checked = false;
                }
                else
                {
                    CB_Occupation_any.Checked = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_Citizenship.IndexOf("##") >= 0)
            {
                CB_IndianX.Checked = true;
            }
            else
            {
                strARRAY = objMember.PP_Citizenship.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_Citizenship.Items[i - 1].Selected = true;
                    }
                    CB_IndianX.Checked = false;
                }
                else
                {
                    CB_IndianX.Checked = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_LivingIn.IndexOf("##") >= 0)
            {
                CB_Indian.Checked = true;
            }
            else
            {
                strARRAY = objMember.PP_LivingIn.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_CountryLiving.Items[i - 1].Selected = true;
                    }
                    CB_Indian.Checked = false;
                }
                else
                {
                    CB_Indian.Checked = true;
                }
            }
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_ResidingState.IndexOf("##") >= 0)
            {
                CB_StatesInIndia.Checked = false;
                TB_NonIndianState.Text   = objMember.PP_ResidingState.Replace("##", "");
            }
            else
            {
                if (objMember.PP_ResidingState.ToLower().IndexOf("any") >= 0)
                {
                    LB_Rasident_State.Items[0].Selected = true;
                    CB_StatesInIndia.Checked            = true;
                }
                else
                {
                    strARRAY = objMember.PP_ResidingState.Split('%');
                    if (strARRAY[0].Length != 0)
                    {
                        foreach (string index in strARRAY)
                        {
                            i = int.Parse(index);
                            LB_Rasident_State.Items[i - 1].Selected = true;
                        }
                        CB_StatesInIndia.Checked = true;
                    }
                    else
                    {
                        CB_StatesInIndia.Checked = false;
                    }
                }
            }
            //---------------------------------------------------------------------------------------------------
            if (objMember.PP_ResStatus.ToLower().IndexOf("any") >= 0)
            {
                LB_Rasident_Status.Items[0].Selected = true;
            }
            else
            {
                strARRAY = objMember.PP_ResStatus.Split('%');
                if (strARRAY[0].Length != 0)
                {
                    foreach (string index in strARRAY)
                    {
                        i = int.Parse(index);
                        LB_Rasident_Status.Items[i - 1].Selected = true;
                    }
                }
            }

            ////---------------------------------------------------------------------------------------------------
        }//if
        ////---------------------------------------------------------------------------------------------------
        else            // PostBack
        ////---------------------------------------------------------------------------------------------------
        {
            HttpCookieCollection objHttpCookieCollection = Request.Cookies;
            HttpCookie           objHttpCookie           = objHttpCookieCollection.Get("MatCookie5639sb");

            string strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]);

            // Inserting data into database
            if (strApplicationID != null)
            {
                sbyte sbyteFlag = 0;
                sbyte sbyteChildrenStatus;
                sbyte sbytePhysicalStatus;

                //-------------------------------------------------------------------------------------------------------------
                if (RB_ChildrenNO.Checked)
                {
                    sbyteChildrenStatus = 1;
                }
                else if (RB_ChildrenYesLT.Checked)
                {
                    sbyteChildrenStatus = 2;
                }
                else if (RB_ChildrenYesNLT.Checked)
                {
                    sbyteChildrenStatus = 3;
                }
                else if (RB_ChildrenDM.Checked)
                {
                    sbyteChildrenStatus = 4;
                }
                else
                {
                    sbyteChildrenStatus = 0;
                }

                //-------------------------------------------------------------------------------------------------------------

                if (RB_phy_nor.Checked)
                {
                    sbytePhysicalStatus = 1;
                }
                else if (RB_phy_Dis.Checked)
                {
                    sbytePhysicalStatus = 2;
                }
                else if (RB_phy_DMater.Checked)
                {
                    sbytePhysicalStatus = 3;
                }
                else
                {
                    sbytePhysicalStatus = 0;
                }

                //-------------------------------------------------------------------------------------------------------------

                // Loading Values From LB

                string strMaritalStatusList = "";
                string Flag = "";
                // Marital Status
                foreach (ListItem objListItem in LB_MaritalStatus.Items)
                {
                    if (objListItem.Selected)
                    {
                        strMaritalStatusList += Flag + objListItem.Value;
                        Flag = "%";
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Complexion
                string strComplexionList = "";

                Flag = "";

                foreach (ListItem objListItem in LB_Complexion.Items)
                {
                    if (objListItem.Selected)
                    {
                        strComplexionList += Flag + objListItem.Value;
                        Flag = "%";
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Mother Tongue
                string strMotherTongueList = "";

                Flag = "";

                foreach (ListItem objListItem in LB_MotherTongue.Items)
                {
                    if (objListItem.Selected)
                    {
                        strMotherTongueList += Flag + objListItem.Value;
                        Flag = "%";
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Religion
                string strReligionList = "";
                if (CB_Religion_Any.Checked)
                {
                    strReligionList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Religion.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strReligionList += Flag + objListItem.Value;
                            Flag             = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                //Caste
                string strCasteList = "";
                if (CB_Caste_Any.Checked)
                {
                    strCasteList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Caste.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strCasteList += Flag + objListItem.Value;
                            Flag          = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Education
                string strEducationList = "";
                if (CB_Education_Any.Checked)
                {
                    strEducationList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Education.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strEducationList += Flag + objListItem.Value;
                            Flag              = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // EduDetails
                string strEduDetailsList = "";
                if (CB_EduDet.Checked)
                {
                    strEduDetailsList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Edudetails.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strEduDetailsList += Flag + objListItem.Value;
                            Flag = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Occupation
                string strOccupationList = "";
                if (CB_Occupation_any.Checked)
                {
                    strOccupationList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Occupation.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strOccupationList += Flag + objListItem.Value;
                            Flag = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Citizenship
                string strCitizenshipList = "";
                if (CB_IndianX.Checked)
                {
                    strCitizenshipList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Citizenship.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strCitizenshipList += Flag + objListItem.Value;
                            Flag = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Country Living in
                string strCountryLivinginList = "";
                if (CB_Indian.Checked)
                {
                    strCountryLivinginList = "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Citizenship.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strCountryLivinginList += Flag + objListItem.Value;
                            Flag = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                // Country Living in
                string strStateList = "";
                if (!CB_StatesInIndia.Checked)
                {
                    strStateList = TB_NonIndianState.Text + "##";
                }
                else
                {
                    Flag = "";

                    foreach (ListItem objListItem in LB_Rasident_State.Items)
                    {
                        if (objListItem.Selected)
                        {
                            strStateList += Flag + objListItem.Value;
                            Flag          = "%";
                        }
                    }
                }
                //-------------------------------------------------------------------------------------------------------------
                //Residential Status
                string strResidentStatus = "";
                Flag = "";
                foreach (ListItem objListItem in LB_Rasident_Status.Items)
                {
                    if (objListItem.Selected)
                    {
                        strResidentStatus += Flag + objListItem.Value;
                        Flag = "%";
                    }
                }
                //--------------------------------------------------------------------------------------------------------------
                sbyteFlag = MatrimonialProfileManager.InsertMyExpectation(strApplicationID, TB_Expectations.Text);
                //--------------------------------------------------------------------------------------------------------------
                sbyteFlag += MatrimonialProfileManager.InsertPartnerPreferance(strApplicationID, strMaritalStatusList, sbyte.Parse(TB_Age_min.Text),
                                                                               sbyte.Parse(TB_Age_Max.Text), strComplexionList, sbyteChildrenStatus, (DDL_Height_min.SelectedIndex + 89), (DDL_Height_Max.SelectedIndex + 89),
                                                                               sbytePhysicalStatus, strMotherTongueList, strReligionList, strCasteList, DDL_ChDosham.SelectedIndex, DDL_EathingHabits.SelectedIndex,
                                                                               strEducationList, strEduDetailsList, LB_AnnulIncome.SelectedIndex, strOccupationList, strCitizenshipList, strCountryLivinginList,
                                                                               strStateList, strResidentStatus);
                //--------------------------------------------------------------------------------------------------------------

                if (sbyteFlag == 2)
                {
                    Response.Redirect("MyAlbum.aspx");
                }
                else
                {
                    Server.Transfer("../Extras/ErrorReport.aspx");
                }
            }  //postbak
        }
    }