Exemple #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            int           statusID      = Convert.ToInt32(lblStatusID.Text);
            AdminPosition adminPosition = new AdminPosition(lblYearID.Text, lblYear.Text, statusID, lblStatus.Text);

            adminPosition.Show();
            this.Close();
        }
Exemple #2
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (txtPositionName.Text == "" || txtNumOfPer.Text == "" || tblPersonnelEquipment.Rows.Count == 0 || tblPositionEquipment.Rows.Count == 0)
            {
                MessageBox.Show("Please fill up the form!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int NumberOfPersonnel = Convert.ToInt32(txtNumOfPer.Text);
                int RankRequired      = (int)cboRankRequired.SelectedValue;
                int Organization      = (int)cboOrganization.SelectedValue;

                myData.AddPosition(txtPositionName.Text, NumberOfPersonnel, RankRequired, Organization); //Parameters to pass to DataAccess class


                /*
                 * Adds the data from Datagridview to Database
                 */

                for (int i = 0; i < tblPersonnelEquipment.Rows.Count; i++)
                {
                    int PerEquipID  = Convert.ToInt32(tblPersonnelEquipment.Rows[i].Cells["PerEquipmentID"].Value);
                    int PerEquipQty = Convert.ToInt32(tblPersonnelEquipment.Rows[i].Cells["perEquipQty"].Value);
                    myData.AddPersonalEquipment(PerEquipID, PerEquipQty);
                }

                for (int j = 0; j < tblPositionEquipment.Rows.Count; j++)
                {
                    int PosEquipID  = Convert.ToInt32(tblPositionEquipment.Rows[j].Cells["PosEquipmentID"].Value);
                    int PosEquipQty = Convert.ToInt32(tblPositionEquipment.Rows[j].Cells["PosEquipQty"].Value);
                    myData.AddPositionEquipment(PosEquipID, PosEquipQty);
                }

                MessageBox.Show("Position Added!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

                int statusID = Convert.ToInt32(lblStatusID.Text);

                AdminPosition adminPosition = new AdminPosition(lblYearID.Text, lblYear.Text, statusID, lblStatus.Text);
                adminPosition.Show();
                this.Close();
            }
        }