private void saveCustomerSettings()
        {
            string strFilename = "";
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Filter = "JSON File (*.json)|*.json";
            saveFileDialog1.FileName = textBoxCustomerName.Text.ToString() + " " + textBoxDesignIteration.Text.ToString() + textBoxDesignOption.Text.ToString();

            if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                strFilename = saveFileDialog1.FileName.ToString();

                CustomerSettings JSONData = new CustomerSettings();

                //Details Tab
                JSONData.CustomerName = textBoxCustomerName.Text.ToString();
                JSONData.ProjectName = textBoxProjectName.Text.ToString();
                JSONData.DesignIteration = textBoxDesignIteration.Text.ToString();
                JSONData.DesignOption = textBoxDesignOption.Text.ToString();

                //Input Tab
                JSONData.PrimarySupportSegment = comboBoxPrimarySupportSegment.SelectedItem.ToString();
                JSONData.DefaultBackupRetention = comboBoxDefaultBackupRetention.SelectedItem.ToString();
                JSONData.VMSnapshotOverhead = maskedTextBoxVMSnapshotOverhead.Text.ToString().Replace(" %", "");
                JSONData.DefaultMaximumUtilisation = maskedTextBoxDefaultMaximumUtilisation.Text.ToString().Replace(" %", "");
                JSONData.SourceMHzPerCore = maskedTextBoxSourceMHzPerCore.Text.ToString().Replace(" MHz", "");
                JSONData.RackConnect = comboBoxRackConnect.SelectedItem.ToString();
                JSONData.DDoSPrevention = Convert.ToBoolean(comboBoxDDoSPrevention.SelectedItem.ToString());
                JSONData.Tier1Firewall = comboBoxTier1Firewall.SelectedItem.ToString();
                JSONData.Tier1FirewallHA = Convert.ToBoolean(checkBoxTier1FirewallHighAvailability.Checked.ToString());
                JSONData.Tier2Firewall = comboBoxTier2Firewall.SelectedItem.ToString();
                JSONData.Tier2FirewallHA = Convert.ToBoolean(checkBoxTier2FirewallHighAvailability.Checked.ToString());
                JSONData.LoadBalancer = comboBoxLoadBalancer.SelectedItem.ToString();
                JSONData.LoadBalancerHA = Convert.ToBoolean(checkBoxLoadBalancerHighAvailability.Checked.ToString());
                JSONData.IDSThreatManager = comboBoxIDSThreatManager.SelectedItem.ToString();
                JSONData.LogManager = Convert.ToBoolean(comboBoxLogManager.SelectedItem.ToString());
                JSONData.WebApplicationFirewall = comboBoxWebApplicationFirewall.SelectedItem.ToString();
                JSONData.WebApplicationFirewallHA = Convert.ToBoolean(checkBoxLoadBalancerHighAvailability.Checked.ToString());
                JSONData.GlobalTrafficManager = comboBoxGlobalTrafficManager.SelectedItem.ToString();

                //Servers Tab

                CustomerServerTab customerServerItem = new CustomerServerTab();

                List<CustomerServerTab> customerServerTab = new List<CustomerServerTab>();

                foreach (DataGridViewRow r in dataGridViewServers.Rows)
                {
                    customerServerItem = new CustomerServerTab();

                    object[] objCustomerServerTab = new object[27];

                    int[] intColumn = new int[26];
                    for (int i = 0; i < r.DataGridView.ColumnCount; i++)
                    {
                        if (i < 4)
                        {
                            intColumn[i] = i;
                        }
                        else if (i == 4)
                        {
                            //do nothing
                        }
                        else if (i > 4)
                        {
                            intColumn[i - 1] = i;
                        }
                    }

                    for (int i = 0; i < 26; i++)
                    {
                        if (r.Cells[intColumn[i]].Value == null)
                        {
                            if (intColumn[i] == r.DataGridView.Columns["Include"].Index)
                            {
                                objCustomerServerTab[i] = false;
                            }
                            else
                            {
                                objCustomerServerTab[i] = "";
                            }
                        }
                        else
                        {
                            objCustomerServerTab[i] = r.Cells[intColumn[i]].Value.ToString();
                        }
                    }

                    customerServerItem.ServerName = objCustomerServerTab[0].ToString();
                    customerServerItem.Qty = objCustomerServerTab[1].ToString();
                    customerServerItem.ServerType = objCustomerServerTab[16].ToString();
                    customerServerItem.OperatingSystem = objCustomerServerTab[17].ToString();
                    customerServerItem.LogicalProcessors = objCustomerServerTab[2].ToString();
                    customerServerItem.Utilisation = objCustomerServerTab[3].ToString();
                    customerServerItem.RAM = objCustomerServerTab[4].ToString();
                    customerServerItem.HDD1 = objCustomerServerTab[5].ToString();
                    customerServerItem.HDD1Type = objCustomerServerTab[18].ToString();
                    customerServerItem.HDD2 = objCustomerServerTab[6].ToString();
                    customerServerItem.HDD2Type = objCustomerServerTab[19].ToString();
                    customerServerItem.HDD3 = objCustomerServerTab[7].ToString();
                    customerServerItem.HDD3Type = objCustomerServerTab[20].ToString();
                    customerServerItem.HDD4 = objCustomerServerTab[8].ToString();
                    customerServerItem.HDD4Type = objCustomerServerTab[21].ToString();
                    customerServerItem.HDD5 = objCustomerServerTab[9].ToString();
                    customerServerItem.HDD5Type = objCustomerServerTab[22].ToString();
                    customerServerItem.vHostCluster = objCustomerServerTab[23].ToString();
                    customerServerItem.VLAN = objCustomerServerTab[10].ToString();
                    customerServerItem.Bandwidth = objCustomerServerTab[11].ToString();
                    customerServerItem.LBPool = objCustomerServerTab[12].ToString();
                    customerServerItem.Datacentre = objCustomerServerTab[24].ToString();
                    customerServerItem.Database = objCustomerServerTab[25].ToString();
                    customerServerItem.DatabaseCluster = objCustomerServerTab[13].ToString();
                    customerServerItem.Notes = objCustomerServerTab[14].ToString();
                    customerServerItem.Include = Convert.ToBoolean(objCustomerServerTab[15].ToString());

                    customerServerTab.Add(customerServerItem);
                }

                JSONData.CustomerServerTab = customerServerTab;

                string outputJSON = JsonConvert.SerializeObject(JSONData);
                File.WriteAllText(strFilename, outputJSON);
            }
        }
        private void buttonLoadConfig_Click(object sender, EventArgs e)
        {
            //string strFileName = "";
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "JSON (*.json)|*.json";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string strFileName = openFileDialog.FileName.ToString();

                string inputJSON = File.ReadAllText(strFileName);
                CustomerSettings JSONData = JsonConvert.DeserializeObject<CustomerSettings>(inputJSON);
                try
                {
                    //Detail Tab
                    textBoxCustomerName.Text = JSONData.CustomerName;
                    textBoxProjectName.Text = JSONData.ProjectName;
                    textBoxDesignIteration.Text = JSONData.DesignIteration;
                    textBoxDesignOption.Text = JSONData.DesignOption;

                    //Input Tab
                    comboBoxPrimarySupportSegment.SelectedItem = JSONData.PrimarySupportSegment;
                    comboBoxDefaultBackupRetention.SelectedItem = JSONData.DefaultBackupRetention;
                    maskedTextBoxVMSnapshotOverhead.Text = JSONData.VMSnapshotOverhead;
                    maskedTextBoxDefaultMaximumUtilisation.Text = JSONData.DefaultMaximumUtilisation;
                    maskedTextBoxSourceMHzPerCore.Text = JSONData.SourceMHzPerCore;
                    comboBoxRackConnect.SelectedItem = JSONData.RackConnect;
                    comboBoxDDoSPrevention.SelectedItem = JSONData.DDoSPrevention;
                    comboBoxTier1Firewall.SelectedItem = JSONData.Tier1Firewall;
                    checkBoxTier1FirewallHighAvailability.Checked = Convert.ToBoolean(JSONData.Tier1FirewallHA);
                    comboBoxTier2Firewall.SelectedItem = JSONData.Tier2Firewall;
                    checkBoxTier2FirewallHighAvailability.Checked = Convert.ToBoolean(JSONData.Tier2FirewallHA);
                    comboBoxLoadBalancer.SelectedItem = JSONData.LoadBalancer;
                    checkBoxLoadBalancerHighAvailability.Checked = Convert.ToBoolean(JSONData.LoadBalancerHA);
                    comboBoxIDSThreatManager.SelectedItem = JSONData.IDSThreatManager;
                    comboBoxLogManager.SelectedItem = JSONData.LogManager;
                    comboBoxWebApplicationFirewall.SelectedItem = JSONData.WebApplicationFirewall;
                    checkBoxWebApplicationFirewallHighAvailability.Checked = Convert.ToBoolean(JSONData.WebApplicationFirewallHA);
                    comboBoxGlobalTrafficManager.SelectedItem = JSONData.GlobalTrafficManager;

                    //Server Tab

                    dataGridViewServers.Rows.Clear();

                    int customerServerRecords = 0;

                    DataGridViewRow[] rowArray = new DataGridViewRow[customerServerRecords];
                    DataGridViewRow r = new DataGridViewRow();

                    int intCustomerServerItem = 0;
                    CustomerServerTab customerServerList = new CustomerServerTab();
                    List<CustomerServerTab> customerServerTab = new List<CustomerServerTab>();
                    customerServerTab = JSONData.CustomerServerTab;

                    foreach (CustomerServerTab customerServerItem in customerServerTab)
                    {
                        dataGridViewServers.Rows.Add();
                        DataGridViewRow row = dataGridViewServers.Rows[intCustomerServerItem];
                        customerServerList = new CustomerServerTab();

                        //MessageBox.Show(customerServerTab[intCustomerServerItem].ServerName.ToString());

                        customerServerList = customerServerItem;
                        //MessageBox.Show(customerServerList.ServerName.ToString() + dataGridViewServers.RowCount.ToString());

                        row.Cells["ServerName"].Value = customerServerList.ServerName;
                        row.Cells["Qty"].Value = customerServerList.Qty;
                        row.Cells["ServerType"].Value = customerServerList.ServerType;
                        row.Cells["OperatingSystem"].Value = customerServerList.OperatingSystem;
                        row.Cells["LogicalProcessors"].Value = customerServerList.LogicalProcessors;
                        row.Cells["Utilisation"].Value = customerServerList.Utilisation;
                        row.Cells["RAM"].Value = customerServerList.RAM;
                        row.Cells["HDD1"].Value = customerServerList.HDD1;
                        row.Cells["HDD1Type"].Value = customerServerList.HDD1Type;
                        row.Cells["HDD2"].Value = customerServerList.HDD2;
                        row.Cells["HDD2Type"].Value = customerServerList.HDD2Type;
                        row.Cells["HDD3"].Value = customerServerList.HDD3;
                        row.Cells["HDD3Type"].Value = customerServerList.HDD3Type;
                        row.Cells["HDD4"].Value = customerServerList.HDD4;
                        row.Cells["HDD4Type"].Value = customerServerList.HDD4Type;
                        row.Cells["HDD5"].Value = customerServerList.HDD5;
                        row.Cells["HDD5Type"].Value = customerServerList.HDD5Type;
                        row.Cells["vHostCluster"].Value = customerServerList.vHostCluster;
                        row.Cells["VLAN"].Value = customerServerList.VLAN;
                        row.Cells["Bandwidth"].Value = customerServerList.Bandwidth;
                        row.Cells["LBPool"].Value = customerServerList.LBPool;
                        row.Cells["Datacentre"].Value = customerServerList.Datacentre;
                        row.Cells["Database"].Value = customerServerList.Database;
                        row.Cells["DatabaseCluster"].Value = customerServerList.DatabaseCluster;
                        row.Cells["Notes"].Value = customerServerList.Notes;
                        row.Cells["Include"].Value = customerServerList.Include;

                        intCustomerServerItem++;
                    }

                    dataGridViewServers.Rows.RemoveAt(dataGridViewServers.RowCount - 2);
                    updateRequiredMHzColumn();

                    MessageBox.Show("Customer configuration file loaded.", "Load complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (System.Exception excep)
                {
                    MessageBox.Show("Customer confiugration file could not be loaded. Defaults will be loaded \n\n" + excep.Message, "Load incomplete", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    dataGridViewServers.Rows.Clear();
                    LoadConfigSettings();
                }
            }
        }