private void SubmitEmployee_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32((NIC.Text.ToString()).Length) != 10)
            {
                MessageBox.Show("Invalid NIC");
                return;
            }

            if (DOB.Value.Year > DateTime.Now.Year || (DOB.Value.Month > DateTime.Now.Month && DOB.Value.Year == DateTime.Now.Year))
            {
                MessageBox.Show("Do not Enter Future Periods");
                return;
            }

            if (ServiceStartDate.Value.Year > DateTime.Now.Year || (ServiceStartDate.Value.Month > DateTime.Now.Month && ServiceStartDate.Value.Year == DateTime.Now.Year))
            {
                MessageBox.Show("Do not Enter Future Periods");
                return;
            }
            if (PensionReg.Value.Year > DateTime.Now.Year || (PensionReg.Value.Month > DateTime.Now.Month && PensionReg.Value.Year == DateTime.Now.Year))
            {
                MessageBox.Show("Do not Enter Future Periods");
                return;
            }


            try
            {
                double salary;
                salary = (Convert.ToDouble(TBasicSalary.Text.ToString())) + (Convert.ToDouble(TAllowances.Text.ToString()));
                MemberUser mu  = new MemberUser(NIC.Text.ToString(), MemName.Text.ToString(), DOB.Value, ServiceStartDate.Value, PensionReg.Value, Convert.ToInt32(Uni.SelectedValue.ToString()), Convert.ToInt32(Post.SelectedValue.ToString()), Academic, salary, Convert.ToInt32(Bank.SelectedValue.ToString()), ActNo.Text.ToString(), Convert.ToDouble(TBasicSalary.Text.ToString()), Convert.ToDouble(TAllowances.Text.ToString()), mem.HashCode("password123"), Email.Text.ToString());
                MemberBUO  mbu = new MemberBUO();

                if (mbu.RegisterMember(mu))
                {
                    MessageBox.Show("Update Successful");
                }
                else
                {
                    MessageBox.Show("Update Failed");
                }

                cb.FillComboBox(DType, "dependenttype", "DependentType", "DependentTypeID");
                cleartxt();
                cb.FillComboBox(CEID, "Employee", "ID", "ID");
            }


            catch (Exception ex)
            {
                MessageBox.Show("Invalid Entry");
            }
            cb.FillComboBox(CEID, "Employee", "ID", "ID");
        }
Example #2
0
        private void NewEntry_Click(object sender, EventArgs e)
        {
            AdminVO ad = new AdminVO(tNIC.Text, tLoginName.Text, Convert.ToInt32(Type.SelectedValue.ToString()), mb.HashCode("Admin"));

            if (mb.RegisterAdmin(ad))
            {
                MessageBox.Show("Update Successful");
            }
            else
            {
                MessageBox.Show("Update Failed");
            }

            cb.FillDataGrid(AdminView, "Admin");
            AdminView.Columns["AdminPassword"].Visible = false;
            Refresh();
        }