本文整理汇总了C#中HRM.Business.Hr.Domain.Hre_ProfileServices.Edit方法的典型用法代码示例。如果您正苦于以下问题:C# Hre_ProfileServices.Edit方法的具体用法?C# Hre_ProfileServices.Edit怎么用?C# Hre_ProfileServices.Edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HRM.Business.Hr.Domain.Hre_ProfileServices
的用法示例。
在下文中一共展示了Hre_ProfileServices.Edit方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActionApproved
public string ActionApproved(string selectedIds, string userLogin)
{
using (var context = new VnrHrmDataContext())
{
string message = string.Empty;
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repo = new Hre_StopWorkingRepository(unitOfWork);
var profileServices = new Hre_ProfileServices();
string status = string.Empty;
List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
var lstStopWorkings = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
foreach (var StopWorking in lstStopWorkings)
{
if (StopWorking.StopWorkType == HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_STOP.ToString())
{
var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
StopWorking.LastStatusSyn = profile.StatusSyn;
profile.StatusSyn = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_STOP.ToString();
StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString();
profile.TypeSuspense = StopWorking.TypeSuspense;
profile.RequestDate = StopWorking.RequestDate;
profile.StopWorkType = StopWorking.StopWorkType;
profile.DateQuit = StopWorking.DateStop;
profile.ResReasonID = StopWorking.ResignReasonID;
profile.IsHoldSal = StopWorking.IsHoldSal;
profile.TypeOfStop = StopWorking.TypeOfStop;
profile.ResignNo = StopWorking.DecisionNo;
profileServices.Edit(profile);
}
else if (StopWorking.StopWorkType == HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_SUSPENSE.ToString())
{
var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
profile.StatusSyn = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_SUSPENSE.ToString();
profile.TypeOfStop = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_SUSPENSE.ToString();
StopWorking.LastStatusSyn = profile.StatusSyn;
StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString();
profile.TypeSuspense = StopWorking.TypeSuspense;
profile.RequestDate = StopWorking.RequestDate;
profile.StopWorkType = StopWorking.StopWorkType;
profile.DateQuit = StopWorking.DateStop;
profile.ResReasonID = StopWorking.ResignReasonID;
profile.ResignNo = StopWorking.DecisionNo;
profile.IsHoldSal = null;
profileServices.Edit(profile);
}
}
repo.SaveChanges();
message = NotificationType.Success.ToString();
return message;
}
}
示例2: UpdateWorkingPosition
public string UpdateWorkingPosition(string selectedIds, string userLogin)
{
string message = string.Empty;
string status = string.Empty;
var profileServices = new Hre_ProfileServices();
var workhistoryServices = new Hre_WorkHistoryServices();
List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
// var lstSuspenses = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
var services = new BaseService();
var lstObj = new List<object>();
lstObj.AddRange(new object[14]);
lstObj[12] = 1;
lstObj[13] = int.MaxValue - 1;
var lstComback = services.GetData<Hre_StopWorkingEntity>(lstObj, ConstantSql.hrm_hr_sp_get_RegisterComback, userLogin, ref status).ToList().Translate<Hre_StopWorking>();
lstComback = lstComback.Where(s => lstIds.Contains(s.ID)).ToList();
Hre_WorkHistoryEntity workHistoryEntity;
foreach (var item in lstComback)
{
var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(item.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
profile.DateOfEffect = item.DateComeBack;
string supervisor = null;
if (profile.SupervisorID != null)
{
var supervisorbyProfile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(profile.SupervisorID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
if (supervisorbyProfile != null)
{
supervisor = supervisorbyProfile.ProfileName;
}
}
workHistoryEntity = new Hre_WorkHistoryEntity();
workHistoryEntity.ProfileID = item.ProfileID.Value;
workHistoryEntity.DateEffective = item.DateComeBack != null ? item.DateComeBack.Value : DateTime.Now;
workHistoryEntity.OrganizationStructureID = profile.OrgStructureID;
workHistoryEntity.JobTitleID = profile.JobTitleID;
workHistoryEntity.PositionID = profile.PositionID;
workHistoryEntity.Supervisor = supervisor;
profileServices.Edit(profile);
workhistoryServices.Add(workHistoryEntity);
}
message = NotificationType.Success.ToString();
return message;
}
示例3: SaveContractAndSaslary
//.........这里部分代码省略.........
contractEntity.DateEnd = item.DateEndNextContract.Value;
}
if (!string.IsNullOrEmpty(contractEntity.ErrorMessage))
{
return Json(contractEntity, JsonRequestBehavior.AllowGet);
}
message = contractServices.Add(contractEntity);
}
}
#endregion
#region Xử Lý Sal_BasicSalary
var salaryEntity = new Sal_BasicSalaryEntity
{
ProfileID = item.ProfileID,
ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
RankRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.ID,
GrossAmount = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryStandard.ToString(),
DateOfEffect = item.DateEnd.Value.AddDays(1),
CurrencyID = lstCurrencyNew.ID,
Note = item.Remark
};
message = basicSalaryService.Add(salaryEntity);
#endregion
#region Xử Lý Hre_Profile
var profileEntity = profile.CopyData<Hre_ProfileEntity>();
profileEntity.SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID;
hrService.Edit(profileEntity);
if (workingHistoryEntity != null)
{
if (workingHistoryEntity.SalaryClassID != lstSalaryRankNew.SalaryClassID)
{
var workhistoryEntity = new Hre_WorkHistoryEntity
{
ProfileID = item.ProfileID,
SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
DateEffective = item.DateEnd.Value.AddDays(1)
};
message = workhistoryService.Add(workhistoryEntity);
}
}
else
{
var workhistoryEntity = new Hre_WorkHistoryEntity
{
ProfileID = item.ProfileID,
SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
DateEffective = item.DateEnd.Value.AddDays(1)
};
message = workhistoryService.Add(workhistoryEntity);
}
#endregion
#region Sal_Grade
var lstGradeByProfileID = lstSalGrade.Where(s => item.ProfileID == s.ProfileID).ToList().OrderByDescending(s => s.MonthEnd <= DateTime.Now).FirstOrDefault();
var lstGradePayrollByProfileID = lstGradePayroll.Where(s => s.Code == lstSalaryRankNew.Code).FirstOrDefault();
if (salGradeByProfileIDEntity != null)
示例4: ActionApprovedComeBack
public string ActionApprovedComeBack(string selectedIds, string userLogin)
{
using (var context = new VnrHrmDataContext())
{
string message = string.Empty;
string status = string.Empty;
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repo = new Hre_StopWorkingRepository(unitOfWork);
var profileServices = new Hre_ProfileServices();
var contractSevices = new Hre_ContractServices();
var ContractExtendServices = new Hre_ContractExtendServices();
var contractTypeSevices = new Cat_ContractTypeServices();
List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
// var lstSuspenses = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
var services = new BaseService();
var lstObj = new List<object>();
lstObj.AddRange(new object[14]);
lstObj[12] = 1;
lstObj[13] = int.MaxValue - 1;
var lstSuspenses = services.GetData<Hre_StopWorkingEntity>(lstObj, ConstantSql.hrm_hr_sp_get_RegisterComback, userLogin, ref status).ToList().Translate<Hre_StopWorking>();
lstSuspenses = lstSuspenses.Where(s => lstIds.Contains(s.ID)).ToList();
var lstSuspense = new List<Hre_StopWorkingEntity>();
foreach (var Suspense in lstSuspenses)
{
var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(Suspense.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
Suspense.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString();
Suspense.StatusComeBack = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString();
profile.StatusSyn = Suspense.LastStatusSyn;
profile.RequestDate = null;
profile.DateQuit = null;
profile.IsHoldSal = false;
profile.TypeSuspense = null;
profile.StopWorkType = null;
profile.ResReasonID = null;
profile.TypeOfStop = null;
profile.ResignNo = null;
profileServices.Edit(profile);
var contract = contractSevices.GetData<Hre_ContractEntity>(Common.DotNetToOracle(Suspense.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ContractsByProfileId, userLogin, ref status).OrderByDescending(s => s.DateStart).FirstOrDefault();
if (contract != null)
{
var contractType = contractSevices.GetData<Cat_ContractTypeEntity>(Common.DotNetToOracle(contract.ContractTypeID.ToString()), ConstantSql.hrm_cat_sp_get_ContractTypeById, userLogin, ref status).FirstOrDefault();
if (Suspense.TypeSuspense == HRM.Infrastructure.Utilities.EnumDropDown.TypeSuspense.E_MILITARY.ToString())
{
int month = 0;
if (contractType == null)
{
continue;
}
if (contractType.ValueTime != null)
{
month = (int)contractType.ValueTime.Value;
if (contractType.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString())
{
month = month * 12;
}
contract.DayContract = month;
if (contract.DateEnd != null)
{
if (Suspense.DateComeBack <= contract.DateEnd.Value)
{
if (Suspense.DateStop != null)
{
double daySus = ((Suspense.DateComeBack.Value.Subtract(Suspense.DateStop.Value)).TotalDays / 30);
contract.DayExtend = (int)Math.Floor(daySus);
if (contract.DateExtend == null)
{
contract.DateExtend = contract.DateEnd.Value.AddMonths(contract.DayExtend.Value);
}
else
{
contract.DateExtend = contract.DateExtend.Value.AddMonths(contract.DayExtend.Value);
}
}
}
else
{
if (Suspense.DateStop != null)
{
double daySus = (contract.DateEnd.Value.Subtract(Suspense.DateStop.Value)).TotalDays / 30;
contract.DayExtend = (int)Math.Floor(daySus);
if (contract.DateExtend == null)
{
contract.DateExtend = contract.DateEnd.Value.AddMonths(contract.DayExtend.Value);
}
else
{
contract.DateExtend = contract.DateExtend.Value.AddMonths(contract.DayExtend.Value);
}
Suspense.DateComeBack = Suspense.DateComeBack.Value.AddMonths(contract.DayExtend.Value);
}
}
}
}
contract.StatusEvaluation = HRM.Infrastructure.Utilities.EnumDropDown.Status.E_APPROVED.ToString();
Hre_ContractExtendEntity contractExtend = new Hre_ContractExtendEntity();
contractExtend.ContractID = contract.ID;
contractExtend.DateStart = Suspense.DateComeBack;
//.........这里部分代码省略.........
示例5: SaveContractAndNextSalaryApprovedEvaluation
//.........这里部分代码省略.........
JobTitleID = contract.JobTitleID,
PositionID = contract.PositionID,
// DateEnd = contractTypeEntity.DateStart.Value.AddMonths(month),
Salary = lstSalaryRankNew == null ? 0 : lstSalaryRankNew.SalaryStandard,
RankRateID = lstSalaryRankNew == null ? contract.RankRateID : lstSalaryRankNew.ID,
ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
ClassRateName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryClassName,
SalaryRankName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryRankName,
ContractTypeID = contractTypeEntity.ID
};
//if (!string.IsNullOrEmpty(contractTypeEntity.Formula))
//{
// contractEntity = SetNewDateEndContract(contractEntity);
//}
if (contract.DateEndNextContract != null)
{
contractEntity.DateEnd = contract.DateEndNextContract.Value;
}
contractEntity.DateExtend = contract.DateEnd;
contractEntity.StatusEvaluation = "E_APPROVED";
if (!string.IsNullOrEmpty(contractEntity.ErrorMessage))
{
return string.Empty;
}
message = contractServices.Add(contractEntity);
}
}
//Edit lai StatusEvaluation
contract.StatusEvaluation = "E_APPROVED";
message = contractServices.Edit(contract);
#endregion
#region Xử Lý Sal_BasicSalary
var salaryEntity = new Sal_BasicSalaryEntity
{
ProfileID = contract.ProfileID,
ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
RankRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.ID,
GrossAmount = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryStandard.ToString(),
DateOfEffect = contract.DateSigned != null ? contract.DateSigned.Value : DateTime.Now,
CurrencyID = lstCurrencyNew.ID,
Note = contract.Remark,
Status = "E_APPROVED"
};
message = basicSalaryService.Add(salaryEntity);
#endregion
#region Xử Lý Hre_Profile
var profileEntity = profile.CopyData<Hre_ProfileEntity>();
Guid? _AbilityTileID = null;
profileEntity.SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID;
if (profileEntity.SalaryClassID != null)
{
var abilityTitleBySalaryClass = hrService.GetData<Cat_AbilityTileEntity>(Common.DotNetToOracle(profileEntity.SalaryClassID.ToString()), ConstantSql.hrm_cat_sp_get_AbilityTileBySalaryClassId, UserLogin, ref status).FirstOrDefault();
if (abilityTitleBySalaryClass != null)
{
_AbilityTileID = abilityTitleBySalaryClass.ID;
profileEntity.AbilityTileID = _AbilityTileID;
}
}
示例6: UpdateDataForProfileWaiting
//.........这里部分代码省略.........
Contract.CurenncyID2 = currencyID;
Contract.CurenncyID3 = currencyID;
Contract.CurenncyIDSalary = currencyID;
Contract.CurenncyID4 = currencyID;
Contract.CurenncyID5 = currencyID;
Contract.Status = HRM.Infrastructure.Utilities.EnumDropDown.Status.E_WAITING.ToString();
Contract.JobTitleID = jobTitleID;
Contract.PositionID = positionID;
if (!string.IsNullOrEmpty(contractType.Formula))
{
Contract = SetNewDateEndContract(Contract);
}
Contract.DateExtend = Contract.DateEnd;
// Contract = SetNewCodeContract(Contract, listIdContract);
message = contractServices.Add(Contract);
#endregion
#region Edit Profile
//Edit Profile
item.OrgStructureID = OrgStructureID;
if (salaryClassEntity != null)
{
item.SalaryClassID = salaryClassEntity.ID;
}
item.DateOfEffect = DateHire;
item.DateHire = DateHire;
item.DateEndProbation = Contract.DateEnd.Value;
item.WorkPlaceID = WorkPlaceID;
item.ContractTypeID = ContractTypeID;
item.CodeEmp = codeEmp;
item.StatusSyn = ProfileStatusSyn.E_WAITING.ToString();
message = profileSevices.Edit(item);
#endregion
#region Add Sal_Insurance
// Add Insurance
if (contractType != null && contractType.NoneTypeInsuarance == true)
{
var insuranceEntity = new Sal_InsuranceSalaryEntity
{
ProfileID = item.ID,
InsuranceAmount = insuranceSalary,
DateEffect = DateHire,
IsSocialIns = contractType.IsSocialInsurance == null ? null : contractType.IsSocialInsurance,
IsUnimploymentIns = contractType.IsUnEmployInsurance == null ? null : contractType.IsUnEmployInsurance,
IsMedicalIns = contractType.IsHealthInsurance == null ? null : contractType.IsHealthInsurance,
CurrencyID = currencyID
};
message = insServices.Add(insuranceEntity);
}
#endregion
#region Add Sal_BasicSalary
Sal_BasicSalaryEntity basicSalaryEntity = new Sal_BasicSalaryEntity();
basicSalaryEntity.ProfileID = item.ID;
basicSalaryEntity.GrossAmount = BasicSalary;
basicSalaryEntity.Amount = BasicSalary.Encrypt();
basicSalaryEntity.DateOfEffect = DateHire;
basicSalaryEntity.RankRateID = SalaryRankID;
basicSalaryEntity.CurrencyID = currencyID.Value;
if (salaryClassEntity != null)
{
basicSalaryEntity.ClassRateID = salaryClassEntity.ID;
}
示例7: UpdateOrgProfile
/// <summary>
/// Cập nhật phòng ban cho nhân viên
/// </summary>
/// <param name="SalaryClassName"></param>
/// <param name="ProfileIDs"></param>
/// <param name="DateEndProbation"></param>
/// <param name="DateHire"></param>
/// <returns></returns>
public ActionResult UpdateOrgProfile([Bind]Hre_ProfileModel model)
{
IList<Hre_ProfileEntity> list = new List<Hre_ProfileEntity>();
if (!string.IsNullOrEmpty(model.listId))
{
List<Guid> lisIDs = model.listId.Split(',').Select(x => Guid.Parse(x)).ToList();
Hre_ProfileEntity ObjProfile = null;
var actionService = new ActionService(UserLogin);
var ProfileService = new Hre_ProfileServices();
foreach (Guid item in lisIDs)
{
string status = string.Empty;
ObjProfile = new Hre_ProfileEntity();
var ResultProfile = actionService.GetData<Hre_ProfileEntity>(item, ConstantSql.hrm_hr_sp_get_ProfileById, ref status).FirstOrDefault();
ObjProfile = ResultProfile;
ObjProfile.OrgStructureID = model.OrgStructureID;
ProfileService.Edit(ObjProfile);
list.Add(ObjProfile);
}
}
return Json(list);
}
示例8: UpdateSalaryClassNameForProfile
//.........这里部分代码省略.........
var workplace = workplaceServices.GetData<Cat_WorkPlaceEntity>(Common.DotNetToOracle(WorkPlaceID.ToString()), ConstantSql.hrm_cat_sp_get_WorkPlaceById, userLogin, ref status).FirstOrDefault();
foreach (var item in lstProfiles)
{
var canEntity = lstCan.Where(s => s.ProfileID.Value == item.ID).FirstOrDefault();
if (canEntity == null)
{
//Add new contract
var objContract = new List<object>();
objContract.Add(item.ID);
var lstContractByProfileID = contractServices.GetData<Hre_ContractEntity>(objContract, ConstantSql.hrm_hr_sp_get_ContractsByProfileId, userLogin, ref status);
var listIdContract = string.Empty;
if (lstContractByProfileID != null)
{
listIdContract = string.Join(",", lstContractByProfileID.Select(d => d.ContractTypeID));
}
var contractType = lstContractType.Where(s => s.ID == ContractTypeID).FirstOrDefault();
DateTime dateEnd = DateHire;
if (contractType != null)
{
if (contractType.ValueTime != null)
{
//month = (int)contractType.ValueTime.Value;
//if (contractType.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString())
//{
// month = month * 12;
//}
if (contractType.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_MONTH.ToString())
{
dateEnd = DateHire.AddMonths(int.Parse(contractType.ValueTime.Value.ToString()));
}
else if (contractType.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString())
{
dateEnd = DateHire.AddYears(int.Parse(contractType.ValueTime.Value.ToString()));
}
}
}
double Salary = 0;
if (!string.IsNullOrEmpty(BasicSalary))
Salary = double.Parse(BasicSalary);
Hre_ContractEntity Contract = new Hre_ContractEntity();
Contract.ProfileID = item.ID;
Contract.Salary = Salary;
Contract.ContractTypeID = ContractTypeID;
Contract.DateStart = DateHire;
Contract.DateSigned = DateHire;
Contract.DateEnd = dateEnd;
Contract.RankRateID = SalaryRankID;
Contract.ClassRateID = salaryClassEntity.ID;
if (!string.IsNullOrEmpty(contractType.Formula))
{
Contract = SetNewDateEndContract(Contract, userLogin);
}
Contract = SetNewCodeContract(Contract, listIdContract, userLogin);
contractServices.Add(Contract);
//Edit Profile
item.OrgStructureID = OrgStructureID;
item.SalaryClassID = salaryClassEntity == null ? Guid.Empty : salaryClassEntity.ID;
item.DateOfEffect = DateHire;
item.DateHire = DateHire;
item.DateEndProbation = Contract.DateEnd.Value;
item.WorkPlaceID = WorkPlaceID;
item.ContractTypeID = ContractTypeID;
profileSevices.Edit(item);
//// Add Insurance
//if (contractType != null && contractType.NoneTypeInsuarance == true)
//{
// var insuranceEntity = new Sal_InsuranceSalaryEntity
// {
// ProfileID = item.ID,
// InsuranceAmount = model.InsuranceAmount,
// DateEffect = DateHire,
// IsSocialIns = contractType.IsSocialInsurance == null ? null : contractType.IsSocialInsurance,
// IsUnimploymentIns = contractType.IsUnEmployInsurance == null ? null : contractType.IsUnEmployInsurance,
// IsMedicalIns = contractType.IsHealthInsurance == null ? null : contractType.IsHealthInsurance,
// CurrencyID = model.CurenncyID1
// };
// insuranceServices.Add(insuranceEntity);
//}
Hre_WorkHistoryEntity workHistory = new Hre_WorkHistoryEntity();
workHistory.ProfileID = item.ID;
workHistory.DateEffective = DateHire;
workHistory.SalaryClassID = salaryClassEntity == null ? Guid.Empty : salaryClassEntity.ID;
workHistory.OrganizationStructureID = OrgStructureID;
workHistory.WorkLocation = workplace != null ? workplace.WorkPlaceName : null;
workingHistoryServices.Add(workHistory);
}
}
}
}
示例9: Post
public Hre_WorkHistoryModel Post([Bind]Hre_WorkHistoryModel model)
{
#region Validate
BaseService BaseService = new BaseService();
string status = string.Empty;
string message = string.Empty;
var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_WorkHistoryModel>(model, "Hre_WorkHistory", ref message);
if (!checkValidate)
{
model.ActionStatus = message;
return model;
}
#endregion
var WorkHistoryServices = new Hre_WorkHistoryServices();
var SalaryClassServices = new Cat_SalaryClassServices();
var OrgStructureServices = new Cat_OrgStructureServices();
var JobTitleServices = new Cat_JobTitleServices();
var PositionServices = new Cat_PositionServices();
var WorkHistoryOld = BaseService.GetData<Hre_WorkHistoryEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_WorkHistoryByProfileId, UserLogin, ref status).OrderByDescending(s => s.DateEffective).FirstOrDefault();
if (WorkHistoryOld != null)
{
model.SalaryClassNameOld = WorkHistoryOld.SalaryClassName;
model.JobTitleOld = WorkHistoryOld.JobTitleName;
model.PositionOld = WorkHistoryOld.PositionName;
model.OrgStructureOldID = WorkHistoryOld.OrganizationStructureID;
model.WorkLocationOld = WorkHistoryOld.WorkLocation;
}
if (model.SalaryClassID != null)
{
var abilityTitleBySalaryClass = BaseService.GetData<Cat_AbilityTileEntity>(Common.DotNetToOracle(model.SalaryClassID.ToString()), ConstantSql.hrm_cat_sp_get_AbilityTileBySalaryClassId,UserLogin, ref status).FirstOrDefault();
if (abilityTitleBySalaryClass != null)
{
model.AbilityTileID = abilityTitleBySalaryClass.ID;
}
}
// Son.Vo - 20140107 - Xử lý cập nhật ngược lại bảng profile
if (model.Status == WorkHistoryStatus.E_APPROVED.ToString() && model.DateEffective != null && model.DateEffective <= DateTime.Now.Date)
{
Hre_ProfileServices profileServices = new Hre_ProfileServices();
Hre_ProfileEntity profile = BaseService.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById,UserLogin, ref status).FirstOrDefault();
if (profile != null)
{
profile.OrgStructureID = model.OrganizationStructureID;
profile.JobTitleID = model.JobTitleID;
profile.PositionID = model.PositionID;
profile.DateOfEffect = model.DateEffective;
profile.LaborType = model.LaborType;
profile.CostCentreID = model.CostCentreID;
profile.FormType = model.FormType;
profile.EmpTypeID = model.EmployeeTypeID;
profile.WorkingPlace = model.WorkLocation;
profile.AbilityTileID = model.AbilityTileID;
profileServices.Edit(profile);
}
}
ActionService service = new ActionService(UserLogin);
return service.UpdateOrCreate<Hre_WorkHistoryEntity, Hre_WorkHistoryModel>(model);
}