public bool Add(Student student) { var department = departmentDal.GetById(student.DepartmentId); student.RegistrationNumber = department.DepartmentCode + "-" + student.RegData.Year + "-" + RegNumber(student.DepartmentId).ToString().PadLeft(3, '0'); bool isSavedS = studentDAL.Add(student); return(isSavedS); }
private void RegisterBtn_Click(object sender, EventArgs e) { int adID = 1; Admin ad = AdminDAL.GetById(adID); Department dept = new Department(depts[departmentsCombo.SelectedIndex].Id, depts[departmentsCombo.SelectedIndex].Name); StudentDAL.Add(userNameRegTextBox.Text, NameRegTextBox.Text, int.Parse(AgeTextBox.Text), AddressTextBox.Text, PhoneTextBox.Text, EmailTextBox.Text, false, ad.Id, dept.Id, PassRegTextBox.Text); }
public bool Add(Student s) { if (studentDAL.Add(s)) { return(true); } else { return(false); } }
private void setInstructorBtn_Click(object sender, EventArgs e) { Admin adm = MyAdmin.Admin; //Student stu = new Student(students[studentsComboBox.SelectedIndex].Id, students[studentsComboBox.SelectedIndex].Name); student = StudentDAL.GetById(students[studentsComboBox.SelectedIndex].Id); //student.Id = students[studentsComboBox.SelectedIndex].Id; bool isInst = StudentDAL.SetInstructor(student); int res = StudentDAL.Add(student.UserName, student.Name, student.Age, student.Address, student.Phone, student.Email, isInst, student.Admin.Id, student.Department.Id, student.Password); if (res != 0) { StudentDAL.DeleteById(student.Id); } }
public string Add(Student entity) { try { string controlText = IsStudentComplete(entity); if (controlText != "") { return(controlText); } return(studentDAL.Add(entity)); } catch (Exception ex) { return(ex.Message); } }
public ActionResult CreateStudent(StudentCreate student) { var sha1 = new SHA1CryptoServiceProvider(); var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes("p@55Student")); string hashedPassword = BitConverter.ToString(hash).Replace("-", string.Empty).ToLower(); student.Password = hashedPassword; System.Diagnostics.Debug.WriteLine(ModelState.IsValid); ViewData["CourseSelect"] = GetCourse(); ViewData["LecturerSelect"] = GetLecturer(); if (ModelState.IsValid) { ViewData["Message"] = "Student profile Created Successfully!"; student.StudentID = studentContext.Add(student); return(View()); } else { return(View(student)); } }
public static bool Add(Student a) { //StudentDal.AddToAdmin(a); return(StudentDAL.Add(a)); }
public static bool Add(Student a) { return(StudentDAL.Add(a)); }
public void Add(Student entity) { StudentDAL dalObject = new StudentDAL(); dalObject.Add(entity); }