Exemplo n.º 1
0
        public bool CreateAcademyInfo()
        {
            using (MyAcademyEntities db = new MyAcademyEntities())
            {
                Academy_info Ai = new Academy_info();

                if (GoCheck.IsEmpityOrMaxChar(textBoxAcademyName.Text) && GoCheck.IsStringValue(textBoxAcademyName.Text))
                {
                    Ai.Name_academy = textBoxAcademyName.Text;
                }
                else
                {
                    return(false);
                }
                if (GoCheck.IsEmpityOrMaxChar(textBoxAcademyPhone.Text) && GoCheck.IsPhoneValue(textBoxAcademyPhone.Text))
                {
                    Ai.phone_academy = textBoxAcademyPhone.Text;
                }
                else
                {
                    return(false);
                }
                if (GoCheck.IsEmpityOrMaxChar(textBoxAcademyEmail.Text) && GoCheck.IsEmailValue(textBoxAcademyEmail.Text))
                {
                    Ai.email_academy = textBoxAcademyEmail.Text;
                }
                else
                {
                    return(false);
                }
                if (GoCheck.IsEmpityOrMaxChar(textBoxAcademyAdress.Text, 150))
                {
                    Ai.Adress_academy = textBoxAcademyAdress.Text;
                    Ai.Status_academy = true;
                }
                else
                {
                    return(false);
                }

                db.Academy_info.Add(Ai);
                return(GoCheck.isSave(db.SaveChanges()));
            }
        }
 private bool UpdateData()
 {
     using (MyAcademyEntities db = new MyAcademyEntities())
     {
         Employee UpdatedData = db.Employees.Where(x => x.ID_emp == SelectedID).FirstOrDefault();
         if (GoCheck.IsEmpityOrMaxChar(textBoxName.Text) && GoCheck.IsStringValue(textBoxName.Text))
         {
             UpdatedData.Name_emp = GoCheck.ClearValue;
         }
         else
         {
             return(false);
         }
         if (GoCheck.IsEmpityOrMaxChar(textBoxSurname.Text) && GoCheck.IsStringValue(textBoxSurname.Text))
         {
             UpdatedData.Surname_emp = GoCheck.ClearValue;
         }
         else
         {
             return(false);
         }
         if (GoCheck.IsPhoneValue(textBoxPhone.Text))
         {
             UpdatedData.Phone_emp = GoCheck.ClearValue;
         }
         else
         {
             return(false);
         }
         if (GoCheck.IsEmailValue(textBoxEmail.Text))
         {
             UpdatedData.Email_emp = GoCheck.ClearValue;
         }
         else
         {
             return(false);
         }
         if (!(comboBoxPosition.SelectedItem == null))
         {
             UpdatedData.PositionID = db.Positions.Where(x => x.Status_pos == true).ToList()[comboBoxPosition.SelectedIndex].ID_pos;
         }
         else
         {
             MessageBox.Show("Vəzifə seçin", "Diqqət!");
             return(false);
         }
         if (GoCheck.isPrice(textBoxSalary.Text))
         {
             UpdatedData.Salary     = Convert.ToDecimal(GoCheck.ClearValue);
             UpdatedData.StartTime  = dateTimeStartTime.Value;
             UpdatedData.Status_emp = true;
         }
         else
         {
             return(false);
         }
         if (GoCheck.IsEmpityOrMaxChar(textBoxSpeciality.Text) && GoCheck.IsStringValue(textBoxSpeciality.Text))
         {
             UpdatedData.Speciality_emp = GoCheck.ClearValue;
         }
         else
         {
             return(false);
         }
         return(GoCheck.isSave(db.SaveChanges()));
     }
 }