public async Task SaveAsync(EducationType entity) { try { if (entity == null) { return; } using (var timeLineContext = _contextFactory.GetTimeLineContext()) { var entityModel = await timeLineContext .EducationTypes .FirstOrDefaultAsync(item => item.Id.Equals(entity.Id)); if (entityModel == null) { entityModel = new DA.EducationType(); MapForUpdateentity(entity, entityModel); await timeLineContext.EducationTypes.AddAsync(entityModel); } else { MapForUpdateentity(entity, entityModel); } timeLineContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
protected internal UnitLessonDomain ( long unitLessonId, long lessonId, long locationId, long syllabusId, long userId, int startTime, int endTime, SemesterType semesterType, LessonGroupType groupType, DayOfTheWeekType dayOfTheWeekType, EducationType educationType ) { UnitLessonId = unitLessonId; LessonId = lessonId; LocationId = locationId; SyllabusId = syllabusId; UserId = userId; StarTime = startTime; EndTime = endTime; SemesterType = semesterType; GroupType = groupType; DayOfTheWeekType = dayOfTheWeekType; EducationType = educationType; CreatedDate = DateTime.Now; UpdatedDate = DateTime.Now; }
public static string Description(this EducationType me) { switch (me) { case EducationType.BasicSecondary: return("базова загальна середня"); case EducationType.CompleteSecondary: return("повна загальна середня"); case EducationType.Vocational: return("професійно-технічна"); case EducationType.Undergraduate: return("неповна вища"); case EducationType.BasicHigher: return("базова вища"); case EducationType.CompleteHigher: return("повна вища"); default: return(""); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] EducationType educationType) { if (id != educationType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(educationType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EducationTypeExists(educationType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(educationType)); }
public List <EducationType> GetAll() { EducationTypeDAC _educationTypeComponent = new EducationTypeDAC(); IDataReader reader = _educationTypeComponent.GetAllEducationType().CreateDataReader(); List <EducationType> _educationTypeList = new List <EducationType>(); while (reader.Read()) { if (_educationTypeList == null) { _educationTypeList = new List <EducationType>(); } EducationType _educationType = new EducationType(); if (reader["EducationTypeId"] != DBNull.Value) { _educationType.EducationTypeId = Convert.ToInt32(reader["EducationTypeId"]); } if (reader["EducationTypeName"] != DBNull.Value) { _educationType.EducationTypeName = Convert.ToString(reader["EducationTypeName"]); } _educationType.NewRecord = false; _educationTypeList.Add(_educationType); } reader.Close(); return(_educationTypeList); }
public override int GetHashCode() { //int hashDeliveryName = DeliveryName == null ? 0 : DeliveryName.GetHashCode(); int hashRorVenueCode = EducationType == null ? 0 : EducationType.GetHashCode(); //return hashDeliveryName ^ hashRorVenueCode; return(hashRorVenueCode); }
public async Task <ActionResult> DeleteConfirmed(int id) { EducationType educationType = await _educationTypeService.GetByIdAsync(Convert.ToInt32(id)); await _educationTypeService.DeleteAsync(educationType); _educationTypeService.UnitOfWorkSaveChanges(); return(RedirectToAction("Index")); }
public static Db.EducationType ToEntity(EducationType educationType) { return educationType == null ? null : new Db.EducationType { EducationTypeId = educationType.EducationTypeId, EducationTypeName = educationType.EducationTypeName }; }
public string Description_properDescription(EducationType educationType) { //Arrange //Act return(educationType.Description()); //Assert }
public async Task <ActionResult> DeleteConfirmed(Guid id) { EducationType educationType = await db.EducationType.FindAsync(id); db.EducationType.Remove(educationType); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public Person(string nm, string snm, DateTime dob, EducationType education, string profession, double zp) { this.name = nm; this.surname = snm; this.dob = dob; this.education = education; this.profession = profession; this.zp = zp; }
public Person() { name = ""; surname = ""; dob = DateTime.Parse("27.01.1985"); //day = ""; education = EducationType.bakalawr; profession = ""; zp = 0; }
public ActionResult Edit([Bind(Include = "Id,Name")] EducationType educationType) { if (ModelState.IsValid) { db.Entry(educationType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(educationType)); }
public IHttpActionResult GetConferenceMember(EducationType education) { var conferenceMembers = db.ConferenceMembers.Where(x => x.Education == education); if (!conferenceMembers.Any()) { return(NotFound()); } return(Ok(conferenceMembers.ToList())); }
public async Task <ActionResult> Edit([Bind(Include = "ID,Name,DateTime,IsDeleted")] EducationType educationType) { if (ModelState.IsValid) { db.Entry(educationType).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(educationType)); }
public ActionResult Create([Bind(Include = "Id,Name")] EducationType educationType) { if (ModelState.IsValid) { db.EducationTypes.Add(educationType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(educationType)); }
public async Task <IActionResult> Create([Bind("Id,Name")] EducationType educationType) { if (ModelState.IsValid) { _context.Add(educationType); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(educationType)); }
public TimesAndDays(EducationType educationType) { if (educationType == EducationType.IOgretim) { TimeAndDayCreator(9, 15); } else { TimeAndDayCreator(15, 23); } }
public bool Insert(EducationType educationtype) { int autonumber = 0; EducationTypeDAC educationtypeComponent = new EducationTypeDAC(); bool endedSuccessfuly = educationtypeComponent.InsertNewEducationType(ref autonumber, educationtype.EducationTypeName); if (endedSuccessfuly) { educationtype.EducationTypeId = autonumber; } return(endedSuccessfuly); }
public void ShouldTransformEducationTypeToEntity() { var param = new EducationType { EducationTypeId = 1, EducationTypeName = "Grade School", }; var result = EducationTypeMapper.ToEntity(param); Assert.IsInstanceOf(typeof(Db.EducationType), result); Assert.NotNull(result); }
public async Task <ActionResult> Create([Bind(Include = "ID,Name,DateTime,IsDeleted")] EducationType educationType) { if (ModelState.IsValid) { educationType.ID = Guid.NewGuid(); db.EducationType.Add(educationType); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(educationType)); }
public async Task <IActionResult> Put([FromBody] EducationType value) { try { var entity = _mapper.Map <BL.EducationType>(value); var id = _service.SaveAsync(entity); return(Ok(id)); } catch (Exception) { return(BadRequest()); } }
// GET: EducationTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EducationType educationType = db.EducationTypes.Find(id); if (educationType == null) { return(HttpNotFound()); } return(View(educationType)); }
// GET: EducationTypes/Delete/5 public async Task <ActionResult> Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EducationType educationType = await db.EducationType.FindAsync(id); if (educationType == null) { return(HttpNotFound()); } return(View(educationType)); }
public IActionResult Create([FromBody] EducationType newmodel) { if (ModelState.IsValid) { _context.EducationType.Add(newmodel); _context.SaveChanges(); return(CreatedAtRoute("GetEducation", new { id = newmodel.EducationTypeID }, newmodel)); } else { return(BadRequest()); } }
public ActionResult DeleteConfirmed(int id) { try { EducationType educationType = db.EducationTypes.Find(id); db.EducationTypes.Remove(educationType); db.SaveChanges(); } catch (Exception) { return(RedirectToAction("Error", "Home")); } return(RedirectToAction("Index")); }
// GET: Admin/EducationType/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EducationType educationType = await _educationTypeService.GetByIdAsync(Convert.ToInt32(id)); if (educationType == null) { return(HttpNotFound()); } var educationTypeResource = Mapper.Map <EducationType, EducationTypeResource>(educationType); return(View(educationTypeResource)); }
public IActionResult RedirectLayer(EducationType educationType, int id) { if (educationType.Equals(EducationType.Section)) { TempData["Title"] = "Units"; return(UnitPreference(id)); } if (educationType.Equals(EducationType.Unit)) { TempData["Title"] = "UnitExecutions"; return(UnitExecutionPreference(id)); } if (educationType.Equals(EducationType.UnitExec)) { TempData["Title"] = "Tasks"; return(TaskPreference(id)); } return(null); }
protected internal ConstraintDomain( string title, string description, bool isFreeDay, bool isActive, int weeklyHour, EducationType educationType, int startTime, int endTime ) { Title = title; Description = description; IsFreeDay = isFreeDay; IsActive = isActive; WeeklyHour = weeklyHour; EducationType = educationType; StartTime = startTime; EndTime = endTime; }
public IActionResult UpdateEntry([FromBody] EducationType objupd) { var targetObject = _context.EducationType.FirstOrDefault(t => t.EducationTypeID == objupd.EducationTypeID); if (targetObject == null) { return(NotFound()); } _context.Entry(targetObject).CurrentValues.SetValues(objupd); ReturnData ret; ret = _context.SaveData(); if (ret.Message == "Success") { return(Ok()); } return(NotFound(ret)); }
public void EducationType() { IQueryable <EducationType> EducationTypeCollection = Enumerable.Empty <EducationType>().AsQueryable(); EducationType ct = new EducationType { EducationTypeID = 1, EducationName = "Test ET" }; Mock <IEducationTypeRepository> EducationTypeService = new Mock <IEducationTypeRepository>(); object obj = new object(); try { EducationTypeService.Setup(x => x.GetAll()).Returns(EducationTypeCollection); EducationTypeService.Setup(x => x.Get(It.IsAny <int>())).Returns(ct); EducationTypeService.Setup(x => x.Add(It.IsAny <EducationType>())).Returns(ct); EducationTypeService.Setup(x => x.Delete(It.IsAny <EducationType>())).Verifiable(); EducationTypeService.Setup(x => x.Update(It.IsAny <EducationType>(), It.IsAny <object>())).Returns(ct); var EducationTypeObject = EducationTypeService.Object; var p1 = EducationTypeObject.GetAll(); var p2 = EducationTypeObject.Get(1); var p3 = EducationTypeObject.Update(ct, obj); var p4 = EducationTypeObject.Add(ct); EducationTypeObject.Delete(ct); Assert.IsAssignableFrom <IQueryable <EducationType> >(p1); Assert.IsAssignableFrom <EducationType>(p2); Assert.Equal("Test ET", p2.EducationName); Assert.Equal("Test ET", p3.EducationName); EducationTypeService.VerifyAll(); EducationTypeObject.Dispose(); } finally { EducationTypeService = null; } }
public EducationType GetByID(int _educationTypeId) { EducationTypeDAC _educationTypeComponent = new EducationTypeDAC(); IDataReader reader = _educationTypeComponent.GetByIDEducationType(_educationTypeId); EducationType _educationType = null; while (reader.Read()) { _educationType = new EducationType(); if (reader["EducationTypeId"] != DBNull.Value) { _educationType.EducationTypeId = Convert.ToInt32(reader["EducationTypeId"]); } if (reader["EducationTypeName"] != DBNull.Value) { _educationType.EducationTypeName = Convert.ToString(reader["EducationTypeName"]); } _educationType.NewRecord = false; } reader.Close(); return(_educationType); }
public int SaveAppraisalDetails(EducationType educationType, int employeeId) { SqlConnection sqlConnection = new SqlConnection(connStr); int output; try { if (sqlConnection.State == ConnectionState.Closed) { sqlConnection.Open(); } SqlCommand sqlCommand = new SqlCommand("usp_SaveEducationDetails", sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add("@EmployeeId", SqlDbType.VarChar).Value = employeeId; sqlCommand.Parameters.Add("@EducationTypeId", SqlDbType.Int).Value = AppraisalYear; sqlCommand.Parameters.Add("@DateOptained", SqlDbType.VarChar).Value = AppraisalPeriod; sqlCommand.Parameters.Add("@Institution", SqlDbType.DateTime).Value = AppraisalDate; sqlCommand.Parameters.Add("@QualificationName", SqlDbType.DateTime).Value = AppraisalCompleteDate; sqlCommand.Parameters.Add("@Grade", SqlDbType.Int).Value = AppraisedBy; sqlCommand.Parameters.Add("@Institution", SqlDbType.DateTime).Value = NextAppraisalDate; sqlCommand.Parameters.Add("@QualificationName", SqlDbType.DateTime).Value = LastSalaryReviewDate; sqlCommand.Parameters.Add("@Institution", SqlDbType.DateTime).Value = NextSalaryReviewDate; output = Convert.ToInt32(sqlCommand.ExecuteScalar()); return output; } catch (Exception ex) { throw ex; } }