public RequirementEditorForm(PresentationModel presentationModel, Project project)
        {
            InitializeComponent();
            this._presentationModel = presentationModel;
            this._project = project;
            versionLabel.Text = "1";
            GetUserListByProject();

            _selectedHandler = new User();
            _selectedType = new NormalAttribute();
            _selectedPriority = new NormalAttribute();
            _selectedStatus = new NormalAttribute();

            _projectIds = new List<int>();
            _projectNames = new List<string>();
            _requireIds = new List<int>();
            _requireNames = new List<string>();
            _statusIds = new List<int>();
            _statusNames = new List<string>();
            _projectMemberArrayList = new List<int>();

            GetRequirementMethod(PRIORITY);
            GetRequirementMethod(REQUIREMENT);
            GetRequirementMethod(STATUS);
            CheckPriority();
        }
 public async void RefreshProjectList()
 {
     RefreshOwnedProjectList();
     RefreshManagedProjectList();
     HttpResponseMessage response = await _presentationModel.GetProjectList();
     string content = await response.Content.ReadAsStringAsync();
     if (response.StatusCode == HttpStatusCode.OK)
     {
         JObject json = JObject.Parse(content);
         string message = json["result"].ToString();
         JArray jsonArray = JArray.Parse(json["projects"].ToString());
         if (message == "success")
         {
             this.joinedProjectListDataGridView.Rows.Clear();
             foreach (JObject jObject in jsonArray)
             {
                 this.joinedProjectListDataGridView.Rows.Add(jObject["name"]);
                 Project project = new Project(int.Parse(jObject["id"].ToString()), jObject["name"].ToString(), jObject["description"].ToString());
                 _joinedProjects.Add(project);
             }
         }
     }
     else if (response.StatusCode == HttpStatusCode.RequestTimeout)
     {
         MessageBox.Show("伺服器無回應", "Error", MessageBoxButtons.OK);
     }
     else
     {
         MessageBox.Show("伺服器錯誤", "Error", MessageBoxButtons.OK);
     }
 }
 public ProjectMainForm(PresentationModel presentationModel, Project project)
 {
     InitializeComponent();
     this._presentationModel = presentationModel;
     RefreshProjectDetail(project);
     type = UserInterfaceForm.FunctionalType.Hide;
     CheckPriority();
 }
 public ProjectEditorForm(PresentationModel presentationModel, Project project)
 {
     InitializeComponent();
     this._presentationModel = presentationModel;
     this._project = project;
     nameTextBox.Text = _project.NAME;
     descriptionRichTextBox.Text = _project.DESC;
 }
        public TestEditorForm(PresentationModel presentationModel, Project project)
        {
            InitializeComponent();
            _project = project;
            _presentationModel = presentationModel;

            GetUserListByProject();
            GetRequirementByProject();
        }
 public RequirementListForm(MainForm mainForm,Project project)
 {
     InitializeComponent();
     this.mainForm = mainForm;
     this.project = project;
     this.requirementListDataGridView.ClearSelection();
     array = new ArrayList();
     GetRequirementByProject();
 }
 public UserListForm(PresentationModel presentationModel, Project project)
 {
     InitializeComponent();
     this._project = project;
     this._presentationModel = presentationModel;
     this._arrayList = new ArrayList();
     memberDataGridView.Columns[2].Visible = false;
     GetUserListByProject();
     GetProjectPriorityType();
 }
 public TestListForm(PresentationModel presentationModel, Project project)
 {
     InitializeComponent();
     this._presentationModel = presentationModel;
     this._project = project;
     _arrayList = new ArrayList();
     type = UserInterfaceForm.FunctionalType.Hide;
     testListDataGridView.Columns[2].Visible = false;
     RefreshTestList();
     CheckPriority();
 }
 public OthersForm(PresentationModel presentationModel, Project project)
 {
     InitializeComponent();
     _project = project;
     _presentationModel = presentationModel;
     _functionalType = UserInterfaceForm.FunctionalType.Hide;
     type = UserInterfaceForm.FunctionalType.Hide;
     GetRequirementByProject();
     GetNoAssociatedTestCaseByProjectId();
     GetNoAssociatedRequirementByProjectId();
 }
 public RequirementListForm(PresentationModel presentationModel, Project project)
 {
     InitializeComponent();
     this._presentationModel = presentationModel;
     this._project = project;
     this.requirementListDataGridView.ClearSelection();
     type = UserInterfaceForm.FunctionalType.Hide;
     _arrayList = new ArrayList();
     requirementListDataGridView.Columns[2].Visible = false;
     requirementListDataGridView.Columns[3].Visible = false;
     GetRequirementByProject();
     CheckPriority();
 }
        public TraceabilityMatrixForm(PresentationModel presentationModel, Project project)
        {
            InitializeComponent();
            _project = project;
            _presentationModel = presentationModel;
            /*
            DataGridViewColumnCollection columns = matrixDataGridView.Columns;
            columns.Add("nullColumn", "Traceability Matrix");
            columns.Add("testColumn1", "Test 1");
            columns.Add("testColumn2", "Test 2");
            columns.Add("testColumn3", "Test 3");
            columns.Add("testColumn4", "Test 4");
            columns.Add("testColumn5", "Test 5");
            columns.Add("testColumn6", "Test 6");
            DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
            checkColumn.Name = "testColumn7";
            checkColumn.HeaderText = "Test 7";
            checkColumn.TrueValue = true;
            checkColumn.FalseValue = false;
            checkColumn.FillWeight = 10; //if the datagridview is resized (on form resize) the checkbox won't take up too much; value is relative to the other columns' fill values
            matrixDataGridView.Columns.Add(checkColumn);

            columns.Cast<DataGridViewColumn>().ToList().ForEach(f => f.SortMode = DataGridViewColumnSortMode.NotSortable);

            DataGridViewRowCollection rows = matrixDataGridView.Rows;
            rows.Add("Requirement 1");
            rows.Add("Requirement 2");
            rows.Add("Requirement 3");
            rows.Add("Requirement 4");
            rows.Add("Requirement 5");
            rows.Add("Requirement 6");
            rows.Add("Requirement 7");
            rows.Add("Requirement 8");
            rows.Add("Requirement 9");
            rows.Add("Requirement 10");
            rows.Add("Requirement 11");
            rows.Add("Requirement 12");
            matrixDataGridView.Columns[0].Frozen = true;
            bool flag = false;
            foreach (DataGridViewRow row in matrixDataGridView.Rows)
            {
                DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells[7];
                chk.Selected = flag;
                flag = !flag;
            }*/

            //CreateCell(new string[]{"1", "2"}, new string[]{"1", "2"});
            GetRequirementByProject();
        }
        public async Task<Project[]> GetOwnedProjectListByUserId()
        {
            HttpClient client = new HttpClient();
            HttpResponseMessage response;
            var httpClient = new HttpClient();
            try
            {
                const string METHOD = "project/getOwnerProjectListByUserId/";
                string url = BASE_URL + METHOD + UID.ToString();
                response = await httpClient.GetAsync(url);
                string content = await response.Content.ReadAsStringAsync();
                JArray jsonArray = JArray.Parse(content);
                Project[] projects = new Project[jsonArray.Count];
                for (int i = 0; i < jsonArray.Count; i++)
                {
                    JObject jObject = jsonArray[i] as JObject;
                    projects[i] = new Project(int.Parse(jObject["id"].ToString()), jObject["name"].ToString(), jObject["description"].ToString());
                }

                return projects;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public async Task<string> EditProject(Project project)
 {
     HttpClient client = new HttpClient();
     HttpResponseMessage response;
     var httpClient = new HttpClient();
     try
     {
         JObject jObject = new JObject();
         jObject["pid"] = project.ID;
         jObject["name"] = project.NAME;
         jObject["description"] = project.DESC;
         const string METHOD = "project/update";
         string url = BASE_URL + METHOD;
         response = await httpClient.PostAsync(url, new StringContent(jObject.ToString(), Encoding.UTF8, "application/json"));
         string content = await response.Content.ReadAsStringAsync();
         if (response.StatusCode == HttpStatusCode.OK)
         {
             JObject json = JObject.Parse(content);
             string message = json["result"].ToString();
             if (message == "success")
             {
                 return "專案修改成功";
             }
             else
             {
                 return "專案修改失敗";
             }
         }
         else
         {
             return "專案修改失敗";
         }
     }
     catch (HttpRequestException)
     {
         return "伺服器無回應";
     }
 }
 public async Task<string> EditProject(Project project)
 {
     return await _model.EditProject(project);
 }
 public void RefreshProjectDetail(Project project)
 {
     this._project = project;
     _nameLabel.Text = project.NAME;
     _descriptionText.Text = project.DESC;
 }