private void SaveCommission(TTransDet det, decimal?commission, string employeeId, EnumCommissionPeople commissionPeople) { //search employee commission MEmployee emp = _mEmployeeRepository.Get(employeeId); string typeCommission = EnumCommissionType.Fix.ToString(); decimal? commissionVal = commission; MActionComm actionComm = _mActionCommRepository.GetByEmployeeAndAction(emp, det.ActionId); if (actionComm != null) { typeCommission = actionComm.ActionCommType; commissionVal = actionComm.ActionCommVal; if (typeCommission == EnumCommissionType.Percent.ToString()) { commission = det.TransDetTotal.Value * (commissionVal / 100); } else { commission = commissionVal; } } TCommission comm = new TCommission(det); comm.SetAssignedIdTo(Guid.NewGuid().ToString()); comm.EmployeeId = emp; comm.CommissionType = commissionPeople.ToString(); comm.CommissionValue = commission; comm.CreatedDate = DateTime.Now; comm.CreatedBy = User.Identity.Name; comm.DataStatus = EnumDataStatus.New.ToString(); _tCommissionRepository.Save(comm); }
private void SaveCommission(TRecPeriod recPeriod, EnumCommissionType enumCommissionType, EnumDepartment department, MEmployee mEmployee, int level, decimal?commissionFactor, decimal?commissionValue, string desc = null) { TCommission comm = new TCommission(); comm.SetAssignedIdTo(Guid.NewGuid().ToString()); comm.CommissionLevel = level; comm.CommissionFactor = commissionFactor; comm.CommissionValue = commissionValue; comm.EmployeeId = mEmployee; comm.CommissionType = enumCommissionType.ToString(); comm.CommissionStatus = department.ToString(); comm.RecPeriodId = recPeriod; comm.CommissionDesc = desc; comm.CreatedBy = User.Identity.Name; comm.CreatedDate = DateTime.Now; comm.DataStatus = EnumDataStatus.Updated.ToString(); _tCommissionRepository.Save(comm); }