public void NUnit_Contract_Domain_Edit() { Hre_ContractServices service = new Hre_ContractServices(); var model = new Hre_Contract { Id = 5, Code = "Update Code Test", ProfileID = 1, ContractNo = "Update No ", ContractTypeID = 1, DateSigned = DateTime.Parse("2014/06/05"), DateStart = DateTime.Parse("2014/08/07") }; string result = service.Edit(model); if (result != string.Empty) { Console.WriteLine("Process Success >>> Update >>> " + model.Id + " | " + model.Code + " | " + model.ProfileID + " | " + model.ContractNo + " | " + model.ContractTypeID + " | " + model.DateSigned + " | " + model.DateStart ); } }
public void NUnit_Contract_Domain_Add() { Hre_ContractServices service = new Hre_ContractServices(); string result = string.Empty; int countSC = 0; for (int i = 1; i <= 10; i++) { var model = new Hre_Contract { Code = "Code Test " + i, ProfileID = 1, ContractNo = "No " + i, ContractTypeID= 1, DateSigned = DateTime.Parse("2014/02/01"), DateStart = DateTime.Parse("2014/04/03") }; result = service.Add(model); if (result != string.Empty) { countSC += 1; Console.WriteLine("Process Success >>> Create >>> " + model.Id + " | " + model.Code + " | " + model.ProfileID + " | " + model.ContractNo + " | " + model.ContractTypeID + " | " + model.DateSigned + " | " + model.DateStart ); } } Console.WriteLine("Total success record: " + countSC); }
public void NUnit_Contract_Domain_Get() { string status = string.Empty; Hre_ContractServices service = new Hre_ContractServices(); var repo = service.GetAllUseEntity<Hre_ContractEntity>(ref status); Console.Write("Total Record: " + repo.Count()); }
public void NUnit_Contract_Domain_Add() { Hre_ContractServices service = new Hre_ContractServices(); string result = string.Empty; int countSC = 0; for (int i = 1; i <= 10; i++) { var model = new Hre_Contract { Code = "Code Test " + i, ProfileID = 1, ContractNo = "No " + i, ContractTypeID = 1, DateSigned = DateTime.Parse("2014/02/01"), DateStart = DateTime.Parse("2014/04/03") }; result = service.Add(model); if (result != string.Empty) { countSC += 1; Console.WriteLine("Process Success >>> Create >>> " + model.Id + " | " + model.Code + " | " + model.ProfileID + " | " + model.ContractNo + " | " + model.ContractTypeID + " | " + model.DateSigned + " | " + model.DateStart ); } } Console.WriteLine("Total success record: " + countSC); }
public void NUnit_Contract_Domain_Get() { string status = string.Empty; Hre_ContractServices service = new Hre_ContractServices(); var repo = service.GetAllUseEntity <Hre_ContractEntity>(ref status); Console.Write("Total Record: " + repo.Count()); }
public void NUnit_Contract_Domain_GetById() { string status = string.Empty; Hre_ContractServices service = new Hre_ContractServices(); var model = new Hre_Contract { Id = 3 }; var result = service.GetById<Hre_ContractEntity>(model.Id, ref status) as Hre_ContractEntity; NUnit.Framework.Assert.IsNotNull(result); Console.Write("SearchResult: " + result.Id + " | " + result.ProfileID + " | " + result.Code + " | " + result.ContractNo ); }
public void NUnit_Contract_Domain_Delete() { Hre_ContractServices service = new Hre_ContractServices(); int rs = 0; var model = new Hre_Contract { Id = 3 }; string result = service.Delete <Hre_ContractEntity>(model.Id); if (result != string.Empty) { rs += 1; Console.WriteLine("Process Success >>> Delete >>> " + model.Id); } }
public void NUnit_Contract_Domain_GetById() { string status = string.Empty; Hre_ContractServices service = new Hre_ContractServices(); var model = new Hre_Contract { Id = 3 }; var result = service.GetById <Hre_ContractEntity>(model.Id, ref status) as Hre_ContractEntity; NUnit.Framework.Assert.IsNotNull(result); Console.Write("SearchResult: " + result.Id + " | " + result.ProfileID + " | " + result.Code + " | " + result.ContractNo ); }
public DataTable GetReportNotHaveSocial(DateTime?dateFrom, DateTime?dateTo, string OrgStructureID, string userLogin) { using (var context = new VnrHrmDataContext()) { string status = string.Empty; //string type_COLLECT_SOCIAL_INSURANCE = AppConfig.E_COLLECT_SOCIAL_INSURANCE.ToString(); //bool _e_PROBATION_NoPay_INSURANCE = false; var profileServices = new Hre_ProfileServices(); DataTable table = GetReportNotHaveSocialSchema(); var lstObjProfile = new List <object>(); lstObjProfile.Add(OrgStructureID); lstObjProfile.Add(null); lstObjProfile.Add(null); var lstProfile = profileServices.GetData <Hre_ProfileEntity>(lstObjProfile, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, userLogin, ref status).ToList(); var gradePayrollService = new Cat_GradePayrollServices(); var lstObjGradePayroll = new List <object>(); lstObjGradePayroll.Add(null); lstObjGradePayroll.Add(null); lstObjGradePayroll.Add(1); lstObjGradePayroll.Add(int.MaxValue - 1); var contractServices = new Hre_ContractServices(); var lstObjContract = new List <object>(); lstObjContract.AddRange(new object[15]); lstObjContract[13] = 1; lstObjContract[14] = int.MaxValue - 1; var provinceServices = new Cat_ProvinceServices(); var lstObjProvince = new List <object>(); lstObjProvince.Add(null); lstObjProvince.Add(null); lstObjProvince.Add(null); lstObjProvince.Add(null); lstObjProvince.Add(null); lstObjProvince.Add(null); var lstProvince = provinceServices.GetData <Cat_ProvinceEntity>(lstObjProvince, ConstantSql.hrm_cat_sp_get_Province, userLogin, ref status).ToList(); foreach (var item in lstProfile) { DataRow dr = table.NewRow(); dr[Ins_ReportNotHaveSocialEntity.FieldNames.ID] = item.ID; dr[Ins_ReportNotHaveSocialEntity.FieldNames.CodeEmp] = item.CodeEmp == null ? string.Empty : item.CodeEmp; dr[Ins_ReportNotHaveSocialEntity.FieldNames.ProfileName] = item.ProfileName == null ? string.Empty : item.ProfileName; dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_DEPARTMENT] = item.OrgStructureName == null ? string.Empty : item.E_DEPARTMENT; dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_DIVISION] = item.OrgStructureName == null ? string.Empty : item.E_DIVISION; dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_SECTION] = item.OrgStructureName == null ? string.Empty : item.E_SECTION; dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_TEAM] = item.OrgStructureName == null ? string.Empty : item.E_TEAM; dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_UNIT] = item.OrgStructureName == null ? string.Empty : item.E_UNIT; dr[Ins_ReportNotHaveSocialEntity.FieldNames.PositionName] = item.PositionName == null ? string.Empty : item.PositionName; dr[Ins_ReportNotHaveSocialEntity.FieldNames.JobTitleName] = item.JobTitleName == null ? string.Empty : item.JobTitleName; dr[Ins_ReportNotHaveSocialEntity.FieldNames.EthnicGroupName] = item.EthnicGroupName == null ? string.Empty : item.EthnicGroupName; dr[Ins_ReportNotHaveSocialEntity.FieldNames.HealthTreatmentPlace] = item.HealthTreatmentPlace == null ? string.Empty : item.HealthTreatmentPlace; dr[Ins_ReportNotHaveSocialEntity.FieldNames.HealthTreatmentPlaceCode] = item.HealthTreatmentPlaceCode == null ? string.Empty : item.HealthTreatmentPlaceCode; var province = lstProvince.Where(s => s.ID == item.PlaceOfIssueID).FirstOrDefault(); if (province != null) { dr[Ins_ReportNotHaveSocialEntity.FieldNames.IDPOI_Code] = province.Code == null ? string.Empty : province.Code; dr[Ins_ReportNotHaveSocialEntity.FieldNames.IDPOI] = province.ProvinceName == null ? string.Empty : province.ProvinceName; } dr[Ins_ReportNotHaveSocialEntity.FieldNames.Origin] = item.Origin == null ? string.Empty : item.Origin; dr[Ins_ReportNotHaveSocialEntity.FieldNames.PAddress] = item.PAddress == null ? string.Empty : item.PAddress; dr[Ins_ReportNotHaveSocialEntity.FieldNames.TAddress] = item.TAddress == null ? string.Empty : item.TAddress; if (item.DateHire != null) { dr[Ins_ReportNotHaveSocialEntity.FieldNames.DateHire] = item.DateHire.Value; } if (item.DateQuit != null) { dr[Ins_ReportNotHaveSocialEntity.FieldNames.DateHire] = item.DateQuit.Value; } if (item.DateOfBirth != null) { dr[Ins_ReportNotHaveSocialEntity.FieldNames.DateOfBirth] = item.DateOfBirth.Value; } var provinceTreatment = lstProvince.Where(s => s.ID == item.ProvinceInsuranceID).FirstOrDefault(); if (provinceTreatment != null) { dr[Ins_ReportNotHaveSocialEntity.FieldNames.PlaceOfTreatmentProvince] = provinceTreatment.Code == null ? string.Empty : provinceTreatment.Code; } table.Rows.Add(dr); } return(table); } }
public void NUnit_Contract_Domain_Delete() { Hre_ContractServices service = new Hre_ContractServices(); int rs = 0; var model = new Hre_Contract { Id = 3 }; string result = service.Delete<Hre_ContractEntity>(model.Id); if (result != string.Empty) { rs += 1; Console.WriteLine("Process Success >>> Delete >>> " + model.Id); } }
public Hre_AppendixContractModel Post([Bind] Hre_AppendixContractModel model) { #region Validate string message = string.Empty; var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Hre_AppendixContractModel>(model, "Hre_AppendixContract", ref message); if (!checkValidate) { model.ActionStatus = message; return(model); } #endregion if (model.AppendixCreateBasicSalary == true) { Sal_BasicSalaryServices salaryservices = new Sal_BasicSalaryServices(); Sal_BasicSalaryEntity basicSalaryBycontract = new Sal_BasicSalaryEntity(); basicSalaryBycontract.ProfileID = model.ProfileID.Value; basicSalaryBycontract.GrossAmount = model.Salary != null?model.Salary.ToString() : "0"; basicSalaryBycontract.CurrencyID = model.CurenncyID != null ? model.CurenncyID.Value : Guid.Empty; basicSalaryBycontract.PersonalRate = model.PersonalRate; if (model.DateofEffect != null) { basicSalaryBycontract.DateOfEffect = model.DateofEffect.Value; } basicSalaryBycontract.InsuranceAmount = model.InsuranceAmount != null ? model.InsuranceAmount.Value : 0; basicSalaryBycontract.CurrencyID1 = model.CurenncyID1; basicSalaryBycontract.ClassRateID = model.ClassRateID; basicSalaryBycontract.RankRateID = model.RankRateID; basicSalaryBycontract.AllowanceType1ID = model.AllowanceID1; basicSalaryBycontract.AllowanceAmount1 = model.Allowance1; basicSalaryBycontract.CurrencyID2 = model.CurenncyID2; basicSalaryBycontract.AllowanceType2ID = model.AllowanceID2; basicSalaryBycontract.AllowanceAmount2 = model.Allowance2; basicSalaryBycontract.CurrencyID3 = model.CurenncyID3; basicSalaryBycontract.AllowanceType3ID = model.AllowanceID3; basicSalaryBycontract.AllowanceAmount3 = model.Allowance3; basicSalaryBycontract.CurrencyID4 = model.CurenncyIDSalary; salaryservices.Add(basicSalaryBycontract); } var status = string.Empty; var contractServices = new Hre_ContractServices(); var contractEntity = contractServices.GetData <Hre_ContractEntity>(model.ProfileID, ConstantSql.hrm_hr_sp_get_ContractsByProfileId, UserLogin, ref status).OrderByDescending(s => s.DateUpdate).FirstOrDefault(); if (contractEntity != null) { model.ContractID = contractEntity.ID; } else { model.ActionStatus = ConstantMessages.WarningProfileHaveNotContract.ToString().TranslateString(); return(model); } ActionService service = new ActionService(UserLogin); return(service.UpdateOrCreate <Hre_AppendixContractEntity, Hre_AppendixContractModel>(model, model.UserID)); }
public Hre_ContractModel Put([Bind] Hre_ContractModel model) { var ContractServices = new Hre_ContractServices(); string status = string.Empty; string id = string.Empty; foreach (var item in model.selecteIds) { id += Common.DotNetToOracle(item.ToString()) + ","; } id = id.Substring(0, id.Length - 1); string type = model.Status; var service = new BaseService(); var actionServices = new ActionService(UserLogin); if (model.ID == Guid.Empty) { model.DateExtend = model.DateEnd; } var objContract = new List <object>(); objContract.AddRange(new object[2]); objContract[0] = 1; objContract[1] = int.MaxValue - 1; var lstContracts = actionServices.GetData <Hre_ContractEntity>(objContract, ConstantSql.hrm_hr_sp_get_ContractData, ref status).ToList(); if (!string.IsNullOrEmpty(id)) { try { var idItem = id.Split(','); for (int i = 0; i < idItem.Count(); i++) { var idInt = idItem[i]; if (idInt != null) { var entity = lstContracts.Where(s => s.ID != null && Common.DotNetToOracle(s.ID.ToString()) == idInt).FirstOrDefault(); var lstContractByProfileID = lstContracts.Where(s => s.ProfileID == entity.ProfileID && s.Status == EnumDropDown.Status.E_APPROVED.ToString()).ToList(); var listIdContract = string.Empty; if (lstContractByProfileID.Count > 0) { listIdContract = string.Join(",", lstContractByProfileID.Select(d => d.ContractTypeID)); } entity = ContractServices.SetNewCodeContract(entity, listIdContract, UserLogin); entity.Status = type; if (!string.IsNullOrEmpty(entity.ContractNo)) { // Theo task 0049504 - chỉ edit lại cột TimesContract nếu hd loại có thời hạn if (entity.ContractTypeID != null) { var contracttypeBycontract = actionServices.GetData <Cat_ContractTypeEntity>(Common.DotNetToOracle(entity.ContractTypeID.ToString()), ConstantSql.hrm_cat_sp_get_ContractTypeById, ref status).FirstOrDefault(); if (contracttypeBycontract != null && contracttypeBycontract.Type == HRM.Infrastructure.Utilities.EnumDropDown.TypeContract.E_DURATION.ToString()) { try { string times = entity.ContractNo.Substring(entity.ContractNo.Length - 1, 1); int Year = int.Parse(times); entity.TimesContract = Year; } catch { } } } } status = ContractServices.Edit(entity); model.SetPropertyValue(Constant.ActionStatus, status); } } } catch (Exception ex) { model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error.ToString() + "," + ex.Message); } } return(model); }