public ActionResult Division() { ViewBag.SchoolId = 1; ClassRoomDto c = new ClassRoomDto(); return(View(c)); }
public static void AddIfNotExists(ClassRoomDto classRoom) { var isExist = IsClassromExists(classRoom.Number); if (isExist) { return; } using (OleDbCommand oleDbCommand = new OleDbCommand()) { // Set the command object properties oleDbCommand.Connection = new OleDbConnection(ConnectionConfig.ConnectionString); oleDbCommand.CommandType = CommandType.Text; oleDbCommand.CommandText = insertClassroom; // Add the input parameters to the parameter collection oleDbCommand.Parameters.AddWithValue("@Number", classRoom.Number); oleDbCommand.Parameters.AddWithValue("@Building", GetBuilding(classRoom.Number)); // Open the connection, execute the query and close the connection oleDbCommand.Connection.Open(); oleDbCommand.ExecuteNonQuery(); oleDbCommand.Connection.Close(); } }
public async Task <bool> UpdateClassRoom(ClassRoomDto classRoomDto) { var classRoom = Mapper.Map <IClassRoomDto, ClassRoom>(classRoomDto); UnitOfWork.Repo.Update(classRoom); return(await UnitOfWork.SaveChanges() > 0); }
public MessageDTO addUpdateStandrdDivision(ClassRoomDto classRoomDetail) { ClassRoom classR = Mapper.Map <ClassRoomDto, ClassRoom>(classRoomDetail); Message msg = _class.createUpdateDivision(classR); var result = Mapper.Map <Message, MessageDTO>(msg); return(result); }
public ActionResult SubmitDivision(ClassRoomDto divisions) { MessageDTO message = new MessageDTO(); WCFProxy.Using((delegate(IClassSetupService client) { message = client.addUpdateStandrdDivision(divisions); })); return(Json(message.message, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> Edit(ClassRoomDto parameter) { if (ModelState.IsValid) { var isUpdated = await _classRoomBusiness.UpdateClassRoom(parameter); if (isUpdated) { return(RedirectToAction("Index")); } } return(View(parameter)); }
public async Task <IActionResult> UpdateClassRoom(ClassRoomDto parameter) { if (ModelState.IsValid) { var isUpdated = await _classRoomBusiness.UpdateClassRoom(parameter); if (isUpdated) { return(Ok("Updated Successfully")); } } return(BadRequest(ModelState)); }
/// <summary> /// Update classroom data /// </summary> /// <param name="classRoomId"></param> /// <param name="classRoom"></param> /// <returns></returns> public ClassRoomDto UpdateClassRoom(int classRoomId, ClassRoomDto classRoom) { logger.Trace("Service received a request to update classroom Id {classRoomId} with data {classRoomData}", classRoomId, classRoom); ClassRoom updatedClassRoom = db.ClassRoomsRepository.GetByID(classRoomId); if (updatedClassRoom == null) { return(null); } updatedClassRoom.ClassGrade = classRoom.SchoolGrade; updatedClassRoom.Name = classRoom.Name; db.ClassRoomsRepository.Update(updatedClassRoom); db.Save(); return(ClassRoomConverter.ClassRoomToClassRoomDto(updatedClassRoom)); }
/// <summary> /// Create classroom /// </summary> /// <param name="classRoom"></param> /// <returns></returns> public ClassRoomDto CreateClassRoom(ClassRoomRegistrationDto classRoom) { logger.Trace("Service received classroom creation request {classRoomData}", classRoom); ClassRoom newClassRoom = new ClassRoom() { Name = classRoom.Name, ClassGrade = classRoom.SchoolGrade }; db.ClassRoomsRepository.Insert(newClassRoom); db.Save(); ClassRoomDto dto = new ClassRoomDto() { ClassRoomId = newClassRoom.Id, Name = newClassRoom.Name, SchoolGrade = newClassRoom.ClassGrade }; return(dto); }
private static void AppendNewScheduleRecord(DayDto dayDto, string time, Row row) { try { string subject = row[2].Value.ToString(); TeacherDto teacher = GetTeacherData(row[3].Value.ToString()); ClassRoomDto classRoom = new ClassRoomDto { Number = row[6].Value.ToString().Replace(" ", String.Empty) }; var weeksString = row[5].Value.ToString(); if (string.IsNullOrEmpty(teacher.LastName)) { teacher.LastName = "Вакансія"; // in case of null } var groupStr = row[4].Value.ToString(); //either number or 'lecture' if (string.IsNullOrEmpty(subject) || subject.Length <= 2) { return; } if (string.IsNullOrEmpty(classRoom.Number) || string.IsNullOrEmpty(weeksString) || string.IsNullOrEmpty(groupStr)) { throw new InvalidInputException("Некоректні дані: " + dayDto.DayName + ", " + time + " у файлі " + _currentFilePath); } LessonTimeDto lessonTime = new LessonTimeDto { Number = LessonTimeDto.GetNumberFromPeriod(time) }; string group = string.Empty; if (groupStr.Any(char.IsDigit)) { group = groupStr.Replace(" ", ""); } else { group = string.Empty; } LessonTypeDto lessonType = new LessonTypeDto(); lessonType.Id = LessonTypeDto.GetIdByType(group == string.Empty ? LessonType.Лекція : LessonType.Практика); ScheduleRecordDto scheduleRecord = new ScheduleRecordDto { YearOfStudying = _yearOfStudying, LessonTime = lessonTime, Subject = subject, LessonType = lessonType, Group = group, Day = dayDto, Specialty = _specialty, ClassRoom = classRoom, Teacher = teacher, Weeks = weeksString }; var weeksStr = row[5].Value.ToString().Replace(".", ","); //replace 6.9 to 6,9 var weeksList = Utils.Utils.ParseWeeks(weeksStr); _weekScheduleRecords.Add(scheduleRecord, new List <int>()); foreach (var weekNumber in weeksList) { _weekScheduleRecords[scheduleRecord].Add(weekNumber); } } catch (InvalidInputException e) { Logger.LogException(e); throw e; } catch (Exception e) { Logger.LogException(e); } }
public ClassRoomDto UpdateClassRoom(int classRoomId, ClassRoomDto classRoom) { throw new NotImplementedException(); }