protected void enableAutoButton_Click(object sender, EventArgs e)
    {
        string errorMessage;

        countryTextBox.Attributes.Add("autocomplete", "on");
        enableAutoButton.Enabled  = false;
        disableAutoButton.Enabled = true;

        //Save this details into the database for first timer

        // Update Info
        buttonEnabled = "Enabled";

        toolBoxCheck    userObj    = new toolBoxCheck();
        toolBoxCheckDAO toolBoxDao = new toolBoxCheckDAO();

        userObj = toolBoxDao.getUsersData("2");
        if (userObj != null)
        {
            string userName          = userObj.userNameClass;
            string userId            = userObj.userIdClass;
            string password          = userObj.passwordClass;
            string buttonEnabledData = userObj.buttonEnabledClass;
            string toolsString       = userObj.toolsClass;

            // Performing loading of tools
            var values = JsonConvert.DeserializeObject <Dictionary <string, string> >(toolsString);
            foreach (KeyValuePair <string, string> item in values)
            {
                if (item.Key == "buttonEnabled")
                {
                    if (item.Value != buttonEnabled)
                    {
                        //Update the database table
                        values[item.Key] = "Enabled";
                        string json   = JsonConvert.SerializeObject(values);
                        int    insCnt = toolBoxDao.updateTools(json, 2);
                        if (insCnt == 1)
                        {
                            errorMessage = "No error!";
                            break;
                        }
                        else
                        {
                            errorMessage = "Unable to insert travel details, please inform system administrator!";
                            break;
                        }
                    }
                }
            }
        }
        else
        {
            errorMessage = "No details found!";
        }
    }
    protected void autoCompleteButton_Click(object sender, EventArgs e)
    {
        string errorMessage;

        toolBoxCheck    userObj    = new toolBoxCheck();
        toolBoxCheckDAO toolBoxDao = new toolBoxCheckDAO();

        //search in the database for user 2 datas
        userObj = toolBoxDao.getUsersData("2");

        // remove the item from the database's dictionary
        if (userObj != null)
        {
            string userName          = userObj.userNameClass;
            string userId            = userObj.userIdClass;
            string password          = userObj.passwordClass;
            string buttonEnabledData = userObj.buttonEnabledClass;
            string toolsString       = userObj.toolsClass;

            autoComplete.Visible = false;

            // Performing loading of tools
            var values = JsonConvert.DeserializeObject <Dictionary <string, string> >(toolsString);
            foreach (KeyValuePair <string, string> item in values)
            {
                if (item.Key == "buttonEnabled")
                {
                    values.Remove("buttonEnabled");
                    string json   = JsonConvert.SerializeObject(values);
                    int    insCnt = toolBoxDao.updateTools(json, 2);
                    if (insCnt == 1)
                    {
                        errorMessage = "No error!";
                        loadingToolBoxSettings();
                        break;
                    }
                }
            }
        }
        else
        {
            errorMessage = "No details found!";
        }
    }
    protected void importancyColorSettingActivate_Click(object sender, EventArgs e)
    {
        changeImportancy.Visible = true;
        string errorMessage;

        toolBoxCheck    userObj    = new toolBoxCheck();
        toolBoxCheckDAO toolBoxDao = new toolBoxCheckDAO();

        //search in the database for user 2 datas
        userObj = toolBoxDao.getUsersData("2");

        // remove the item from the database's dictionary
        if (userObj != null)
        {
            string userName          = userObj.userNameClass;
            string userId            = userObj.userIdClass;
            string password          = userObj.passwordClass;
            string buttonEnabledData = userObj.buttonEnabledClass;
            string toolsString       = userObj.toolsClass;

            // Performing loading of tools
            var values = JsonConvert.DeserializeObject <Dictionary <string, string> >(toolsString);
            foreach (KeyValuePair <string, string> item in values)
            {
                if (values.ContainsKey("iconColor") == false)
                {
                    values.Add("iconColor", "Enabled");
                    string json   = JsonConvert.SerializeObject(values);
                    int    insCnt = toolBoxDao.updateTools(json, 2);
                    if (insCnt == 1)
                    {
                        errorMessage = "No error!";
                        break;
                    }
                }
            }
        }
        else
        {
            errorMessage = "No details found!";
        }
    }
    public void loadingToolBoxSettings()
    {
        toolBoxCheck    userObj    = new toolBoxCheck();
        toolBoxCheckDAO toolBoxDao = new toolBoxCheckDAO();

        string json = JsonConvert.SerializeObject(tools);

        userObj = toolBoxDao.getUsersData("2");
        if (userObj != null)
        {
            string userName          = userObj.userNameClass;
            string userId            = userObj.userIdClass;
            string password          = userObj.passwordClass;
            string buttonEnabledData = userObj.buttonEnabledClass;
            string email             = userObj.emailClass;
            string toolsString       = userObj.toolsClass;

            userNameLbl.Text = "Username: "******"Email: " + email;

            var values = JsonConvert.DeserializeObject <Dictionary <string, string> >(toolsString);
            if (values.Count == 0)
            {
                //Adding default value into the account
                //Update the database table
                int insCnt = toolBoxDao.updateTools(json, 2);
                if (insCnt == 1)
                {
                    realMessage = "success";
                }
                else
                {
                    realMessage = "failed";
                }
            }
            else
            {
                //Loads auto complete tool
                foreach (KeyValuePair <string, string> item in values)
                {
                    //check if button enabled key exists
                    if (values.ContainsKey("buttonEnabled") == true)
                    {
                        autoCompleteSettingsActivate.Enabled   = false;
                        autoCompleteSettingsDeactivate.Enabled = true;
                    }
                    else if (values.ContainsKey("buttonEnabled") == false)
                    {
                        autoCompleteSettingsDeactivate.Enabled = false;
                        autoCompleteSettingsActivate.Enabled   = true;
                    }
                }
                //ends

                //Loading of place suggestion
                foreach (KeyValuePair <string, string> item in values)
                {
                    //check if button enabled key exists
                    if (values.ContainsKey("iconColor") == true)
                    {
                        importancyColorSettingActivate.Enabled   = false;
                        importancyColorSettingDeactivate.Enabled = true;
                    }
                    else if (values.ContainsKey("iconColor") == false)
                    {
                        importancyColorSettingDeactivate.Enabled = false;
                        importancyColorSettingActivate.Enabled   = true;
                    }
                }

                //Loading of importancy tools
                foreach (KeyValuePair <string, string> item in values)
                {
                    //check if button enabled key exists
                    if (values.ContainsKey("placeSuggestion") == true)
                    {
                        placeSuggestSettingActivate.Enabled   = false;
                        placeSuggestSettingDeactivate.Enabled = true;
                    }
                    else if (values.ContainsKey("placeSuggestion") == false)
                    {
                        placeSuggestSettingDeactivate.Enabled = false;
                        placeSuggestSettingActivate.Enabled   = true;
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        loadingToolBoxSettings();
        toolBoxCheck    userObj    = new toolBoxCheck();
        toolBoxCheckDAO toolBoxDao = new toolBoxCheckDAO();

        string json = JsonConvert.SerializeObject(tools);

        userObj = toolBoxDao.getUsersData("2");
        if (userObj != null)
        {
            string userName          = userObj.userNameClass;
            string userId            = userObj.userIdClass;
            string password          = userObj.passwordClass;
            string buttonEnabledData = userObj.buttonEnabledClass;
            string email             = userObj.emailClass;
            string toolsString       = userObj.toolsClass;

            userNameLbl.Text = "Username: "******"Email: " + email;

            var values = JsonConvert.DeserializeObject <Dictionary <string, string> >(toolsString);
            if (values.Count == 0)
            {
                //Adding default value into the account
                //Update the database table
                int insCnt = toolBoxDao.updateTools(json, 2);
                if (insCnt == 1)
                {
                    Session["status"] = "success";
                }
                else
                {
                    Session["status"] = "failed";
                }
            }
            else
            {
                //Loads auto complete tool
                foreach (KeyValuePair <string, string> item in values)
                {
                    //check if button enabled key exists
                    if (values.ContainsKey("buttonEnabled") == true)
                    {
                        //Loading of button Enabled
                        if (item.Value == "Enabled")
                        {
                            countryTextBox.Attributes.Add("autocomplete", "true");
                            disableAutoButton.Enabled = true;
                            enableAutoButton.Enabled  = false;
                        }

                        else if (item.Value == "Disabled")
                        {
                            countryTextBox.Attributes.Add("autocomplete", "false");
                            disableAutoButton.Enabled = false;
                            enableAutoButton.Enabled  = true;
                        }
                    }
                    else if (values.ContainsKey("buttonEnabled") == false)
                    {
                        autoComplete.Visible = false;
                    }
                }
                //ends
            }
        }
        else
        {
            realMessage = "No details found!";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            loadingToolBoxSettings();
            int travelId = int.Parse(Session["travelId"].ToString());
            travelDetailsId.Value = travelId.ToString();
            toolBoxCheck    userObj    = new toolBoxCheck();
            toolBoxCheckDAO toolBoxDao = new toolBoxCheckDAO();

            userObj = toolBoxDao.getUsersData("2");
            if (userObj != null)
            {
                string userName          = userObj.userNameClass;
                string userId            = userObj.userIdClass;
                string password          = userObj.passwordClass;
                string buttonEnabledData = userObj.buttonEnabledClass;
                string email             = userObj.emailClass;
                string toolsString       = userObj.toolsClass;

                userNameLbl.Text = "Username: "******"Email: " + email;

                var values = JsonConvert.DeserializeObject <Dictionary <string, string> >(toolsString);

                //Start to load everything for the toolboxes
                if (values.Count != 0)
                {
                    //Loads importancy icon tool
                    foreach (KeyValuePair <string, string> item in values)
                    {
                        //check if importancy icon tool exists
                        if (values.ContainsKey("iconColor") == true)
                        {
                            changeImportancy.Visible = true;
                        }
                        else
                        {
                            changeImportancy.Visible = true;
                        }
                    }

                    //Loads placesuggestion tool
                    //Loads importancy icon tool
                    foreach (KeyValuePair <string, string> item in values)
                    {
                        //check if importancy icon tool exists
                        if (values.ContainsKey("placeSuggestion") == true)
                        {
                            changeImportancy.Visible = true;

                            ////Testing loading of api places
                            //Dictionary<string, string> places = new Dictionary<string, string>();

                            //string html = string.Empty;
                            //string newHtml = string.Empty;
                            //string url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?pagetoken=CpQCAgEAAFxg8o-eU7_uKn7Yqjana-HQIx1hr5BrT4zBaEko29ANsXtp9mrqN0yrKWhf-y2PUpHRLQb1GT-mtxNcXou8TwkXhi1Jbk-ReY7oulyuvKSQrw1lgJElggGlo0d6indiH1U-tDwquw4tU_UXoQ_sj8OBo8XBUuWjuuFShqmLMP-0W59Vr6CaXdLrF8M3wFR4dUUhSf5UC4QCLaOMVP92lyh0OdtF_m_9Dt7lz-Wniod9zDrHeDsz_by570K3jL1VuDKTl_U1cJ0mzz_zDHGfOUf7VU1kVIs1WnM9SGvnm8YZURLTtMLMWx8-doGUE56Af_VfKjGDYW361OOIj9GmkyCFtaoCmTMIr5kgyeUSnB-IEhDlzujVrV6O9Mt7N4DagR6RGhT3g1viYLS4kO5YindU6dm3GIof1Q&key=AIzaSyB8X3vHKQpy-VEFBVOksi32bLhb7u6cUK0";

                            //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

                            //using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                            //using (Stream stream = response.GetResponseStream())
                            //using (StreamReader reader = new StreamReader(stream))
                            //{
                            //    string json = JsonConvert.SerializeObject(reader.ReadToEnd());
                            //    var resultsPlace = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
                            //    Label1.Text = resultsPlace.ToString();
                            //    //newHtml = JsonConvert.SerializeObject(html);
                            //}
                        }
                        else
                        {
                            changeImportancy.Visible = true;
                        }
                    }
                }
                else
                {
                    //Adding default value into the account
                    //Update the database table
                    string json   = JsonConvert.SerializeObject(tools);
                    int    insCnt = toolBoxDao.updateTools(json, 2);
                    if (insCnt == 1)
                    {
                        errorMsg = "success";
                    }
                    else
                    {
                        errorMsg = "failed";
                    }
                }
            }
            else
            {
                errorMsg = "No details found!";
            }
        }
    }