private bool Create() { using (MyAcademyEntities db = new MyAcademyEntities()) { Education_Program Newdata = new Education_Program(); if (GoCheck.IsEmpityOrMaxChar(textBoxName.Text) && GoCheck.IsStringValue(textBoxName.Text)) { Newdata.Name_edu = GoCheck.ClearValue; } else { return(false); } if (GoCheck.isPrice(textBoxPrice.Text)) { Newdata.Price = Convert.ToDecimal(GoCheck.ClearValue); Newdata.Status_edu = true; } else { return(false); } db.Education_Program.Add(Newdata); return(GoCheck.isSave(db.SaveChanges())); } }
private bool UpdateData() { using (MyAcademyEntities db = new MyAcademyEntities()) { Education_Program UpdatedData = db.Education_Program.Where(x => x.ID_edu == SelectedID).FirstOrDefault(); if (GoCheck.IsEmpityOrMaxChar(textBoxName.Text) && GoCheck.IsStringValue(textBoxName.Text)) { UpdatedData.Name_edu = GoCheck.ClearValue; } else { return(false); } if (GoCheck.isPrice(textBoxPrice.Text)) { UpdatedData.Price = Convert.ToDecimal(GoCheck.ClearValue); } else { return(false); } 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())); } }