public ActionResult AddStudent(StudentView ViewStudent) { string strSQL; DBmanager db = new DBmanager(); bool booRet; DataTable dt = new DataTable(); strSQL = " Select * from GUI_Subject "; strSQL += " Where SubjectName = " + db.SQL_SetString(ViewStudent.View_Subject.SubjectName); booRet = db.SQL_Query(strSQL, ref dt); if (booRet == false) { log = "stop"; } ViewStudent.View_Students.SubjectCode = dt.Rows[0].Field <string>("SubjectCode"); booRet = db.SQL_ExeGui_Student(ViewStudent.View_Students); if (booRet == false) { log = "stop"; } return(RedirectToAction("Index")); }
//public List<StudentView> ShowAllStudent() //{ // string query = "SELECT DepartmentName,StudentName,StudentTB.Id AS StudentId,Email,RegistrationNo FROM StudentTB INNER JOIN DepartmentTB ON StudentTB.DepartmentId = DepartmentTB.Id"; // Command = new SqlCommand(query, Connection); // Connection.Open(); // Reader = Command.ExecuteReader(); // List<StudentView> studentViews = new List<StudentView>(); // while (Reader.Read()) // { // StudentView studentView = new StudentView(); // studentView.StudentId = Convert.ToInt32(Reader["StudentId"]); // studentView.DepartmentName = Reader["DepartmentName"].ToString(); // studentView.RegistrationNo = Reader["RegistrationNo"].ToString(); // studentView.Email = Reader["Email"].ToString(); // studentView.StudentName = Reader["StudentName"].ToString(); // studentViews.Add(studentView); // } // Connection.Close(); // return studentViews; //} public List <StudentView> GetStudentById(int StudentId) { string query = "SELECT CourseTB.Id AS CourseId ,CourseTB.CourseName,StudentTB.DepartmentId,DepartmentTB.DepartmentName,StudentName,StudentTB.Id AS StudentId,Email FROM DepartmentTB INNER JOIN CourseTB ON CourseTB.DepartmentId = DepartmentTB.Id INNER JOIN StudentTB ON StudentTB.DepartmentId = DepartmentTB.Id WHERE StudentTB.Id = " + StudentId; Command = new SqlCommand(query, Connection); Connection.Open(); Reader = Command.ExecuteReader(); List <StudentView> studentViews = new List <StudentView>(); while (Reader.Read()) { StudentView studentView = new StudentView(); studentView.StudentId = Convert.ToInt32(Reader["StudentId"]); studentView.DepartmentName = Reader["DepartmentName"].ToString(); studentView.Email = Reader["Email"].ToString(); studentView.StudentName = Reader["StudentName"].ToString(); studentView.CourseName = Reader["CourseName"].ToString(); studentView.CourseId = Convert.ToInt32(Reader["CourseId"]); studentViews.Add(studentView); } Connection.Close(); return(studentViews); }
private void BtnOpenStudentView(object sender, RoutedEventArgs e) { StudentView view = new StudentView(); view.Closing += StudentView_Closing; view.ShowDialog(); }
public List <StudentView> GetStudents() { SqlConnection con = new SqlConnection(ConnectinString); con.Open(); string query = "select * from StudentWithDepartmentView"; SqlCommand cmd = new SqlCommand(query, con); SqlDataReader reader = cmd.ExecuteReader(); List <StudentView> Students = new List <StudentView>(); while (reader.Read()) { StudentView student = new StudentView(); student.Email = reader["Eamil"].ToString(); student.Name = reader["Name"].ToString(); student.RegNo = reader["RegisterNo"].ToString(); student.DepartmentName = reader["Department"].ToString(); student.DepartmentId = (int)reader["DepartmentId"]; student.Id = (int)reader["Id"]; Students.Add(student); } reader.Close(); con.Close(); return(Students); }
public static R GetView <T, R>(this T entity) where T : class, IEntity where R : class, IEntity { switch (entity) { case Student student: { var result = new StudentView { Id = student.Id, FirstName = student.FirstName, LastName = student.LastName, MiddleName = student.MiddleName }; return((R)(object)result); } case Group group: { var result = new GroupView { Id = group.Id, Photo = group.Photo, Name = group.Name, Students = group.Students.Count() }; return((R)(object)result); } } return(null); }
public async Task <ActionResult> Student(string id) { if (!Session["user_type"].Equals("ADM")) { return(RedirectToAction("../Home/Index")); } StudentView StudentInfo = new StudentView(); using (var client = new HttpClient()) { //Passing service base url client.BaseAddress = new Uri(Baseurl); client.DefaultRequestHeaders.Clear(); //Define request data format client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //Sending request to find web api REST service resource GetAllEmployees using HttpClient HttpResponseMessage Res = await client.GetAsync("api/adminAPI/Student?studentid=" + id); //Checking the response is successful or not which is sent using HttpClient if (Res.IsSuccessStatusCode) { //Storing the response details recieved from web api var StudentResponse = Res.Content.ReadAsStringAsync().Result; //Deserializing the response recieved from web api and storing into the Employee list StudentInfo = JsonConvert.DeserializeObject <StudentView>(StudentResponse); } ViewBag.Roles = db.RoleLists; //returning the employee list to view return(View(StudentInfo)); } }
static void Main(string[] args) { Student student = RetrieveStudentFromDataBase(); IStudentView studentView = new StudentView(); StudentController studentController = new StudentController(student, studentView); studentController.UpdateView(); Console.WriteLine("\nPresiona una tecla para continuar\n"); Console.ReadKey(); studentController.SetStudentView(new StudentGridView()); studentController.UpdateView(); Console.WriteLine("\nPresiona una tecla para continuar\n"); Console.ReadKey(); Student studentFile = RetrieveStudentFromFile(); studentController.SetStudentModel(studentFile); studentController.UpdateView(); Console.WriteLine("\nPresiona una tecla para continuar\n"); Console.ReadKey(); }
public StudentController(Timer timer, InputFilter inputFilter, InputBox inputBox, OutputBox outputBox, StudentView studentView, Input input, InputBoxController inputBoxController, OutputBoxController outputBoxController, BorderController borderController, User user, QueryCreator queryCreator, StudentDBController studentDBController ) { this.timer = timer; this.inputFilter = inputFilter; this.queryCreator = queryCreator; this.inputBox = inputBox; this.outputBox = outputBox; this.student = new Student(user.Password, user.Username, user.LetterID, user.FirstName, user.LastName, user.FieldID, user.Subject); this.studentView = studentView; this.input = input; this.inputBoxController = inputBoxController; this.outputBoxController = outputBoxController; this.borderController = borderController; this.studentDBController = studentDBController; timer.Tick += this.borderController.BordarChange; timer.Tick += KeyActive; }
public ActionResult SelectedStudentInfo(int id) { List <StudentView> student = astudentBll.GetStudents(); StudentView selectedStudent = student.SingleOrDefault(a => a.Id == id); return(Json(selectedStudent, JsonRequestBehavior.AllowGet)); }
public ActionResult NewSelection(StudentView studentView) { studentView = Session["selectionView"] as StudentView; var student = db.Students.Find(studentView.Student.StudentID); //foreach (var item in studentView.Subjects) //{ // var subject = db.Subjects.Find(item.SubjectID); // subject.Students.Add(student); // db.SaveChanges(); //} foreach (var item in studentView.Subjects) { var subject = db.Subjects.Find(item.SubjectID); student.Subjects.Add(subject); db.SaveChanges(); } studentView.Student = new Student(); studentView.Subjects = new List <Subject>(); return(View(studentView)); }
public ActionResult Create(StudentView studentView) { try { if (ModelState.IsValid) { var student = new Student() { StudentId = studentView.StudentId, FirstName = studentView.FirstName, LastName = studentView.LastName, EnrollmentDate = studentView.EnrollmentDate }; if (objStudent.Create(student)) { return(RedirectToAction("Index")); } else { ViewBag.Error = "Ocurrio un error al guardar el estudiante"; return(View(studentView)); } } else { return(View(studentView)); } } catch { return(View()); } }
private void LoadStudentList() { var students = sRepo.all() .OrderBy(s => s.f) .ThenBy(s => s.i) .ThenBy(s => s.o) .ToList(); var stView = StudentView.StudentsToView(students); StudentGrid.DataSource = stView; StudentGrid.Columns["id"].Visible = false; StudentGrid.Columns["fio"].Visible = false; StudentGrid.Columns["zach_number"].Visible = false; StudentGrid.Columns["birth_date"].Visible = false; StudentGrid.Columns["address"].Visible = false; StudentGrid.Columns["phone"].Visible = false; StudentGrid.Columns["orders"].Visible = false; StudentGrid.Columns["starosta"].Visible = false; StudentGrid.Columns["n_factor"].Visible = false; StudentGrid.Columns["paid_edu"].Visible = false; StudentGrid.Columns["expelled"].Visible = false; StudentGrid.Columns["summary"].HeaderText = "Студенты"; StudentGrid.Columns["summary"].Width = StudentGrid.Width - 20; }
public void TestStudentView() { var studentView = new StudentView(); var result = studentView.ResponseAsString(MockDAO.SelectForStudentType("Undergraduate"), "Name", "Test"); Assert.IsType <string>(result); }
public async Task <IActionResult> Create([Bind("Id,Std_id,Name,Gender,Date_Birth,Address,Blood_group,Std_image")] StudentView student) { if (ModelState.IsValid) { var existstudent = _context.Student.FirstOrDefault(st => st.Std_id == student.Std_id); if (existstudent != null) { ViewBag.msg = "This student has been already registerd"; return(View(student)); } Student s = new Student(); s.Std_id = student.Std_id; s.Name = student.Name; s.Gender = student.Gender; s.Date_Birth = student.Date_Birth; s.Address = student.Address; s.Blood_group = student.Blood_group; using (var ms = new MemoryStream()) { await student.Std_image.CopyToAsync(ms); s.Std_image = ms.ToArray(); } _context.Student.Add(s); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(student)); }
public MainViewModel() { SchoolSummaryView = new SchoolSummaryView(); ClassView = new ClassView(); TeacherView = new TeacherView(); StudentView = new StudentView(); SchoolSummaryViewModel = (SchoolSummaryViewModel)SchoolSummaryView.DataContext; ClassViewModel = (ClassViewModel)ClassView.DataContext; TeacherViewModel = (TeacherViewModel)TeacherView.DataContext; StudentViewModel = (StudentViewModel)StudentView.DataContext; InitializeCommands(); SchoolSummaryViewModel.MainViewModel = this; ClassViewModel.MainViewModel = this; var dummyData = StudentTestDataUtility.GetDummySchoolData(); ClassBooks = new ObservableCollection <ClassBook>(dummyData.ClassBooks); Teachers = new ObservableCollection <Teacher>(dummyData.Teachers); Students = new ObservableCollection <Student>(dummyData.Students); OnSchoolSummaryView(); }
public async Task CreateStudent(StudentView course) { Student studentDomain = _mapper.Map <Student>(course); await _istudentSql.Add(studentDomain); await _istudentElastic.Add(studentDomain); }
public void BootstrapStudentView(User _user) { this.timer = new Timer(); Input input = new Input(); User user = _user; OutputBox outputBox = new OutputBox(new Point(1, 1), Console.WindowLeft + 70, (int)Math.Floor(Console.WindowHeight / 1.7) + 1); InputBox inputBox = new InputBox(new Point(1, (int)Math.Floor(Console.WindowHeight / 1.4) + 1) , Console.WindowWidth - 8, 4); OutputBoxController outputBoxController = new OutputBoxController(outputBox); InputBoxController inputBoxController = new InputBoxController(inputBox); StudentDBController studentDBController = new StudentDBController(); StudentView studentView = new StudentView(timer, inputBox, outputBox); BorderController borderController = new BorderController(studentView); InputFilter inputFilter = new InputFilter(); QueryCreator queryCreator = new QueryCreator(_user); StudentController studentController = new StudentController(timer, inputFilter, inputBox, outputBox, studentView, input, inputBoxController, outputBoxController, borderController, user, queryCreator, studentDBController ); }
public static R GetViewById <T, R>(this IEnumerable <T> sequence, int id) where T : class, IEntity where R : class, IEntity { switch (sequence) { case IEnumerable <Student> students: { var student = students.FirstOrDefault(s => s.Id == id); var result = new StudentView { Id = student.Id, FirstName = student.FirstName, LastName = student.LastName, MiddleName = student.MiddleName }; return((R)(object)result); } case IEnumerable <Group> groups: { var group = groups.FirstOrDefault(s => s.Id == id); var result = new GroupView { Id = group.Id, Photo = group.Photo, Name = group.Name, Students = group.Students.Count() }; return((R)(object)result); } } return(null); }
public ActionResult Edit(StudentView studentView) { if (!ModelState.IsValid) { return(View(studentView)); } string path = Server.MapPath("~/Content/Images/Students"); string pic = string.Empty; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (studentView.ImageUrl != null) { pic = Path.GetFileName(studentView.ImageUrl.FileName); path = Path.Combine(Server.MapPath("~/Content/Images/Students"), pic); studentView.ImageUrl.SaveAs(path); using (MemoryStream ms = new MemoryStream()) { studentView.ImageUrl.InputStream.CopyTo(ms); byte[] array = ms.GetBuffer(); } } var student = db.Students.Find(studentView.StudentID); student.Address = studentView.Address; student.BirthDate = studentView.BirthDate; student.Email = studentView.Email; student.EndTime = studentView.EndTime; student.EntryDate = studentView.EntryDate; student.FirstName = studentView.FirstName; student.LastName = studentView.LastName; student.Phone = studentView.Phone; student.PositionID = studentView.PositionID; student.Positions = studentView.Positions; student.Remarks = studentView.Remarks; student.StartTime = studentView.StartTime; student.StateID = studentView.StateID; student.State = studentView.State; if (!string.IsNullOrEmpty(pic)) { student.ImageUrl = string.Format("~/Content/Images/Students/{0}", pic); } ViewBag.GenderID = new SelectList(db.Genders, "GenderID", "Description", student.GenderID); ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Description", student.PositionID); ViewBag.StateID = new SelectList(db.States, "StateID", "Description", student.StateID); db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public async ValueTask <StudentView> AddStudentViewAsync(StudentView studentView) { Student student = MapToStudent(studentView); await this.studentService.RegisterStudentAsync(student); return(studentView); }
static void Main(string[] args) { StudentService studentService = new StudentService(); IStudent student = studentService.GetCurrentStudent(); StudentView view = new StudentView(student); view.RenderView(); }
public frmStudent() { InitializeComponent(); using (var scope = Bootstap.Regiter.BeginLifetimeScope()) { studentBussiness = scope.ResolveOptional <IStudentBussiness>(); } studentview = new StudentView(new Student()); }
private StudentView GetDialog() { if (_view == null) { _view = new StudentView(); _view.Closed += view_Closed; } return(_view); }
public ValueTask <StudentView> AddStudentViewAsync(StudentView studentView) => TryCatch(async() => { ValidateStudentView(studentView); Student student = MapToStudent(studentView); await this.studentService.RegisterStudentAsync(student); return(studentView); });
public void Execute(object parameter) { StudentViewModel studentViewModel = new StudentViewModel(); studentViewModel.AllStudents = App.DB.StudentRepository.GetAllData(); StudentView studentView = new StudentView(studentViewModel); studentView.ShowDialog(); }
// Constractor public ASRController() { // Instantiate the ASR_App controller to run this application Data = ASR_DataController.GetStart; factoryMenu = new MenuFactory(); StaffManagement = new StaffView(Data.GetStaffs()); StudentManagement = new StudentView(Data.GetStudents()); MainManagement = new MainView(); }
private void CreateStudentViewModel(object obj) { StudentViewModel studentViewModel = new StudentViewModel(); StudentView studentView = new StudentView(); studentViewModel.View = studentView; studentView.DataContext = studentViewModel; BaseViewModel = studentViewModel; }
public async Task <StudentView> EditStudent(Guid id, StudentView student) { student.StudentID = id; Student studentDomain = _mapper.Map <Student>(student); await _istudentSql.Update(id, _mapper.Map <Student>(studentDomain)); await _istudentElastic.Update(id, studentDomain); return(student); }
// GET: Student public ActionResult Index() { StudentContext studentContext1 = new StudentContext(); StudentView studentView = new StudentView(); studentView.studentList = studentContext1.Students.ToList(); studentView.studentEmailList = studentContext1.Emails.ToList(); return(View(studentView)); }
public static void Main() { var view = new StudentView(); //in web most time it is "index.html" var controller = new StudentController(view); controller.Update(); //usually http event handler var newPerson = new StudentModel(){name="Jan Antoni", surname="Kowalski"}; controller.PostData(newPerson); controller.Update(); }
public ViewNavigation() { studentView = new StudentView(); lecturerView = new LecturerView(); studentsRegisteredTableView = new StudentsRegisteredTableView(); studentsRegisteredViewModel = new StudentsRegisteredTableViewModel(); lecturerRegisteredTableView = new LecturersRegisteredTableView(); lecturerRegisteredTableViewModel = new RegisteredLecturersViewModel(); lecturerViewModel = new LecturerViewModel(); studentViewModel = new StudentViewModel(); }