public void saveDocument()
        {
            newProjectOfficeChecklistModel.ProjectName = txtProjectName.Text;
            newProjectOfficeChecklistModel.ProjectManager = txtProjectManager.Text;
            newProjectOfficeChecklistModel.ProjectOfficeManager = txtProjectOfficeManager.Text;

            newProjectOfficeChecklistModel.Premises = new List<ProjectOfficeChecklistModel.Questionare>();
            int premisesCount = dataGridViewPremises.Rows.Count-1;

            for (int i = 0; i < premisesCount; i++)
            {
                var question = dataGridViewPremises.Rows[i].Cells[0].Value?.ToString() ?? "";
                bool answer = Convert.ToBoolean(dataGridViewPremises.Rows[i].Cells[1].Value);
                newProjectOfficeChecklistModel.Premises.Add(new ProjectOfficeChecklistModel.Questionare(question, answer));
            }

            newProjectOfficeChecklistModel.Equipment = new List<ProjectOfficeChecklistModel.Questionare>();
            int equipmentCount = dataGridViewEquipment.Rows.Count - 1;

            for (int i = 0; i < equipmentCount; i++)
            {
                var question = dataGridViewEquipment.Rows[i].Cells[0].Value?.ToString() ?? "";
                bool answer = Convert.ToBoolean(dataGridViewEquipment.Rows[i].Cells[1].Value);
                newProjectOfficeChecklistModel.Equipment.Add(new ProjectOfficeChecklistModel.Questionare(question, answer));
            }

            newProjectOfficeChecklistModel.Roles = new List<ProjectOfficeChecklistModel.Questionare>();

            int rolesCount = dataGridViewRoles.Rows.Count - 1;

            for (int i = 0; i < rolesCount; i++)
            {
                var question = dataGridViewRoles.Rows[i].Cells[0].Value?.ToString() ?? "";
                bool answer = Convert.ToBoolean(dataGridViewRoles.Rows[i].Cells[1].Value);
                newProjectOfficeChecklistModel.Roles.Add(new ProjectOfficeChecklistModel.Questionare(question, answer));
            }


            newProjectOfficeChecklistModel.StandardsProcesses = new List<ProjectOfficeChecklistModel.Questionare>();

            int standardsProcessesCount = dataGridViewStandardsProcesses.Rows.Count - 1;

            for (int i = 0; i < standardsProcessesCount; i++)
            {
                var question = dataGridViewStandardsProcesses.Rows[i].Cells[0].Value?.ToString() ?? "";
                bool answer = Convert.ToBoolean(dataGridViewStandardsProcesses.Rows[i].Cells[1].Value);
                newProjectOfficeChecklistModel.StandardsProcesses.Add(new ProjectOfficeChecklistModel.Questionare(question, answer));
            }

            newProjectOfficeChecklistModel.TemplatesInitiation = new List<ProjectOfficeChecklistModel.Questionare>();
            int initiationProcessesCount = dataGridViewInit.Rows.Count - 1;

            for (int i = 0; i < initiationProcessesCount; i++)
            {
                var question = dataGridViewInit.Rows[i].Cells[0].Value?.ToString() ?? "";
                bool answer = Convert.ToBoolean(dataGridViewInit.Rows[i].Cells[1].Value);
                newProjectOfficeChecklistModel.TemplatesInitiation.Add(new ProjectOfficeChecklistModel.Questionare(question, answer));
            }

            newProjectOfficeChecklistModel.TemplatesPlanning = new List<ProjectOfficeChecklistModel.Questionare>();
            int planningRowCount = dataGridViewPlanning.Rows.Count - 1;

            for (int i = 0; i < planningRowCount; i++)
            {
                var question = dataGridViewPlanning.Rows[i].Cells[0].Value?.ToString() ?? "";
                bool answer = Convert.ToBoolean(dataGridViewPlanning.Rows[i].Cells[1].Value);
                newProjectOfficeChecklistModel.TemplatesPlanning.Add(new ProjectOfficeChecklistModel.Questionare(question, answer));
            }

            newProjectOfficeChecklistModel.TemplatesExecution= new List<ProjectOfficeChecklistModel.Questionare>();
            int executionRowCount = dataGridViewExecution.Rows.Count - 1;

            for (int i = 0; i < executionRowCount; i++)
            {
                var question = dataGridViewExecution.Rows[i].Cells[0].Value?.ToString() ?? "";
                bool answer = Convert.ToBoolean(dataGridViewExecution.Rows[i].Cells[1].Value);
                newProjectOfficeChecklistModel.TemplatesExecution.Add(new ProjectOfficeChecklistModel.Questionare(question, answer));
            }

            newProjectOfficeChecklistModel.TemplatesClosure = new List<ProjectOfficeChecklistModel.Questionare>();
            int closureRowCount = dataGridViewClosure.Rows.Count - 1;

            for (int i = 0; i < closureRowCount; i++)
            {
                var question = dataGridViewClosure.Rows[i].Cells[0].Value?.ToString() ?? "";
                bool answer = Convert.ToBoolean(dataGridViewClosure.Rows[i].Cells[1].Value);
                newProjectOfficeChecklistModel.TemplatesClosure.Add(new ProjectOfficeChecklistModel.Questionare(question, answer));
            }

            List<VersionControl<ProjectOfficeChecklistModel>.DocumentModel> documentModels = versionControl.DocumentModels;

            if (!versionControl.isEqual(currentProjectOfficeChecklistModel, newProjectOfficeChecklistModel))
            {
                VersionControl<ProjectOfficeChecklistModel>.DocumentModel documentModel = new VersionControl<ProjectOfficeChecklistModel>.DocumentModel(newProjectOfficeChecklistModel, DateTime.Now, VersionControl<ProjectOfficeChecklistModel>.generateID());

                documentModels.Add(documentModel);

                versionControl.DocumentModels = documentModels;
                string json = JsonConvert.SerializeObject(versionControl);
                currentProjectOfficeChecklistModel = JsonConvert.DeserializeObject<ProjectOfficeChecklistModel>(JsonConvert.SerializeObject(newProjectOfficeChecklistModel));
                JsonHelper.saveDocument(json, Settings.Default.ProjectID, "ProjectOfficeCheckList");
                MessageBox.Show("Project Office Checklist saved successfully", "save", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("No changes was made!", "save", MessageBoxButtons.OK);
            }


        }
        public void loadDocument()
        {
            string json = JsonHelper.loadDocument(Settings.Default.ProjectID, "ProjectOfficeChecklist");
            newProjectOfficeChecklistModel = new ProjectOfficeChecklistModel();
            currentProjectOfficeChecklistModel = new ProjectOfficeChecklistModel();

            if (json != "")
            {
                versionControl = JsonConvert.DeserializeObject<VersionControl<ProjectOfficeChecklistModel>>(json);
                newProjectOfficeChecklistModel = JsonConvert.DeserializeObject<ProjectOfficeChecklistModel>(versionControl.getLatest(versionControl.DocumentModels));
                currentProjectOfficeChecklistModel = JsonConvert.DeserializeObject<ProjectOfficeChecklistModel>(versionControl.getLatest(versionControl.DocumentModels));

                for (int i = 0; i < currentProjectOfficeChecklistModel.Premises.Count; i++)
                {
                    dataGridViewPremises.Rows.Add();
                    dataGridViewPremises.Rows[i].Cells[0].Value = currentProjectOfficeChecklistModel.Premises[i].Question;
                    dataGridViewPremises.Rows[i].Cells[1].Value = currentProjectOfficeChecklistModel.Premises[i].Answer;
                }


                for (int i = 0; i < currentProjectOfficeChecklistModel.Equipment.Count; i++)
                {
                    dataGridViewEquipment.Rows.Add();
                    dataGridViewEquipment.Rows[i].Cells[0].Value = currentProjectOfficeChecklistModel.Equipment[i].Question;
                    dataGridViewEquipment.Rows[i].Cells[1].Value = currentProjectOfficeChecklistModel.Equipment[i].Answer;
                }

                for (int i = 0; i < currentProjectOfficeChecklistModel.Roles.Count; i++)
                {
                    dataGridViewRoles.Rows.Add();
                    dataGridViewRoles.Rows[i].Cells[0].Value = currentProjectOfficeChecklistModel.Roles[i].Question;
                    dataGridViewRoles.Rows[i].Cells[1].Value = currentProjectOfficeChecklistModel.Roles[i].Answer;
                }

                for (int i = 0; i < currentProjectOfficeChecklistModel.StandardsProcesses.Count; i++)
                {
                    dataGridViewStandardsProcesses.Rows.Add();
                    dataGridViewStandardsProcesses.Rows[i].Cells[0].Value = currentProjectOfficeChecklistModel.StandardsProcesses[i].Question;
                    dataGridViewStandardsProcesses.Rows[i].Cells[1].Value = currentProjectOfficeChecklistModel.StandardsProcesses[i].Answer;
                }

                for (int i = 0; i < currentProjectOfficeChecklistModel.TemplatesInitiation.Count; i++)
                {
                    dataGridViewInit.Rows.Add();
                    dataGridViewInit.Rows[i].Cells[0].Value = currentProjectOfficeChecklistModel.TemplatesInitiation[i].Question;
                    dataGridViewInit.Rows[i].Cells[1].Value = currentProjectOfficeChecklistModel.TemplatesInitiation[i].Answer;
                }

                for (int i = 0; i < currentProjectOfficeChecklistModel.TemplatesPlanning.Count; i++)
                {
                    dataGridViewPlanning.Rows.Add();
                    dataGridViewPlanning.Rows[i].Cells[0].Value = currentProjectOfficeChecklistModel.TemplatesPlanning[i].Question;
                    dataGridViewPlanning.Rows[i].Cells[1].Value = currentProjectOfficeChecklistModel.TemplatesPlanning[i].Answer;
                }

                for (int i = 0; i < currentProjectOfficeChecklistModel.TemplatesExecution.Count; i++)
                {
                    dataGridViewExecution.Rows.Add();
                    dataGridViewExecution.Rows[i].Cells[0].Value = currentProjectOfficeChecklistModel.TemplatesExecution[i].Question;
                    dataGridViewExecution.Rows[i].Cells[1].Value = currentProjectOfficeChecklistModel.TemplatesExecution[i].Answer;
                }

                for (int i = 0; i < currentProjectOfficeChecklistModel.TemplatesClosure.Count; i++)
                {
                    dataGridViewClosure.Rows.Add();
                    dataGridViewClosure.Rows[i].Cells[0].Value = currentProjectOfficeChecklistModel.TemplatesClosure[i].Question;
                    dataGridViewClosure.Rows[i].Cells[1].Value = currentProjectOfficeChecklistModel.TemplatesClosure[i].Answer;
                }

            }
            else
            {
                versionControl = new VersionControl<ProjectOfficeChecklistModel>();
                versionControl.DocumentModels = new List<VersionControl<ProjectOfficeChecklistModel>.DocumentModel>();
                List<string> premisesQuestion = new List<string>();
                premisesQuestion.Add("Were the Project Office requirements documented?");
                premisesQuestion.Add("Have the Project Office premises been procured?");
                premisesQuestion.Add("Are the premises in a practical location?");
                premisesQuestion.Add("Do the premises meet the requirements documented?");
                premisesQuestion.Add("Is there a formal contract for the lease / purchase / use of the premises?");
                premisesQuestion.Add("Do the premises provide sufficient space for the project team?");
                premisesQuestion.Add("Will the premises continue to be available if the project is delayed?");
                premisesQuestion.Add("Do the premises require additional fit-out (e.g. partitions, cabling, air conditioning)?");
                premisesQuestion.Add("Are the on-site facilities sufficient (e.g. number of meeting rooms, bathrooms)?");
                for (int i = 0; i < premisesQuestion.Count; i++)
                {
                    dataGridViewPremises.Rows.Add();
                    dataGridViewPremises.Rows[i].Cells[0].Value = premisesQuestion[i];
                    dataGridViewPremises.Rows[i].Cells[1].Value = false;
                }

                List<string> equipmentQuestion = new List<string>();
                equipmentQuestion.Add("Does the project team have the required office equipment and application software available to manage the project (e.g. computer hardware, project planning and financial software, projectors, fax machines, printers, scanners, copiers)?");
                equipmentQuestion.Add("Is spare equipment available in case of a shortage?");
                equipmentQuestion.Add("Is office equipment functioning as required?");
                equipmentQuestion.Add("Are sufficient communications technologies available (e.g. computer networks, email, internet access, remote network dial-up software, mobile phones, laptops and hand-held devices)?");
                equipmentQuestion.Add("Is video conferencing equipment available?");
                equipmentQuestion.Add("Is the equipment functioning as required?");
                for (int i = 0; i < equipmentQuestion.Count; i++)
                {
                    dataGridViewEquipment.Rows.Add();
                    dataGridViewEquipment.Rows[i].Cells[0].Value = equipmentQuestion[i];
                    dataGridViewEquipment.Rows[i].Cells[1].Value = false;
                }

                List<string> rolesQuestion = new List<string>();
                rolesQuestion.Add("Have the Project Sponsor been established?");
                rolesQuestion.Add("Have the Project Manager been appointed?");
                rolesQuestion.Add("Have the Project Office Manager been appointed?");
                rolesQuestion.Add("Have the Procurement Manager been appointed?");
                rolesQuestion.Add("Have the Communications Manager been appointed?");
                rolesQuestion.Add("Have the Quality Manager been appointed?");
                rolesQuestion.Add("Have the Risk Manager been appointed?");
                rolesQuestion.Add("Have the Team Leader(s) been appointed?");
                rolesQuestion.Add("Have Job Descriptions been documented for all the project roles?");
                rolesQuestion.Add("Do all Job Descriptions describe the responsibilities and performance criteria?");
                rolesQuestion.Add("Were suitably skilled people appointed to all the project roles?");

                for (int i = 0; i < rolesQuestion.Count; i++)
                {
                    dataGridViewRoles.Rows.Add();
                    dataGridViewRoles.Rows[i].Cells[0].Value = rolesQuestion[i];
                    dataGridViewRoles.Rows[i].Cells[1].Value = false;
                }

                List<string> standardsProcesses = new List<string>();
                standardsProcesses.Add("Have the required Industry standards (ISO) been identified?");
                standardsProcesses.Add("Have the required Health & Safety Standards been identified?");
                standardsProcesses.Add("Have the required Project Planning & Reporting Standards been identified?");
                standardsProcesses.Add("Have PMI® & PMBOK® been established?");
                standardsProcesses.Add("Has a suitable Project Management methodology been implemented?");

                standardsProcesses.Add("Have the Time Management Process been defined?");
                standardsProcesses.Add("Have the Cost Management Process been defined?");
                standardsProcesses.Add("Have the Quality Management Process been defined?");
                standardsProcesses.Add("Have the Change Management Process been defined?");
                standardsProcesses.Add("Have the Risk Management Process been defined?");
                standardsProcesses.Add("Have the Issue Management Process been defined?");
                standardsProcesses.Add("Have the Procurement Management Process been defined?");
                standardsProcesses.Add("Have the Acceptance Management Process been defined?");
                standardsProcesses.Add("Have the Communications Management Process been defined?");

                for (int i = 0; i < standardsProcesses.Count; i++)
                {
                    dataGridViewStandardsProcesses.Rows.Add();
                    dataGridViewStandardsProcesses.Rows[i].Cells[0].Value = standardsProcesses[i];
                    dataGridViewStandardsProcesses.Rows[i].Cells[1].Value = false;
                }

                List<string> templatesInit = new List<string>();
                templatesInit.Add("Is the Business Case template available?");
                templatesInit.Add("Is the Feasibility Study template available?");
                templatesInit.Add("Is the Terms of Reference template available?");
                templatesInit.Add("Is the Job Description template available?");
                templatesInit.Add("Is the Stage Gate Review Form template available?");
                for (int i = 0; i < templatesInit.Count; i++)
                {
                    dataGridViewInit.Rows.Add();
                    dataGridViewInit.Rows[i].Cells[0].Value = templatesInit[i];
                    dataGridViewInit.Rows[i].Cells[1].Value = false;
                }

                List<string> templatesPlans = new List<string>();
                templatesPlans.Add("Is the Project Plan template available?");
                templatesPlans.Add("Is the Resource Plan template available?");
                templatesPlans.Add("Is the Financial Plan template available?");
                templatesPlans.Add("Is the Quality Plan template available?");
                templatesPlans.Add("Is the Risk Plan template available?");
                templatesPlans.Add("Is the Acceptance Plan template available?");
                templatesPlans.Add("Is the Communications Plan template available?");
                templatesPlans.Add("Is the Procurement Plan template available?");
                templatesPlans.Add("Is the Supplier Contract template available?");
                templatesPlans.Add("Is the Tender Register template available?");
                for (int i = 0; i < templatesPlans.Count; i++)
                {
                    dataGridViewPlanning.Rows.Add();
                    dataGridViewPlanning.Rows[i].Cells[0].Value = templatesPlans[i];
                    dataGridViewPlanning.Rows[i].Cells[1].Value = false;
                }

                List<string> templatesExecution = new List<string>();
                templatesExecution.Add("Is the Acceptance Register template available?");
                templatesExecution.Add("Is the Timesheet Form and Timesheet Register template available?");
                templatesExecution.Add("Is the Expense Form and Expense Register template available?");
                templatesExecution.Add("Is the Quality Form and Deliverables Register template available?");
                templatesExecution.Add("Is the Change Form and Change Register template available?");
                templatesExecution.Add("Is the Risk Form and Risk Register template available?");
                templatesExecution.Add("Is the Issue Form and Issue Register template available?");
                templatesExecution.Add("Is the Purchase Order Form template available?");
                templatesExecution.Add("Is the Procurement Register template available?");
                templatesExecution.Add("Is the Project Status Report template available?");
                templatesExecution.Add("Is the Communications Register template available?");
                templatesExecution.Add("Is the Acceptance Form template available?");
                for (int i = 0; i < templatesExecution.Count; i++)
                {
                    dataGridViewExecution.Rows.Add();
                    dataGridViewExecution.Rows[i].Cells[0].Value = templatesExecution[i];
                    dataGridViewExecution.Rows[i].Cells[1].Value = false;
                }

                List<string> templatesClosure = new List<string>();
                templatesClosure.Add("Is the Project Closure Report template available?");
                templatesClosure.Add("Is the Post Implementation Review© template available?");
                for (int i = 0; i < templatesClosure.Count; i++)
                {
                    dataGridViewClosure.Rows.Add();
                    dataGridViewClosure.Rows[i].Cells[0].Value = templatesClosure[i];
                    dataGridViewClosure.Rows[i].Cells[1].Value = false;
                }
            }
        }