예제 #1
0
        private void Createbtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(IDtxt.Text) || string.IsNullOrEmpty(Nametxt.Text) || string.IsNullOrEmpty(Emailtxt.Text) || string.IsNullOrEmpty(Phonenumbertxt.Text) || string.IsNullOrEmpty(Addresstxt.Text) || string.IsNullOrEmpty(Companytxt.Text) || string.IsNullOrEmpty(VatNotxt.Text))
            {
                return;
            }
            ListViewItem item = new ListViewItem(IDtxt.Text);

            item.SubItems.Add(Nametxt.Text);
            item.SubItems.Add(Emailtxt.Text);
            item.SubItems.Add(Phonenumbertxt.Text);
            item.SubItems.Add(Addresstxt.Text);
            item.SubItems.Add(Companytxt.Text);
            item.SubItems.Add(VatNotxt.Text);
            item.SubItems.Add(Statustxt.Text);
            listView1.Items.Add(item);
            IDtxt.Clear();
            Nametxt.Clear();
            Emailtxt.Clear();
            Phonenumbertxt.Clear();
            Addresstxt.Clear();
            Companytxt.Clear();
            VatNotxt.Clear();
            IDtxt.Focus();
        }
예제 #2
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            if (Emailtxt.Text != "")
            {
                try
                {
                    var eMailValidator = new System.Net.Mail.MailAddress(Emailtxt.Text);
                    var result         = FormOperations.ValidateFields(Nametxt.Text, Surnametext.Text, GenderCmb.SelectedItem.ToString(), Celltxt.Text);

                    if (result)
                    {
                        DTO.Teacher teacher = new DTO.Teacher();

                        teacher.Name    = Nametxt.Text;
                        teacher.Surname = Surnametext.Text;
                        teacher.Gender  = GenderCmb.SelectedItem.ToString();
                        teacher.Cell    = Celltxt.Text;
                        teacher.Email   = Emailtxt.Text;
                        teacher.PIN     = PINTxt.Text;


                        DataAccess.InsertTeacher(teacher);

                        DialogResult dl = MessageBox.Show("Teacer Saved Successfully. Do You want to Proceesd with another Registration?", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (dl == DialogResult.Yes)
                        {
                            TeacherRegtxt.Clear();
                            Nametxt.Clear();
                            Surnametext.Clear();
                            GenderCmb.ResetText();
                            Celltxt.Clear();
                            PINTxt.Clear();
                            Emailtxt.Clear();
                        }
                        else
                        {
                            FormOperations.OpenMenu();
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (FormatException ex)
                {
                    MessageBox.Show("The Email entered is not a valid email address", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message);
                }
            }
            else
            {
                MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #3
0
 private void resetbutton_Click(object sender, EventArgs e)
 {
     IDtxt.Clear();
     Nametxt.Clear();
     DiaChitxt.Clear();
     Emailtxt.Clear();
 }
 private void pictureBox2_Click(object sender, EventArgs e)
 {
     Emailtxt.Clear();
     Passwordtxt.Clear();
     EmailSendtxt.Clear();
     Objecttxt.Clear();
     bodytxt.Clear();
     Filettxt.Clear();
 }
예제 #5
0
 private void Refresh()
 {
     TeacherRegtxt.Clear();
     Nametxt.Clear();
     Surnametext.Clear();
     GenderCmb.ResetText();
     Celltxt.Clear();
     PINTxt.Clear();
     Emailtxt.Clear();
     Statuscmb.ResetText();
     dataGridView1.DataSource = DataAccess.GetTeachers();
 }
예제 #6
0
        private void label6_Click(object sender, EventArgs e)

        {
            try
            {
                Admins admin = new Admins(LoginTxt.Text, PassTxt.Text, FIOTxt.Text, OrTXT.Text, Emailtxt.Text);
                admins.Add(admin);
                XmlSerializer serializer = new XmlSerializer(typeof(List <Admins>));

                StreamWriter writer = new StreamWriter(pathAdmin);
                serializer.Serialize(writer, admins);
                writer.Close();
                LoginTxt.Clear();
                PassTxt.Clear();
                FIOTxt.Clear();
                OrTXT.Clear();
                Emailtxt.Clear();
                MessageBox.Show("Вы зарегистрированы");
                panelReg.Visible = false;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }