private void Button3_Click(object sender, EventArgs e)
 {
     using (AcademyEntities db = new AcademyEntities())
     {
         teacherUpdated.Status = false;
         var entry = db.Entry(teacherUpdated);
         entry.State = EntityState.Modified;
         db.SaveChanges();
     }
     ResetTxt();
     FillTeacher();
     MessageBox.Show("Emeliyyat ugurla yerine yetirildi." + teacherUpdated.Name + " " + teacherUpdated.Surname + " statusu deaktiv edildi.");
 }
Beispiel #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            using (AcademyEntities db = new AcademyEntities())
            {
                decimal mark = Convert.ToDecimal(textBox1.Text);

                GroupTask groupTask = db.GroupTasks.Where(g => g.TaskId == task.Id && g.StudentId == selectedStudent).FirstOrDefault();
                groupTask.Mark = mark;
                var entry = db.Entry(groupTask);
                entry.State = EntityState.Modified;
                db.SaveChanges();
            }
            textBox1.Text = "";
            FillStudent();
        }
        private void Button2_Click(object sender, EventArgs e)
        {
            string Name        = txtName.Text;
            string Surname     = txtSurname.Text;
            string Email       = txtEmail.Text;
            string Phone       = txtPhone.Text;
            string letters     = @"^[a-zA-Z]+$";
            string emailreg    = @"((([\-\w]+\.)+[a-zA-Z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$";
            string phonereg    = @"^(?<countryCode>[\+][1-9]{1}[0-9]{0,2}\s)?(?<areaCode>0?[1-9]\d{0,4})(?<number>\s[1-9][\d]{5,12})(?<extension>\sx\d{0,4})?$";
            Match  result      = Regex.Match(Name, letters);
            Match  surnameMath = Regex.Match(Surname, letters);
            Match  emailMatch  = Regex.Match(Email, emailreg);
            Match  phoneMatch  = Regex.Match(Phone, phonereg);

            if (!result.Success)
            {
                MessageBox.Show("Adi duzgun daxil edin.");
            }
            if (!surnameMath.Success)
            {
                MessageBox.Show("Soyadi duzgun daxil edin.");
            }
            if (!emailMatch.Success)
            {
                MessageBox.Show("Emaili duzgun daxil edin.");
            }
            if (!phoneMatch.Success)
            {
                MessageBox.Show("Nomreni duzgun daxil edin.");
            }
            else
            {
                using (AcademyEntities db = new AcademyEntities())
                {
                    teacherUpdated.Name       = txtName.Text;
                    teacherUpdated.Surname    = txtSurname.Text;
                    teacherUpdated.Email      = txtEmail.Text;
                    teacherUpdated.Phone      = txtPhone.Text;
                    teacherUpdated.Speciality = comSpeciality.Text;
                    var entry = db.Entry(teacherUpdated);
                    entry.State = EntityState.Modified;
                    db.SaveChanges();
                }
                ResetTxt();
                FillTeacher();
                MessageBox.Show("Emeliyyat ugurla yerine yetirildi.");
            }
        }