Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(Nametxt.Text.ToString()) || string.IsNullOrEmpty(Nametxt.Text.ToString()))
     {
         MessageBox.Show("It Isn't vaild !!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         string FileName  = Nametxt.Text.ToString();
         string number    = Numattr.Text.ToString();
         string FileNameD = FileName;
         FileName  += ".txt";
         FileNameD += "D.txt";
         FileStream   Data  = new FileStream(FileNameD, FileMode.Create);
         FileStream   Files = new FileStream("FilesName.txt", FileMode.Append);
         StreamWriter sw    = new StreamWriter(Data);
         StreamWriter sw1   = new StreamWriter(Files);
         sw.WriteLine(FileName);
         sw.WriteLine(number);
         sw1.WriteLine(FileNameD);
         sw.Close();
         sw1.Close();
         Nametxt.Clear();
         Numattr.Clear();
         this.Close();
         th = new Thread(opennewform);
         th.SetApartmentState(ApartmentState.STA);
         th.Start();
     }
 }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
 private void resetbutton_Click(object sender, EventArgs e)
 {
     IDtxt.Clear();
     Nametxt.Clear();
     DiaChitxt.Clear();
     Emailtxt.Clear();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 6
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try {
                if (kashf_rdiobtn.Checked)
                {
                    visit_type = "كشف";
                }
                else
                {
                    visit_type = "استشارة";
                }

                BL.SelectData sel = new BL.SelectData();
                DataTable     dt  = new DataTable();
                //dtp = selpat.get_Patientss();
                //if (dtp.Rows.Count < 50)
                //{

                BL.InsertData insert_patientdata = new BL.InsertData();
                dt = sel.get_Patientss();
                DataRow dr = dt.Rows[0];

                if (Idtxt.Text == dr["patientID"].ToString())
                {
                    insert_patientdata.register_isteshara(Convert.ToInt32(Idtxt.Text), dateTimePicker1.Value.Date, visit_type);
                    MessageBox.Show("add successfuly");
                }
                else
                {
                    insert_patientdata.add_patient(
                        Convert.ToInt32(Idtxt.Text),
                        Nametxt.Text,
                        Convert.ToInt32(Agetxt.Text),
                        gendercompobox.SelectedItem.ToString(),
                        phonenum.Text,
                        emailtxt.Text,
                        dateTimePicker1.Value.Date,
                        visit_type,
                        Convert.ToInt32(reversnum.Value.ToString()),
                        Convert.ToDecimal(costtxt.Text)

                        );


                    MessageBox.Show("add successfuly");
                    //////////////////////////////////////////////////////
                    Idtxt.Clear();
                    Nametxt.Clear();
                    Agetxt.Clear();
                    phonenum.Clear();
                    emailtxt.Clear();
                }
                //    costtxt.Clear();
                //}

                //else
                //    MessageBox.Show("error =D");
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }