private async void showRecordBtn_Click(object sender, EventArgs e)
 {
     StorageSelector storage = new StorageSelector();
     allEmpDataTable = await Task.FromResult<List<Employees>>(storage.getAllEmpDataTable());
     //allEmpDataTable = storage.getAllEmpDataTable();
     recordShowDataGridView.DataSource = allEmpDataTable;
     
 }
        public List<EventNotifier> getAllNotifications(DateTime todaysDate,int days)
        {
            StorageSelector selectmethod =new StorageSelector();
            List<Employees> allEmpDataTable = selectmethod.getAllEmpDataTable();

            DateTime bdynextdays = todaysDate.AddDays(days);
            DateTime fiveyrs = todaysDate.AddYears(-5);
            DateTime fivenextyrs = todaysDate.AddYears(-5).AddDays(days);
            DateTime threeyrs = todaysDate.AddYears(-3);
            DateTime threenextyrs = todaysDate.AddYears(-3).AddDays(days);
            List<EventNotifier> listnotification = new List<EventNotifier>();

            int total1;
            int total2;
            int total3;
            int noOfdays;
            DateTime threeyrsDate;
            foreach (Employees rows in allEmpDataTable)
            {
                total1 = rows.DateOfBirth.Day + rows.DateOfBirth.Month * 100;
                total2 = todaysDate.Day + todaysDate.Month * 100;

                total3= bdynextdays.Day + bdynextdays.Month * 100 ;

                if(total1 >= total2 && total1 <= total3)
                {
                    noOfdays = rows.DateOfBirth.DayOfYear - todaysDate.DayOfYear;
                    listnotification.Add(new EventNotifier(noOfdays, "BirthDay", rows.EmpName,rows.EmpLastName, rows.EmailId));
                }

                threeyrsDate = rows.DateOfJoining;

                if (threeyrsDate >= threeyrs && threeyrsDate <= threenextyrs)
                {
                    noOfdays = threeyrsDate.DayOfYear - todaysDate.DayOfYear;
                    listnotification.Add(new EventNotifier(noOfdays, "Three Years", rows.EmpName, rows.EmpLastName, rows.EmailId));
                }

                if (threeyrsDate >= fiveyrs && threeyrsDate <= fivenextyrs)
                {
                    noOfdays = threeyrsDate.DayOfYear - todaysDate.DayOfYear;
                    listnotification.Add(new EventNotifier(noOfdays, "Five Years", rows.EmpName, rows.EmpLastName, rows.EmailId));
                }
            }

            return listnotification;
        }
        private void submitTxt_Click(object sender, EventArgs e)
         {

             bool flag = true;

             Regex rx_name = new Regex("^[a-zA-Z ]+$");
             Regex rx_ename = new Regex("([A-Za-z0-9])+@([A-Za-z0-9]{3,15})+.([A-Za-z]{2,4})$");

             if (!rx_name.IsMatch(nameTxtBox.Text))
             {
                 errNameLabel.Text = "name must be entererd";
                 flag = false;
             }
             else
             {
                 errNameLabel.Text = "";
                 flag = true;
             }


             if (!rx_name.IsMatch(middleNameTxtBox.Text))
             {
                 errMName.Text = "enter middle name";
                 flag = false;
             }
             else
             {
                 errMName.Text = "";
                 flag = true;

             }

             if (!rx_name.IsMatch(lastNameTxtBox.Text))
             {
                 errLName.Text = "enter last name";
                 flag = false;
             }
             else
             {
                 errLName.Text = "";
                 flag = true;
             }

            if(!rx_ename.IsMatch(emailTxtBox.Text))
            {
                errEmailLabel.Text ="enter email";
                flag = false;
            }
            else
            {
                errEmailLabel.Text = "";
                flag = true;
            }

            if(!rx_name.IsMatch(designationTxtBox.Text))
            {
                errDesignationLabel.Text ="enter designation";
                flag = false;
            }
            else
            {
                errDesignationLabel.Text = "";
                flag = true;
            }

            if(!rx_name.IsMatch(descriptionTxtBox.Text))
            {
                errDescriptionLabel.Text = "enter hobbies";
                flag = false;
            }
            else
            {
                errDescriptionLabel.Text = "";
                flag = true;
            }



            StorageSelector addempObj = new StorageSelector();
            string empname = nameTxtBox.Text.Trim();
            string emplastname = lastNameTxtBox.Text.Trim();
            string empmiddlename = middleNameTxtBox.Text.Trim();
            string empprifix = prefixComboBox.SelectedItem.ToString();
            DateTime dateofbirth = Convert.ToDateTime(DOBdateTimePicker.Text).Date;
            DateTime dateofjoining = Convert.ToDateTime(joiningDateDateTimePicker.Text).Date;
            string value = "";
            if (maleRadioButton.Checked)
                value = maleRadioButton.Text;
            else if (femaleRadioButton.Checked)

                value = femaleRadioButton.Text;
            string empgender = value;
            string emailid = emailTxtBox.Text.Trim();
            string designation = designationTxtBox.Text.Trim();
            string empimagepath = imgName;
            string description = descriptionTxtBox.Text;
            Int32 teamId = (Int32)teamIdComboBox.SelectedValue;
            addempObj.AddEmployee(empname, emplastname, dateofbirth, dateofjoining, emailid, designation, empgender, empprifix, empmiddlename, empimagepath,description,teamId);
            MessageBox.Show("employee added successfully");

            
        }