Exemplo n.º 1
0
        /// <summary>
        /// Handler when login button is clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void loadingScreenButtonLoginClicked(object sender, EventArgs e)
        {
            //Did the user put in some values.
            if (this.loadingScreenInputUsername.Text.Length > 0)
            {
                //Convert password to a hash.
                ARA_Login loginHandler = new ARA_Login();

                //Try to login the user.
                if (loginHandler.login())
                {
                    loginHandler = null;

                    //Add log message.
                    ARA_Events.triggerUserLoggedInEvent();

                    this.Hide();

                    ARA_BaseForm mainApp = new ARA_BaseForm();
                    mainApp.Closed += (s, args) => this.Close();
                    mainApp.Show();
                }
                else
                {
                    MessageBox.Show(ARA_Constants.messageBoxLoginFailded, ARA_Constants.messageBoxLoginFaildedHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handler when te button is pressed to mark the project as DRAFT if there need to be changes made or FINALDRAFT afterwards.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void riskProjectOverviewButtonMarkDoneReview_Click(object sender, EventArgs e)
        {
            if (this.is_ProjectReview_AcceptedTableAdapter.GetData(this.projectID).Rows[0]["IsProjectReviewAccepted"].ToString() == "1")
            {
                if (System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxConfirmFinalDraft, ARA_Constants.messageBoxConfirmFinalDraftHeader, MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    this.queriesTableAdapter1.Update_Project_State(this.projectID, ARA_Constants.finalDraft);

                    //Log event.
                    ARA_Events.triggerProjectStateChangedEvent(this.projectID, ARA_Constants.finalDraft);
                }
            }
            else
            {
                if (System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxConfirmDraft, ARA_Constants.messageBoxConfirmDraftHeader, MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    this.queriesTableAdapter1.Update_Project_State(this.projectID, ARA_Constants.draft);
                    this.queriesTableAdapter1.Increase_Project_DraftVersion(this.projectID);

                    //Log event.
                    ARA_Events.triggerProjectStateChangedEvent(this.projectID, ARA_Constants.draft);
                }
            }

            //Hide the button when the project state changes.
            enableControlOnProjectState();
        }
        /// <summary>
        /// //Click handler when the user clicks the create project button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onCreateProjectButtonClick(object sender, EventArgs e)
        {
            if (canProjectBeCreated())
            {
                //Executes procedure for adding an riskproject to the database.
                this.createProjectDatabaseAdapter.Create_RiskProject
                (
                    ARA_Globals.UserID,
                    this.createProjectInputCustomer.Text,
                    this.createProjectInputMachineType.Text,
                    this.createProjectInputMachineNumber.Text,
                    this.createProjectInputOrderNumber.Text,
                    this.createProjectInputExtraInfo.Text
                );

                int newestAddedProject = (Int32)this.get_Newest_Added_ProjectTableAdapter.GetData().Rows[0]["NewestProject"];
                this.projectSideBarButton      = new ARA_Button();
                this.projectSideBarButton.Text = this.createProjectInputMachineNumber.Text;

                //Let other forms know that there is a new project.
                ARA_Events.triggerNewProjectCreatedEvent(newestAddedProject);

                //Trigger event to add a button to the sidebar and attach this form to it.
                Applicatie_Risicoanalyse.Globals.ARA_Events.triggerSideBarAddNewButtonEvent(
                    this.projectSideBarButton,
                    Activator.CreateInstance(typeof(ARA_RiskProjectOverview), newestAddedProject));

                clearInputFields();
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// RiskAnalysis button click handler.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void onRiskAnalysisButtonClick(object sender, EventArgs e)
 {
     this.SideBarButtonMenu.setButtonSelected(true);
     this.hideOtherPanels(new object(), e);
     Applicatie_Risicoanalyse.Globals.ARA_Events.triggerOpenContentFormEvent(this.projectOverview);
     ARA_Events.triggerBaseFormSetTopBarEvent(null);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Handler when the user want to create a project revision of a project.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void projectRevisionButtonCreateRevision_Click(object sender, EventArgs e)
        {
            try
            {
                //Did the user select some row?
                if (this.projectRevisionDataGrid.SelectedRows.Count > 0)
                {
                    int    selectedProjectID   = (Int32)this.projectRevisionDataGrid.SelectedRows[0].Cells["projectIDDataGridViewTextBoxColumn"].Value;
                    int    selectedRevision    = Int32.Parse(this.projectRevisionDataGrid.SelectedRows[0].Cells["Revision"].Value.ToString()) + 1;
                    string selectedProjectName = this.projectRevisionDataGrid.SelectedRows[0].Cells["machineNumberDataGridViewTextBoxColumn"].Value.ToString();

                    //Execute procedure to create a project revision.
                    queriesTableAdapter1.Create_RiskProject_Revision(selectedProjectID, ARA_Globals.UserID);

                    //Log event.
                    ARA_Events.triggerNewProjectRevisionEvent(selectedProjectID, selectedRevision, selectedProjectName);

                    //Let the user know something happend.
                    MessageBox.Show(ARA_Constants.messageBoxProjectRevisionCreated, ARA_Constants.messageBoxProjectRevisionCreatedHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ARA_Constants.messageBoxProjectRevisionFailed + ex, ARA_Constants.messageBoxProjectRevisionFailedHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Handler when the user has added a risk to the project.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addRiskToProject(object sender, AddRiskToProjectEvent e)
        {
            if (e.projectID != this.projectID)
            {
                return;
            }
            ARA_ListItem clickedText = (ARA_ListItem)sender;

            if (clickedText != null)
            {
                //Is the risk already in the project?
                if (clickedText.BackgroundColor == ARA_Colors.ARA_Green)
                {
                    //Change its color and remove it from the database.
                    clickedText.BackgroundColor = Color.White;
                    this.queriesTableAdapter1.Delete_From_ProjectRisks(e.projectID, e.riskID);
                }
                else
                {
                    //Change its color and add a new risk to the database.
                    clickedText.BackgroundColor = ARA_Colors.ARA_Green;
                    this.queriesTableAdapter1.Insert_In_ProjectRisks(e.projectID, e.riskID);
                }
                //Update the text.
                clickedText.Invalidate();
            }

            //Let the application know we added a risk.
            ARA_Events.triggerRiskAddedToProjectEvent(this.projectID);
        }
        /// <summary>
        /// Sets project info on the topbar.
        /// </summary>
        private void setTopBarRiskInfo()
        {
            //Set top bar info.
            ARA_TopBar aForm = new ARA_TopBar(
                string.Format("RiskID: {0} -- {1} -> {2}\nVersion: {3}", this.riskID, this.riskGroupName, this.riskTypeName, this.riskVersionID),
                string.Format("{0}", this.hazardSituation));

            ARA_Events.triggerBaseFormSetTopBarEvent(aForm);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Handler when a SideBarAddNewButtonEvent is triggerd.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void onAddNewButtonToSideBar(object sender, SideBarAddNewButtonEvent e)
        {
            //Do we already have this project open?
            foreach (ARA_Button button in this.SideBarButtonContainer.Controls.OfType <ARA_Button>())
            {
                if (button.Text.ToString().Equals(e.Button.Text.ToString()))
                {
                    System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxProjectAlreadyOpen, ARA_Constants.messageBoxProjectAlreadyOpenHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            //Try to open the form instance.
            try
            {
                Applicatie_Risicoanalyse.Globals.ARA_Events.triggerOpenContentFormEvent((Form)e.FormType);
            }
            catch (Exception)
            {
                throw;
            }

            //Are there to much buttons in the sidebar? If so, remove one.
            if (this.SideBarButtonContainer.Controls.Count > 3)
            {
                ARA_Events.triggerSideBarRemoveButtonEvent(this.SideBarButtonContainer.Controls.OfType <ARA_Button>().First <ARA_Button>().Text);
            }

            //Add some style to the button.
            ARA_Button tempButton = e.Button;

            tempButton.Margin      = new System.Windows.Forms.Padding(0);
            tempButton.MaximumSize = this.SideBarButtonMenu.MaximumSize;
            tempButton.Padding     = new System.Windows.Forms.Padding(5, 0, 0, 0);
            tempButton.Size        = this.SideBarButtonMenu.Size;

            //And a clickhandler.
            tempButton.Click += delegate(object senderr, EventArgs ev)
            {
                tempButton.setButtonSelected(true);
                //this.hideOtherPanels(new object(), e);
                Applicatie_Risicoanalyse.Globals.ARA_Events.triggerOpenContentFormEvent((Form)e.FormType);
            };
            tempButton.DoubleClick += delegate(object senderr, EventArgs ev)
            {
                ARA_Events.triggerProjectClosedEvent();
                ARA_Events.triggerSideBarRemoveButtonEvent(tempButton.Text);
                onRiskAnalysisButtonClick(senderr, ev);
            };

            //Add the button to the sidebar.
            this.addButtonToSideBar(tempButton);
        }
        /// <summary>
        /// When the button is pressed go to the next risk and mark the risk as accepted by the reviewer.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editRiskBaseFormButtonReviewAccept_Click(object sender, EventArgs e)
        {
            //Update database.
            this.queriesTableAdapter1.Set_Risk_In_Project_Reviewed(this.projectID, this.riskID, ARA_Globals.UserID, string.Empty);

            //Trigger event.
            ARA_Events.triggerRiskInProjectReviewedEvent(this.projectID, this.riskID, true);

            setNextRisk(1);
            setFormData();
            this.AutoScrollPosition = new Point(0, 0);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Handler when the user wants to close the project.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void riskProjectOverviewButtonMarkClose_Click(object sender, EventArgs e)
        {
            if (System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxConfirmCloseProject, ARA_Constants.messageBoxConfirmCloseProjectHeader, MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
            {
                this.queriesTableAdapter1.Update_Project_State(this.projectID, ARA_Constants.closed);

                //Log event.
                ARA_Events.triggerProjectStateChangedEvent(this.projectID, ARA_Constants.closed);

                //Hide the button when the project state changes.
                enableControlOnProjectState();
            }
        }
        /// <summary>
        /// Sets risk info in the topbar of the application.
        /// </summary>
        private void setTopBarRiskInfo()
        {
            //Set top bar info.
            ARA_TopBar aForm = new ARA_TopBar(
                string.Format("RiskID: {0} -- {1} -> {2}\nVersion: {3}, Created by: {4}",
                              this.riskID,
                              this.riskGroupName,
                              this.riskTypeName,
                              this.riskVersionID,
                              this.tbl_UserTableAdapter.GetData().FindByUserID(this.riskCreatedByUserID)["UserName"].ToString()),
                string.Format("{0} {1}",
                              this.hazardSituation,
                              this.isRiskDataProjectSpecific && this.projectID != -1 ? "\n(Project specific)":""));

            ARA_Events.triggerBaseFormSetTopBarEvent(aForm);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Sets the topbar with project specific data.
        /// </summary>
        private void setProjectInfoTopForm()
        {
            //Construct text to display on topbar.
            DataRow riskAnalysisData = this.get_All_RiskProject_InfoTableAdapter.GetData(this.projectID).Rows[0];
            string  leftText         = string.Format("Customer: {0}\nProject state: {1}",
                                                     riskAnalysisData["Customer"],
                                                     riskAnalysisData["StateName"]);
            string rightText = string.Format("Draft version: {0}\nProject revision: {1}",
                                             riskAnalysisData["DraftVersion"],
                                             riskAnalysisData["Revision"]);

            //Create topbar form.
            Form topBar = new ARA_TopBar(leftText, rightText);

            //Trigger event for displaying the form.
            ARA_Events.triggerBaseFormSetTopBarEvent(topBar);
        }
        /// <summary>
        /// Handler when the user wants to add the selected risks to the current opend project.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onCopyRisksButtonClicked(object sender, EventArgs e)
        {
            //Do we have our selection?
            if (this.copyRisksDataGrid.SelectedRows.Count > 0 && this.copyRisksComboBoxProjects.SelectedValue != null)
            {
                //Loop through selected rows.
                foreach (DataGridViewRow row in this.copyRisksDataGrid.SelectedRows)
                {
                    //Execute procedure to copy risks to another project.
                    this.queriesTableAdapter1.Copy_Risk_From_Project_Into_Project((Int32)row.Cells["riskIDDataGridViewTextBoxColumn"].Value, (Int32)this.copyRisksComboBoxProjects.SelectedValue, this.projectID);
                }

                //Let other forms in the application know we added some new risks to this project.
                ARA_Events.triggerRiskAddedToProjectEvent(this.projectID);

                //Let the user know the added some risks to the current opend project.
                System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxSuccesCopiedRisks, ARA_Constants.messageBoxSuccesCopiedRisksHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Handler when the user wants to open a specific project.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void recentProjectsDataGrid_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                //Create a button for our sidebar.
                ARA_Button projectSideBarButton = new ARA_Button();
                projectSideBarButton.Text = this.recentProjectsDataGrid.Rows[e.RowIndex].Cells["machineNumberDataGridViewTextBoxColumn"].Value.ToString();

                //Get selected project id.
                int    projectIDToOpen = (Int32)this.recentProjectsDataGrid.Rows[e.RowIndex].Cells["ProjectID"].Value;
                string projectName     = (String)this.recentProjectsDataGrid.Rows[e.RowIndex].Cells["machineNumberDataGridViewTextBoxColumn"].Value;
                //Log this event.
                ARA_Events.triggerProjectOpendEvent(projectIDToOpen, projectName);

                //Trigger event to add a button to the sidebar and attach this form to it.
                Applicatie_Risicoanalyse.Globals.ARA_Events.triggerSideBarAddNewButtonEvent(
                    projectSideBarButton,
                    Activator.CreateInstance(typeof(ARA_RiskProjectOverview), projectIDToOpen));
            }
        }
        /// <summary>
        /// Checks if the risk is correctly filled in, deletes it otherwise.
        /// </summary>
        private void deleteControlIfItIsNotFilled()
        {
            if (this.arA_NewRiskRiskGrouping1.HasControlBeenChanged == false ||
                this.arA_EditRiskExposedPersons1.HasControlBeenChanged == false ||
                this.arA_EditRiskHazardIndentification1.HasControlBeenChanged == false ||
                this.arA_EditRiskRiskEstimation1.HasControlBeenChanged == false ||
                this.arA_EditRiskRiskReductionMesures1.HasControlBeenChanged == false) //The form is not filled in correctly.
            {
                System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxCoudntCreateRisk, ARA_Constants.messageBoxCoudntCreateRiskHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.queriesTableAdapter1.Delete_Risk(this.riskID, this.riskDataID);
            }
            else //We filled the form correctly
            {
                //Log event.
                ARA_Events.triggerNewRiskAddedToStandardEvent(this.riskID);

                System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxAddedRiskToStandard, ARA_Constants.messageBoxAddedRiskToStandardHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            ARA_Events.OpenContentFormEventHandler -= checkIfControlHasBeenFilledOnClose;
        }
Exemplo n.º 16
0
        /// <summary>
        /// Deletes or adds a risk to the project directly from the searchbar.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onDataGridRowDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                //Execute query to add or delete the risk to the project.
                if (this.addRiskToProjectSearchDataGrid.Rows[e.RowIndex].Cells["inProjectDataGridViewTextBoxColumn"].Value.ToString() == "1")
                {
                    this.queriesTableAdapter1.Delete_From_ProjectRisks(this.projectID, Int32.Parse(this.addRiskToProjectSearchDataGrid.Rows[e.RowIndex].Cells["riskIDDataGridViewTextBoxColumn"].Value.ToString()));
                }
                else
                {
                    this.queriesTableAdapter1.Insert_In_ProjectRisks(this.projectID, Int32.Parse(this.addRiskToProjectSearchDataGrid.Rows[e.RowIndex].Cells["riskIDDataGridViewTextBoxColumn"].Value.ToString()));
                }
                //Sneaky way to fire a textchange event without changing the text.
                this.addRiskToProjectSearchTextBox.Text += "";

                //Let the application know we added a risk.
                ARA_Events.triggerRiskAddedToProjectEvent(this.projectID);
            }
        }
        /// <summary>
        /// Signals the form and the database to make a project specific risk.
        /// </summary>
        private void setRiskDataProjectSpecific()
        {
            if (this.isRiskDataProjectSpecific == false)
            {
                if (this.projectID == -1)//Are we edeting the standard?
                {
                    DataRow tempRow = this.create_New_Risk_VersionTableAdapter.GetData(this.riskID, this.riskVersionID, this.riskDataID, ARA_Globals.UserID).Rows[0];
                    if (tempRow != null && tempRow["newRiskDataID"] != DBNull.Value)
                    {
                        this.riskVersionID += 1;
                        this.riskDataID     = (Int32)tempRow["newRiskDataID"];

                        //Log event.
                        ARA_Events.triggerNewRiskVersionEvent(this.riskID, this.riskVersionID);

                        //Let the user know we made a new version of the risk.
                        System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxNewRiskVersion, ARA_Constants.messageBoxNewRiskVersionHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    //Update risks in open risk projects with new risk version.
                    this.queriesTableAdapter1.Update_Risks_In_Open_Risk_Projects();
                }
                else
                {
                    //Execute query to make risk projectspecific.
                    DataRow tempRow = this.update_RiskDataID_In_RisksInProjectTableAdapter.GetData(this.projectID, this.riskID, ARA_Globals.UserID).Rows[0];
                    this.riskDataID = (Int32)tempRow["newRiskDataID"];

                    //Log event.
                    ARA_Events.triggerProjectSpecificRiskCreatedEvent(this.riskID, this.projectID);

                    //Let the user know we made a project specific project.
                    System.Windows.Forms.MessageBox.Show(ARA_Constants.messageBoxRiskProjectSpecific, ARA_Constants.messageBoxRiskProjectSpecificHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                this.isRiskDataProjectSpecific = true;
                setTopBarRiskInfo();
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Adds component types to a component group.
        /// </summary>
        /// <param name="parentGroup"></param>
        public void addTypeControlsToGroupControl(ARA_ListGroup parentGroup)
        {
            if (parentGroup.ARA_ListGroupDropDownButton.ConnectedPanel.Controls.Count != 0)
            {
                return;
            }
            foreach (DataRow datarow in this.get_TypeNames_In_GroupTableAdapter.GetData(parentGroup.DropDownButtonText).Rows)
            {
                ARA_ListGroup listType = new ARA_ListGroup();
                styleListGroupAsType(parentGroup, listType);
                listType.DropDownButtonText = datarow["TypeName"].ToString();

                //Add functions.
                listType.addFunction(delegate()
                {
                    DataRow risksInTypeDataRow = this.get_Risks_In_Project_TypeTableAdapter.GetData(this.projectID, parentGroup.DropDownButtonText, datarow["TypeName"].ToString()).Rows[0];
                    listType.LabelText         = risksInTypeDataRow["RisksInProjectGroup"] + "/" + risksInTypeDataRow["RisksInGroup"];
                });
                listType.updateControl();
                listType.addFunction(delegate() { this.addRiskControlsToTypeControl(parentGroup, listType); });

                //Add click handler for mass insert/delete risks in project on doubleclick.
                listType.DoubleClick += delegate(object o, EventArgs e)
                {
                    DataRow risksInTypeDataRow = this.get_Risks_In_Project_TypeTableAdapter.GetData(this.projectID, parentGroup.DropDownButtonText, datarow["TypeName"].ToString()).Rows[0];
                    //Execute procedure to add or remove risks from a specific type in the project.
                    this.queriesTableAdapter1.Insert_Risks_From_Type_Into_Project
                    (
                        this.projectID,
                        parentGroup.DropDownButtonText,
                        datarow["TypeName"].ToString(),
                        risksInTypeDataRow["RisksInProjectGroup"].ToString() != risksInTypeDataRow["RisksInGroup"].ToString()
                    );

                    //Let the application know we added a risk.
                    ARA_Events.triggerRiskAddedToProjectEvent(this.projectID);
                };
            }
        }
        /// <summary>
        /// When this button is pressed go to the next risk and mark the risk as declined.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editRiskBaseFormButtonReviewDecline_Click(object sender, EventArgs e)
        {
            ARA_InputDialogPopupForm testDialog = new ARA_InputDialogPopupForm("Give comment", "Leave a comment why this risk is declined.");

            // Show testDialog as a modal dialog and determine if DialogResult = OK.
            if (testDialog.ShowDialog(this) == DialogResult.OK)
            {
                // Read the contents of testDialog's TextBox.
                this.queriesTableAdapter1.Set_Risk_In_Project_Reviewed(this.projectID, this.riskID, -1, "" + testDialog.inputDialogTextboxInput.Text);

                //Trigger event.
                ARA_Events.triggerRiskInProjectReviewedEvent(this.projectID, this.riskID, false);

                setNextRisk(1);
                setFormData();
                this.AutoScrollPosition = new Point(0, 0);
            }
            else
            {
            }
            testDialog.Dispose();
        }
Exemplo n.º 20
0
        /// <summary>
        /// Handler when the user wants to save the new project details.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createProjectButtonCreateProject_Click(object sender, EventArgs e)
        {
            if (canProjectDetailsBeChanged())
            {
                //Execute query for updating project details.
                this.queriesTableAdapter1.Update_ProjectDetails(this.projectID,
                                                                this.editProjectDetailsInputCustomer.Text,
                                                                this.editProjectDetailsInputMachineType.Text,
                                                                this.editProjectDetailsInputMachineNumber.Text,
                                                                this.editProjectDetailsInputOrderNumber.Text,
                                                                this.editProjectDetailsInputExtraInfo.Text);

                //Trigger event.
                ARA_Events.triggerProjectDetailsChangedEvent(this.projectID, this.editProjectDetailsInputMachineNumber.Text);

                //Let the user know we updated the project details.
                MessageBox.Show(ARA_Constants.messageBoxProjectDetailsSaved, ARA_Constants.messageBoxProjectDetailsSavedHeader, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                //Could not update the project details, some input fields are not correctly filled.
                MessageBox.Show(ARA_Constants.messageBoxProjectDetailsFailed, ARA_Constants.messageBoxProjectDetailsFailedHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Add risks in component type into the component type listGroup.
        /// </summary>
        /// <param name="parentGroup"></param>
        /// <param name="parentType"></param>
        public void addRiskControlsToTypeControl(ARA_ListGroup parentGroup, ARA_ListGroup parentType)
        {
            //Did we already create the controls?
            if (parentType.ARA_ListGroupDropDownButton.ConnectedPanel.Controls.Count != 0)
            {
                return;
            }
            //Execute querye and loop through the results.
            foreach (DataRow datarow in this.get_Risks_In_ProjectGroupTypeTableAdapter.GetData(this.projectID, parentGroup.DropDownButtonText, parentType.DropDownButtonText).Rows)
            {
                ARA_ListItem listItem = new ARA_ListItem();
                styleListItemAsRisk(parentType, listItem);

                if (datarow["FileObject"].ToString() != "")
                {
                    var data   = (Byte[])(datarow["FileObject"]);
                    var stream = new MemoryStream(data);
                    listItem.Tag = Image.FromStream(stream);
                }

                //Set text of listItem.
                listItem.TextFirstControl  = "ID " + datarow["RiskID"].ToString();
                listItem.TextSecondControl = datarow["HazardSituation"].ToString();
                listItem.BackgroundColor   = datarow["InProject"].ToString() == "1" ? ARA_Colors.ARA_Green : System.Drawing.Color.White;

                //Add let it execute an event on click.
                listItem.Click += delegate(object o, System.EventArgs e)
                {
                    ARA_Events.triggerAddRiskToProjectEvent(o, this.projectID, Int32.Parse(datarow["RiskID"].ToString()));
                };
                listItem.addFunction(delegate()
                {
                    listItem.BackgroundColor = this.is_Risk_In_ProjectTableAdapter.GetData(this.projectID, Int32.Parse(datarow["RiskID"].ToString())).Rows[0]["InProject"].ToString() == "1" ? ARA_Colors.ARA_Green : Color.White;
                });
            }
        }
 /// <summary>
 /// Handler when the user wants to open the admin panel.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mainMenuButtonOpenAdminPanel_Click(object sender, EventArgs e)
 {
     ARA_Events.triggerOpenContentFormEvent(new ARA_AdministratorForm());
 }
Exemplo n.º 23
0
 /// <summary>
 /// Open new risk form when the user clicks the button for creating a new risk.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void projectOverviewButtonCreateNewRisk_Click(object sender, EventArgs e)
 {
     ARA_Events.triggerOpenContentFormEvent(new ARA_NewRiskBaseForm());
 }