예제 #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.DialogResult result = MessageBox.Show("Submit the entry?", "Decide", MessageBoxButtons.YesNo);
            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                Employee employee = null;
                if (radBtnDev.Checked == true)
                {
                    employee = new Developer();
                    (employee as Developer).Incentive = int.Parse(textLabel6.Text);
                    employee.Basic = int.Parse(textBs.Text);
                    employee.Da    = int.Parse(textDa.Text);
                    employee.Hra   = int.Parse(textHra.Text);

                    employee.CalculateSalary();

                    employee.Name = textName.Text;
                    employee.Id   = int.Parse(textID.Text);

                    BusinessManager.AddEmployeeIntoList(employee as Developer);

                    //textTot.Text = employee.Total.ToString();
                }
                else
                if (radBtnHr.Checked == true)
                {
                    employee = new HR();
                    (employee as HR).Gratuity = int.Parse(textLabel6.Text);
                    employee.Basic            = int.Parse(textBs.Text);
                    employee.Da  = int.Parse(textDa.Text);
                    employee.Hra = int.Parse(textHra.Text);

                    employee.CalculateSalary();
                    //textTot.Text = employee.Total.ToString();

                    employee.Name = textName.Text;
                    employee.Id   = int.Parse(textID.Text);

                    BusinessManager.AddEmployeeIntoList(employee as HR);
                }
                MessageBox.Show("Submitted successfully !!!!");
                this.Close();
            }
            else
            {
                this.Close();
            }
        }