private bool Create() { using (MyAcademyEntities db = new MyAcademyEntities()) { Classroom Newdata = new Classroom(); if (GoCheck.IsEmpityOrMaxChar(textBoxName.Text) && GoCheck.IsStringValue(textBoxName.Text)) { Newdata.Name_room = GoCheck.ClearValue; } else { return(false); } if (GoCheck.isInt(textBoxCapacity.Text)) { Newdata.Capacity = Convert.ToInt32(GoCheck.ClearValue); Newdata.Status_room = true; } else { return(false); } db.Classrooms.Add(Newdata); return(GoCheck.isSave(db.SaveChanges())); } }
private bool UpdateData() { using (MyAcademyEntities db = new MyAcademyEntities()) { Classroom UpdatedData = db.Classrooms.Where(x => x.ID_room == SelectedID).FirstOrDefault(); if (GoCheck.IsEmpityOrMaxChar(textBoxName.Text) && GoCheck.IsStringValue(textBoxName.Text)) { UpdatedData.Name_room = GoCheck.ClearValue; } else { return(false); } if (GoCheck.isInt(textBoxCapacity.Text)) { UpdatedData.Capacity = Convert.ToInt32(GoCheck.ClearValue); } else { return(false); } return(GoCheck.isSave(db.SaveChanges())); } }
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()) { Models.Task UpdatedData = db.Tasks.Where(x => x.ID_task == SelectedID).FirstOrDefault(); if (GoCheck.IsEmpityOrMaxChar(textBoxName.Text) && GoCheck.IsStringValue(textBoxName.Text)) { UpdatedData.Name_task = GoCheck.ClearValue; } else { return(false); } if (GoCheck.isDate(dateTimeDeadline.Value)) { UpdatedData.DeadLine = dateTimeDeadline.Value; } else { return(false); } return(GoCheck.isSave(db.SaveChanges())); } }
private bool Create() { using (MyAcademyEntities db = new MyAcademyEntities()) { Models.Task Newdata = new Models.Task(); if (GoCheck.IsEmpityOrMaxChar(textBoxName.Text) && GoCheck.IsStringValue(textBoxName.Text)) { Newdata.Name_task = GoCheck.ClearValue; } else { return(false); } if (GoCheck.isDate(dateTimeDeadline.Value)) { Newdata.DeadLine = dateTimeDeadline.Value; Newdata.Status_task = true; } else { return(false); } db.Tasks.Add(Newdata); return(GoCheck.isSave(db.SaveChanges())); } }
private bool UpdateData() { using (MyAcademyEntities db = new MyAcademyEntities()) { Group UpdatedData = db.Groups.Where(x => x.ID_group == SelectedID).FirstOrDefault(); if (GoCheck.IsEmpityOrMaxChar(textBoxName.Text) && GoCheck.IsStringValue(textBoxName.Text)) { UpdatedData.Name_group = GoCheck.ClearValue; } else { return(false); } if (!(comboBoxClass.SelectedItem == null)) { UpdatedData.ClassroomID = db.Classrooms.Where(x => x.Status_room == true).ToList()[comboBoxClass.SelectedIndex].ID_room; } else { MessageBox.Show("Otaq seçin", "Diqqət!"); return(false); } if (!(comboBoxEdu.SelectedItem == null)) { UpdatedData.EducationID = db.Education_Program.Where(x => x.Status_edu == true).ToList()[comboBoxEdu.SelectedIndex].ID_edu; UpdatedData.Status_group = true; } else { MessageBox.Show("Təhsil seçin", "Diqqət!"); return(false); } return(GoCheck.isSave(db.SaveChanges())); } }
private bool UpdateData() { using (MyAcademyEntities db = new MyAcademyEntities()) { Position UpdatedData = db.Positions.Where(x => x.ID_pos == SelectedID).FirstOrDefault(); if (GoCheck.IsEmpityOrMaxChar(textBoxPositionName.Text) && GoCheck.IsStringValue(textBoxPositionName.Text)) { UpdatedData.Name_pos = GoCheck.ClearValue; } else { return(false); } return(GoCheck.isSave(db.SaveChanges())); } }
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 Delete() { using (MyAcademyEntities db = new MyAcademyEntities()) { Classroom DeletedData = db.Classrooms.Where(x => x.ID_room == SelectedID).FirstOrDefault(); string Dialog = "Seçilmiş " + DeletedData.Name_room + " otağını silmək istəyirsiniz?"; DialogResult result = MessageBox.Show(Dialog, "Silmək Sorğusu!", MessageBoxButtons.YesNo); if (DialogResult.Yes != result) { MessageBox.Show("Seçilmiş " + DeletedData.Name_room + " otağı Silinmədi.", "Silmək Sorğusuna cavab"); return(false); } else { DeletedData.Status_room = false; return(GoCheck.isDeleted(db.SaveChanges())); } } }
private bool Create() { using (MyAcademyEntities db = new MyAcademyEntities()) { Position Newdata = new Position(); if (GoCheck.IsEmpityOrMaxChar(textBoxPositionName.Text) && GoCheck.IsStringValue(textBoxPositionName.Text)) { Newdata.Name_pos = GoCheck.ClearValue; Newdata.Status_pos = true; } else { return(false); } db.Positions.Add(Newdata); 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())); } }