public void NUnit_Dependant_Domain_Get() { string status = string.Empty; Hre_DependantServices service = new Hre_DependantServices(); var repo = service.GetAllUseEntity<Hre_DependantEntity>(ref status); Console.Write("Total Record: " + repo.Count()); }
public void NUnit_Dependant_Domain_Get() { string status = string.Empty; Hre_DependantServices service = new Hre_DependantServices(); var repo = service.GetAllUseEntity <Hre_DependantEntity>(ref status); Console.Write("Total Record: " + repo.Count()); }
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 Hre_RelativesModel Post([Bind] Hre_RelativesModel model) { #region Validate string status = string.Empty; if (model.YearOfBirth != string.Empty && model.YearOfBirth.Length >= 10) { string[] ArrayYearOfBirth = model.YearOfBirth.Split('/').ToArray(); ArrayYearOfBirth[2] = ArrayYearOfBirth[2].Substring(0, 4); if (ArrayYearOfBirth[0].Length < 2) { ArrayYearOfBirth[0] = "0" + ArrayYearOfBirth[0]; } if (ArrayYearOfBirth[1].Length < 2) { ArrayYearOfBirth[1] = "0" + ArrayYearOfBirth[1]; } string _tmp = ArrayYearOfBirth[1]; ArrayYearOfBirth[1] = ArrayYearOfBirth[0]; ArrayYearOfBirth[0] = _tmp; model.YearOfBirth = string.Join("/", ArrayYearOfBirth); //#region Kiểm tra tổi con nhỏ mà lớn hơn 18 tuổi thì không cho lưu //try //{ // DateTime bday = new DateTime(int.Parse(ArrayYearOfBirth[2]), int.Parse(ArrayYearOfBirth[1]), int.Parse(ArrayYearOfBirth[0])); // DateTime today = DateTime.Today; // int age = today.Year - int.Parse(ArrayYearOfBirth.LastOrDefault()); // if (bday > today.AddYears(-age)) // { // age--; // } // if (age >= 18) // { // model.ActionStatus = "Con Nhỏ Không Thể Lớn Hơn 18 tuổi !"; // return model; // } //} //catch //{ //} //#endregion } var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Hre_RelativesModel>(model, "Hre_Relatives", ref status); if (!checkValidate) { model.ActionStatus = status; return(model); } #endregion ActionService service = new ActionService(UserLogin); #region thêm hoặc update người phụ thuộc từ người thân if (model.CheckAddDependant.HasValue && model.CheckAddDependant.Value == false) { Hre_DependantServices Services1 = new Hre_DependantServices(); Services1.AddOrUpdateDependant(model.Copy <Hre_RelativesEntity>()); } #endregion #region Son.Vo - 20150120 - gán cột EmpCodeRelativesName = mã nv + tên người thân var entityprofilebyRelative = service.GetData <Hre_ProfileEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, ref status).FirstOrDefault(); string codeEmpByRelatives = entityprofilebyRelative != null ? entityprofilebyRelative.CodeEmp : string.Empty; model.EmpCodeRelativesName = codeEmpByRelatives + model.RelativeName; #endregion var entity = service.GetData <Hre_RelativesEntity>(model.IDNo, ConstantSql.hrm_hr_sp_get_RelativesByIdNo, ref status); service.UpdateOrCreate <Hre_RelativesEntity, Hre_RelativesModel>(model); if (entity != null && entity.Count > 0) { model.ActionStatus += ",Số CMND đã tồn tại trong hệ thống"; } return(model); }
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); } }