public void NUnit_Dependant_Domain_GetById() { string status = string.Empty; Hre_DependantServices service = new Hre_DependantServices(); var model = new Hre_Dependant { Id = 3 }; var result = service.GetById<Hre_DependantEntity>(model.Id, ref status) as Hre_DependantEntity; NUnit.Framework.Assert.IsNotNull(result); Console.Write("SearchResult: " + result.Id + " | " + result.ProfileID + " | " + result.DependantName ); }
public void NUnit_Dependant_Domain_GetById() { string status = string.Empty; Hre_DependantServices service = new Hre_DependantServices(); var model = new Hre_Dependant { Id = 3 }; var result = service.GetById <Hre_DependantEntity>(model.Id, ref status) as Hre_DependantEntity; NUnit.Framework.Assert.IsNotNull(result); Console.Write("SearchResult: " + result.Id + " | " + result.ProfileID + " | " + result.DependantName ); }
public void NUnit_Dependant_Domain_Delete() { Hre_DependantServices service = new Hre_DependantServices(); int rs = 0; var model = new Hre_Dependant { Id = 3 }; string result = service.Delete <Hre_DependantEntity>(model.Id); if (result != null) { rs += 1; Console.WriteLine("Process Success >>> Delete >>> " + model.Id); } }
public void NUnit_Dependant_Domain_Edit() { Hre_DependantServices service = new Hre_DependantServices(); var model = new Hre_Dependant { Id = 1, ProfileID = 1, DependantName = "Update Name ", }; string result = service.Edit(model); if (result != string.Empty) { Console.WriteLine("Process Success >>> Update >>> " + model.Id + " | " + model.ProfileID + " | " + model.DependantName ); } }
public void NUnit_Dependant_Domain_Add() { Hre_DependantServices service = new Hre_DependantServices(); string result = string.Empty; int countSC = 0; for (int i = 1; i <= 10; i++) { var model = new Hre_Dependant { ProfileID = 1, DependantName = "Dependant Name " + i }; result = service.Add(model); if (result != string.Empty) { countSC += 1; Console.WriteLine("Process Success >>> Create >>> " + model.Id + " | " + model.DependantName ); } } Console.WriteLine("Total success record: " + countSC); }
public void AddOrUpdateDependant(Hre_RelativesEntity model) { using (var context = new VnrHrmDataContext()) { var status = string.Empty; var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); var repo = new Hre_DependantRepository(unitOfWork); Hre_Dependant Dependant = null; // kiểm tra theo profileID và Tên người thân để tránh trùng var lstDependant = repo.FindBy(x => x.ProfileID == model.ProfileID && x.DependantName.Equals(model.RelativeName)).ToList(); if (lstDependant != null && lstDependant.Count != 0) { Dependant = lstDependant.FirstOrDefault(); } if (Dependant == null) { Dependant = new Hre_Dependant(); Dependant.ProfileID = model.ProfileID; Dependant.DependantName = model.RelativeName; Dependant.IDNo = model.IDNo; if (model.YearOfBirth != null) { try { string yearparse = model.YearOfBirth.Substring(model.YearOfBirth.Length - 4, 4); int Year = int.Parse(yearparse); Dependant.DateOfBirth = new DateTime(Year, 1, 1); } catch { } } Dependant.Gender = model.Gender; Dependant.RelationID = model.RelativeTypeID; Dependant.MonthOfEffect = model.MonthOfEffect; Dependant.MonthOfExpiry = model.MonthOfExpiry; Dependant.DeclareFile = model.DeclareFile; Dependant.BirthCertificate = model.BirthCertificate; Dependant.HouseHold = model.HouseHold; Dependant.MarriageLicenses = model.MarriageLicenses; Dependant.StudyingSchools = model.StudyingSchools; Dependant.LaborDisabled = model.LaborDisabled; Dependant.NurturingObligations = model.NurturingObligations; Dependant.IDCardNo = model.IDCardNo; repo.Add(Dependant); repo.SaveChanges(); } else { Dependant.IDNo = model.IDNo; try { int Year = int.Parse(model.YearOfBirth); Dependant.DateOfBirth = new DateTime(Year, 1, 1); } catch { } Dependant.Gender = model.Gender; Dependant.RelationID = model.RelativeTypeID; Dependant.MonthOfEffect = model.MonthOfEffect; Dependant.MonthOfExpiry = model.MonthOfExpiry; repo.SaveChanges(); } } }
public void NUnit_Dependant_Domain_Remove() { Hre_DependantServices service = new Hre_DependantServices(); int rs = 0; var model = new Hre_Dependant { Id = 3 }; string result = service.Remove<Hre_DependantEntity>(model.Id); if (result != null) { rs += 1; Console.WriteLine("Process Success >>> Remove >>> " + model.Id); } }