本文整理汇总了C#中HRM.Business.Hr.Domain.Hre_ProfileServices类的典型用法代码示例。如果您正苦于以下问题:C# Hre_ProfileServices类的具体用法?C# Hre_ProfileServices怎么用?C# Hre_ProfileServices使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Hre_ProfileServices类属于HRM.Business.Hr.Domain命名空间,在下文中一共展示了Hre_ProfileServices类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActionCancel
public string ActionCancel(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)
{
var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
profile.StatusSyn = StopWorking.LastStatusSyn;
StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_CANCEL.ToString();
profile.StopWorkType = null;
profile.TypeSuspense = null;
profile.RequestDate = null;
profile.DateQuit = null;
profile.ResReasonID = null;
profile.IsHoldSal = false;
profile.ResignNo = null;
profile.TypeOfStop = null;
profileServices.Edit(profile);
}
repo.SaveChanges();
message = NotificationType.Success.ToString();
return message;
}
}
示例2: Approved
/// <summary>
/// Lay DS luong hieu luc cua toan cong ty. Moi nhan vien chi co 1 muc luong trong danh sach.
/// </summary>
/// <param name="lstSalaryAll">get all Salary</param>
/// <param name="monthEffect"></param>
/// <returns></returns>
public void Approved(List<Guid> selectedIds, string status, string userLoginName)
{
using (var context = new VnrHrmDataContext())
{
string statusMessage = string.Empty;
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoProfile = new Hre_ProfileRepository(unitOfWork);
var repoHoldSalary = new Sal_HoldSalaryRepository(unitOfWork);
var lstHoldSalary = repoHoldSalary.FindBy(s => selectedIds.Contains(s.ID)).ToList();
var lstProfileIDs = lstHoldSalary.Select(s => s.ProfileID).ToList();
var profileServices = new Hre_ProfileServices();
var objProfile = new List<object>();
objProfile.AddRange(new object[17]);
objProfile[15] = 1;
objProfile[16] = int.MaxValue - 1;
var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileAll,userLoginName, ref statusMessage).ToList().Translate<Hre_Profile>();
//var lstProfiles = repoProfile.FindBy(m => m.ID != null && lstProfileIDs.Contains(m.ID)).ToList();
foreach (var holdSalary in lstHoldSalary)
{
holdSalary.Status = status;
var profileByID = lstProfile.Where(s => s.ID == holdSalary.ProfileID.Value).FirstOrDefault();
profileByID.MonthHoldSal = holdSalary.MonthSalary;
profileByID.IsHoldSal = true;
}
repoHoldSalary.SaveChanges();
repoProfile.SaveChanges();
}
}
示例3: Put
/// <summary>
/// [Tho.Bui] - Lấy dữ liệu Nhân Viên (Hre_ProfilePartyUnion) theo ProfileId
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public Hre_ProfilePartyUnionModel Put(Hre_ProfilePartyUnionModel model)
{
var service = new Hre_ProfileServices();
string status = string.Empty;
List<object> listObj = new List<object>() { model.ProfileID };
var entity = service.GetData<Hre_ProfilePartyUnionEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfilePartyUnionprofileId, UserLogin, ref status).FirstOrDefault();
var model1 = entity.CopyData<Hre_ProfilePartyUnionModel>();
model.ActionStatus = status;
return model1;
}
示例4: GetMultiProfileApprove
/// <summary> Load Profile la nguoi phê duyệt </summary>
/// <param name="text"></param>
/// <returns></returns>
public JsonResult GetMultiProfileApprove(string text)
{
string status = string.Empty;
var service = new Hre_ProfileServices();
var get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_ApproveProfile_multi, UserLogin, ref status);
var result = get.Select(item => new Hre_ProfileMultiModel()
{
ID = item.ID,
ProfileName = item.ProfileName,
});
return Json(result, JsonRequestBehavior.AllowGet);
}
示例5: Paysips
public ActionResult Paysips(string userLogin)
{
if (!CheckPermission()) return RedirectToAction("Denied", "Portal");
var id = Session[SessionObjects.ProfileID];
var service = new Hre_ProfileServices();
string status = string.Empty;
var listModel = service.GetData<Hre_ProfileModelPortal>(HRM.Infrastructure.Utilities.Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
if (listModel != null)
{
Session["ProfileName"] = listModel.ProfileName;
listModel.ActionStatus = status;
}
return GetOnlyView(listModel);
}
示例6: Post
public Ins_InsuranceSalaryPaybackModel Post([Bind]Ins_InsuranceSalaryPaybackModel model)
{
var hrService = new Hre_ProfileServices();
var baseService = new BaseService();
string status = string.Empty;
#region Validate
string message = string.Empty;
var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Ins_InsuranceSalaryPaybackModel>(model, "Ins_InsuranceSalaryPayback", ref message);
if (!checkValidate)
{
model.ActionStatus = message;
return model;
}
#endregion
ActionService service = new ActionService(UserLogin);
return service.UpdateOrCreate<Ins_InsuranceSalaryPaybackEntity, Ins_InsuranceSalaryPaybackModel>(model);
}
示例7: GetMultiProfileOrQuit
public JsonResult GetMultiProfileOrQuit(string text,bool isProfileQuit)
{
//hrm_hr_sp_get_ProfileQuit_multi
string status = string.Empty;
var service = new Hre_ProfileServices();
var get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_Profile_multi, UserLogin, ref status);
if (isProfileQuit)
{
get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_ProfileQuit_multi, UserLogin, ref status);
}
if (get != null)
{
var result = get.Select(item => new Hre_ProfileMultiModel()
{
ID = item.ID,
ProfileName = item.ProfileName,
});
return Json(result, JsonRequestBehavior.AllowGet);
}
return Json(null);
}
示例8: GetById
/// <summary>
/// [Chuc.Nguyen] - Lấy dữ liệu Nhân Viên (Hre_Profile) theo Id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public Hre_ProfileModel GetById(Guid id)
{
var service = new Hre_ProfileServices();
string status = string.Empty;
var entity = service.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
//xu ly tam de lay ten loai nghi viec vi hien tai left join nhiu qa trong store khong chay dc
if (entity.TypeOfStopID != null)
{
var catservice = new Cat_NameEntityServices();
var entityNameEntity = catservice.GetData<Cat_NameEntityEntity>(Common.DotNetToOracle(entity.TypeOfStopID.ToString()), ConstantSql.hrm_cat_sp_get_NameEntityById, UserLogin, ref status).FirstOrDefault();
if (entityNameEntity != null)
{
entity.TypeOfStopName = entityNameEntity.NameEntityName;
}
}
var model = entity.CopyData<Hre_ProfileModel>();
if (model != null && model.DateOfEffect != null)
{
model.DateOfEffectOld = model.DateOfEffect;
}
model.ActionStatus = status;
return model;
}
示例9: SummaryEvalutionData
public List<Eva_EvalutionDataEntity> SummaryEvalutionData(int year, Guid? _TimesGetDataID, string orgStructureID, DateTime? _daystart, DateTime? _dayend,string userLogin)
{
using (var context = new VnrHrmDataContext())
{
// #region Get Data
string status = string.Empty;
List<Eva_EvalutionDataEntity> lstEvalutionDataEntity = new List<Eva_EvalutionDataEntity>();
// //ds nv
var hrService = new Hre_ProfileServices();
var service = new BaseService();
List<object> strOrgIDs = new List<object>();
strOrgIDs.AddRange(new object[1]);
strOrgIDs[0] = (object)orgStructureID;
var lstProfile = hrService.GetData<Hre_ProfileEntity>(strOrgIDs, ConstantSql.hrm_eva_sp_getdata_ProfileByOrg, userLogin, ref status).ToList();
if (lstProfile == null || lstProfile.Count == 0)
return lstEvalutionDataEntity;
List<Guid> lstProfileIDs = lstProfile.Select(s => s.ID).ToList();
IUnitOfWork unitOfWork = new UnitOfWork(context);
var lstattattendancetable = new List<Att_AttendanceTable>().Select(d => new
{
d.LateEarlyDeductionHours,
d.ProfileID
}).ToList();
foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
{
lstattattendancetable.AddRange(unitOfWork.CreateQueryable<Att_AttendanceTable>(Guid.Empty,
d => lstProfileID.Contains(d.ProfileID) && d.MonthYear >= _daystart
&& d.MonthYear <= _dayend).Select(d => new
{
d.LateEarlyDeductionHours,
d.ProfileID
}).ToList());
}
#region Lay cau hinh luu vao cot C1->C16
Sys_AttOvertimePermitConfigServices sysServices = new Sys_AttOvertimePermitConfigServices();
string DataC1 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C1);
string DataC2 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C2);
string DataC3 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C3);
string DataC4 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C4);
string DataC5 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C5);
string DataC6 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C6);
string DataC7 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C7);
string DataC8 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C8);
string DataC9 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C9);
string DataC10 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C10);
string DataC11 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C11);
string DataC12 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C12);
string DataC13 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C13);
string DataC14 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C14);
string DataC15 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C15);
string DataC16 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C16);
#endregion
string[] lstDataC1 = null;
string[] lstDataC2 = null;
string[] lstDataC3 = null;
string[] lstDataC4 = null;
string[] lstDataC5 = null;
string[] lstDataC6 = null;
string[] lstDataC7 = null;
string[] lstDataC8 = null;
List<Cat_LeaveDayTypeEntity> templstleavedaytypeC1 = null;
List<Cat_LeaveDayTypeEntity> templstleavedaytypeC2 = null;
List<Cat_LeaveDayTypeEntity> templstleavedaytypeC3 = null;
List<Cat_LeaveDayTypeEntity> templstleavedaytypeC4 = null;
List<Cat_LeaveDayTypeEntity> templstleavedaytypeC5 = null;
List<Cat_LeaveDayTypeEntity> templstleavedaytypeC6 = null;
List<Cat_LeaveDayTypeEntity> templstleavedaytypeC7 = null;
List<Cat_LeaveDayTypeEntity> templstleavedaytypeC8 = null;
List<object> tempobjparam = new List<object>();
tempobjparam.Add(orgStructureID);
var tempcatService = new Cat_LeaveDayTypeServices();
var templstcatLeaveDayType = tempcatService.GetData<Cat_LeaveDayTypeEntity>(tempobjparam, ConstantSql.hrm_cat_getdata_LeaveDayType, userLogin, ref status).ToList();
if (templstcatLeaveDayType.Count > 0)
{
#region Loai Nghi
#region C1
if (DataC1 != null)
{
DataC1 = DataC1.Replace(" ", "").Trim();
lstDataC1 = DataC1.Split(',').ToArray();
if (lstDataC1 != null && lstDataC1.Count() > 0)
{
templstleavedaytypeC1 = templstcatLeaveDayType.Where(s => lstDataC1.Contains(s.Code)).ToList();
}
}
#endregion
#region C2
if (DataC2 != null)
{
DataC2 = DataC2.Replace(" ", "").Trim();
lstDataC2 = DataC2.Split(',').ToArray();
if (lstDataC2 != null && lstDataC2.Count() > 0)
{
templstleavedaytypeC2 = templstcatLeaveDayType.Where(s => lstDataC2.Contains(s.Code)).ToList();
//.........这里部分代码省略.........
示例10: Post
public Sal_InsuranceSalaryModel Post([Bind]Sal_InsuranceSalaryModel model)
{
#region Validate
ActionService service = new ActionService(UserLogin);
string message = string.Empty;
bool checkValidate = true;
if (model.IsCreateByProfile != null && model.IsCreateByProfile == true)
{
checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalaryByProfile", ref message);
if (!checkValidate)
{
model.ActionStatus = message;
return model;
}
return service.UpdateOrCreate<Sal_InsuranceSalaryEntity, Sal_InsuranceSalaryModel>(model);
}
//var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalary", ref message);
if (model.OrgStructureID != null && model.OrgStructureID != string.Empty)
{
checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalaryOrgStructure", ref message);
}
else
{
checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalary", ref message);
}
if (!checkValidate)
{
model.ActionStatus = message;
return model;
}
#endregion
string status = string.Empty;
var hrService = new Hre_ProfileServices();
var insuranceServices = new Sal_InsuranceSalaryServices();
if (!string.IsNullOrEmpty(model.OrgStructureID))
{
List<Guid> listGuid = new List<Guid>();
if (model.ProfileIDsExclude != null)
{
var listStr = model.ProfileIDsExclude.Split(',');
if (listStr[0] != "")
{
foreach (var item in listStr)
{
listGuid.Add(Guid.Parse(item));
}
}
}
List<object> listObj = new List<object>();
listObj.Add(model.OrgStructureID);
listObj.Add(string.Empty);
listObj.Add(string.Empty);
var lstProfile = hrService.GetData<Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, userLogin, ref status).Select(s => s.ID).ToList();
if (listGuid != null)
{
lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
}
if (lstProfile.Count == 0 && model.ProfileID == Guid.Empty)
{
model.ActionStatus = ConstantDisplay.HRM_Common_NotEmployee.TranslateString();
return model;
}
List<Sal_InsuranceSalaryEntity> lstGradeEntity = new List<Sal_InsuranceSalaryEntity>();
foreach (var item in lstProfile)
{
Sal_InsuranceSalaryEntity gradeEntity = new Sal_InsuranceSalaryEntity
{
ProfileID = item,
DateCreate = model.DateCreate,
DateLock = model.DateLock,
CurrencyID = model.CurrencyID,
InsuranceAmount = model.InsuranceAmount,
ID = model.ID,
DateEffect = model.DateEffect,
IsSocialIns = model.IsSocialIns,
IsMedicalIns = model.IsMedicalIns,
IsUnimploymentIns = model.IsUnimploymentIns,
IsDelete = model.IsDelete,
UserUpdate = model.UserCreate,
UserCreate = model.UserCreate,
DecisionNo = model.DecisionNo
};
//model.ActionStatus = gradeServices.Add(gradeEntity);
lstGradeEntity.Add(gradeEntity);
}
model.ActionStatus = insuranceServices.Add(lstGradeEntity);
return model;
}
if (!string.IsNullOrEmpty(model.ProfileIDs))
//.........这里部分代码省略.........
示例11: GetReportDetailCard
public ActionResult GetReportDetailCard([DataSourceRequest] DataSourceRequest request, Can_ReportDetailCardSearchModel Model)
{
var service = new Can_ReportServices();
var hrService = new Hre_ProfileServices();
ListQueryModel lstModel = new ListQueryModel
{
PageIndex = request.Page,
PageSize = request.PageSize,
Filters = ExtractFilterAttributes(request),
Sorts = ExtractSortAttributes(request)
};
DateTime From = SqlDateTime.MinValue.Value;
DateTime To = SqlDateTime.MaxValue.Value;
if (Model.DateFrom != null)
{
From = Model.DateFrom.Value;
}
if (Model.DateTo != null)
{
To = Model.DateTo.Value;
}
if (Model.CanteenID != null) Model.CanteenIDs.Add(Model.CanteenID);
if (Model.CateringID != null) Model.CateringIDs.Add(Model.CateringID);
if (Model.LineID != null) Model.LineIDs.Add(Model.LineID);
var result = service.ReportDetailCard(Model.CateringIDs, Model.CanteenIDs, Model.LineIDs, From, To, Model.OrgStructureID);
var rs = result.Translate<Can_ReportDetailCardModel>();
#region xử lý xuất báo cáo
if (Model.ExportID != Guid.Empty)
{
var fullPath = ExportService.Export(Model.ExportID, rs);
return Json(fullPath);
}
#endregion
request.Page = 1;
var dataSourceResult = result.ToDataSourceResult(request);
return Json(rs.ToDataSourceResult(request));
}
示例12: GetReportAdjustmentMealAllowancePayment
public ActionResult GetReportAdjustmentMealAllowancePayment([DataSourceRequest] DataSourceRequest request, Can_ReportAdjustmentMealAllowancePaymentModel Model)
{
var service = new Can_ReportServices();
var hrService = new Hre_ProfileServices();
var Actionservices = new ActionService(UserLogin);
ListQueryModel lstModel = new ListQueryModel
{
PageIndex = request.Page,
PageSize = request.PageSize,
Filters = ExtractFilterAttributes(request),
Sorts = ExtractSortAttributes(request)
};
DateTime From = SqlDateTime.MinValue.Value;
DateTime To = SqlDateTime.MaxValue.Value;
if (Model.DateFrom != null)
{
From = Model.DateFrom.Value;
}
if (Model.DateTo != null)
{
To = Model.DateTo.Value;
}
List<Guid?> OrgIds = new List<Guid?>();
if (Model.OrgStructureID != null && Model.OrgStructureID.Count() > 0)
{
OrgIds = Model.OrgStructureID;
}
string strOrgIDs = Common.ListToString(OrgIds);
string profileName = string.Empty;
string codeEmp = string.Empty;
if (Model.ProfileName != string.Empty)
{
profileName = Model.ProfileName;
}
if (Model.CodeEmp != string.Empty)
{
codeEmp = Model.CodeEmp;
}
List<Guid> lstProfileIDs = new List<Guid>();
List<Object> Lstsearch = new List<object>();
Lstsearch.Add(strOrgIDs);
Lstsearch.Add(profileName);
Lstsearch.Add(codeEmp);
if (Model.OrgStructureID != null)
{
string status = string.Empty;
lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(Lstsearch, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();
}
var result = service.ReportAdjustmentMealAllowancePayment(From, To, lstProfileIDs);
if (Model.ExportID != Guid.Empty)
{
var fullPath = ExportService.Export(Model.ExportID, result);
return Json(fullPath);
}
return Json(result.ToDataSourceResult(request));
}
示例13: GetMealRecordMissingList
public ActionResult GetMealRecordMissingList([DataSourceRequest] DataSourceRequest request, Can_MealRecordMissingSearchModel model)
{
var service = new Can_MealRecordMissingServices();
var hrService = new Hre_ProfileServices();
DateTime DateFrom = SqlDateTime.MinValue.Value;
DateTime DateTo = SqlDateTime.MaxValue.Value;
if (model.DateFrom != null)
{
DateFrom = model.DateFrom.Value;
}
if (model.DateTo != null)
{
DateTo = model.DateTo.Value;
}
//string strOrgIDs = Common.ListToString(model.OrgStructureID);
#region xử lý lấy lstProfileIds theo OrgStructureID
List<Guid> lstProfileIDs = new List<Guid>();
string status = string.Empty;
List<object> lstObj = new List<object>();
//lstObj.Add(strOrgIDs);
lstObj.Add(model.OrgStructureID);
lstObj.Add(null);
lstObj.Add(null);
List<Guid> _temp = new List<Guid>();
List<Guid> _profileIDs = new List<Guid>();
var baseService = new ActionService(UserLogin);
if (model.ProfileIDSearch != null)
{
var lst = model.ProfileIDSearch.Split(',');
_temp = lst.Select(Guid.Parse).ToList();
if (model.OrgStructureID != null)
{
lstProfileIDs = baseService.GetData<Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
_profileIDs = lstProfileIDs.Where(m => !_temp.Contains(m)).ToList();
lstProfileIDs.AddRange(_profileIDs);
}
else
{
lstProfileIDs = _temp;
}
}
else
{
lstProfileIDs = baseService.GetData<Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
}
#endregion
// var result = service.GetAllUseEntity<Can_MealRecordMissingEntity>(ref status);
service.ComputeMealRecordMissing(lstProfileIDs,
DateFrom,
DateTo,
model.TamScanReasonMissID,
model.Status,
model.MealAllowanceTypeSettingID);
return Json(true);
}
示例14: Post
public Tra_RequirementTrainModel Post([Bind]Tra_RequirementTrainModel model)
{
#region Validate
if(model.isAnalysis==true)
{
string message = string.Empty;
var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Tra_RequirementTrainModel>(model,"Tra_RequirementTrain_Tab", "Tra_RequirementTrain", ref message);
if (!checkValidate)
{
model.ActionStatus = message;
return model;
}
}
#endregion
var requirementDetailServices = new Tra_RequirementTrainDetailServices();
var profileServices = new Hre_ProfileServices();
string[] arrCodeEmp = new string[1];
if (!string.IsNullOrEmpty(model.lstCodeEmp) && model.lstCodeEmp.IndexOf(',') > 1)
{
arrCodeEmp = model.lstCodeEmp.Split(',').ToArray();
}
else {
arrCodeEmp[0] = model.lstCodeEmp;
}
ActionService service = new ActionService(UserLogin);
string status = string.Empty;
//var objProfile = new List<object>();
//objProfile.AddRange(new object[17]);
//objProfile[15] = 1;
//objProfile[16] = int.MaxValue - 1;
//var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileAll, UserLogin, ref status).ToList().Translate<Hre_ProfileModel>();
//if (arrCodeEmp != null)
//{
// lstProfile = lstProfile.Where(s => arrCodeEmp.Contains(s.CodeEmp)).ToList();
//}
var lstProfile = profileServices.GetData<Hre_ProfileEntity>(model.lstCodeEmp, ConstantSql.hrm_hr_sp_get_ProfileAllByCodeEmps, UserLogin, ref status).ToList().Translate<Hre_ProfileModel>();
model = service.UpdateOrCreate<Tra_RequirementTrainEntity, Tra_RequirementTrainModel>(model);
var objRequirementDetail = new List<object>();
objRequirementDetail.Add(null);
objRequirementDetail.Add(1);
objRequirementDetail.Add(int.MaxValue -1);
var lstRequirementDetail = requirementDetailServices.GetData<Tra_RequirementTrainDetailEntity>(objRequirementDetail,ConstantSql.hrm_tra_sp_get_RequirementDetail,UserLogin,ref status).ToList();
foreach (var item in lstProfile)
{
var entity = lstRequirementDetail.Where(s => s.ProfileID == item.ID && s.RequirementTrainID == model.ID && s.CourseID == model.CourseID).FirstOrDefault();
var requirementDetailEntity = new Tra_RequirementTrainDetailEntity();
requirementDetailEntity.ProfileID = item.ID;
requirementDetailEntity.RequirementTrainID = model.ID;
requirementDetailEntity.CourseID = model.CourseID;
requirementDetailEntity.YearAnalyze = model.DateSeniority;
if (item.DateHire != null && model.DateSeniority != null)
{
requirementDetailEntity.Seniority = Math.Floor(model.DateSeniority.Value.Subtract(item.DateHire.Value).TotalDays/30);
}
if (entity == null)
{
model.ActionStatus = requirementDetailServices.Add(requirementDetailEntity);
}
}
return model;
//return service.UpdateOrCreate<Tra_RequirementTrainEntity, Tra_RequirementTrainModel>(model);
}
示例15: GetReportRecieveObjectByTime
public DataTable GetReportRecieveObjectByTime(string orgStructureIDs, DateTime dateFrom, DateTime dateTo, bool IsCreateTemplate, string userLogin)
{
DataTable table = GetSchemaReportRecieveObjectByTime(userLogin);
if (IsCreateTemplate)
{
return table.ConfigTable();
}
string status = string.Empty;
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var basevices = new BaseService();
var hdtJobServices = new Hre_HDTJobServices();
List<object> listObjHDTJob = new List<object>();
listObjHDTJob.AddRange(new object[14]);
listObjHDTJob[5] = orgStructureIDs;
listObjHDTJob[6] = dateFrom;
listObjHDTJob[7] = dateTo;
listObjHDTJob[12] = 1;
listObjHDTJob[13] = Int32.MaxValue - 1;
var lstHDTJob = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_RptRecieveObjectByTime, userLogin, ref status).ToList();
if (lstHDTJob.Count == 0)
{
return table;
}
var lstProfileIDByHDTJob = lstHDTJob.Select(s => s.ProfileID).Distinct().ToList();
#region Lấy WorkDay
var workDayRepository = new Att_WorkDayRepository(unitOfWork);
var lstworkDays = new List<Att_Workday>().Select(d => new
{
d.ProfileID,
d.WorkDate,
d.FirstInTime,
d.LastOutTime
}).ToList();
foreach (var item in lstProfileIDByHDTJob.Chunk(1000))
{
lstworkDays.AddRange(workDayRepository.FindBy(s => s.IsDelete == null && s.WorkDate >= dateFrom
&& s.WorkDate <= dateTo && item.Contains(s.ProfileID)).Select(d => new
{
d.ProfileID,
d.WorkDate,
d.FirstInTime,
d.LastOutTime
}).ToList());
}
if (lstworkDays.Count == 0)
{
return table;
}
#endregion
#region Lấy MealRecord
var mealRecordRepository = new Can_MealRecordRepository(unitOfWork);
var lstmeadrecored = new List<Can_MealRecord>().Select(d => new
{
d.ProfileID,
d.WorkDay,
d.Amount
}).ToList();
foreach (var item in lstProfileIDByHDTJob.Chunk(1000))
{
lstmeadrecored.AddRange(mealRecordRepository.FindBy(s => s.IsDelete == null && s.WorkDay >= dateFrom
&& s.WorkDay <= dateTo && item.Contains(s.ProfileID)).Select(d => new
{
d.ProfileID,
d.WorkDay,
d.Amount
}).ToList());
}
#endregion
List<object> listObjPrice = new List<object>();
listObjPrice.Add(null);
listObjPrice.Add(null);
listObjPrice.Add(null);
listObjPrice.Add(1);
listObjPrice.Add(Int32.MaxValue - 1);
var lstHDTJobTypePrice = basevices.GetData<Cat_HDTJobTypePriceEntity>(listObjPrice, ConstantSql.hrm_cat_sp_get_HDTJobTypePrice, userLogin, ref status).Where(s => s.Price != null).Distinct().ToList();
var profileServices = new Hre_ProfileServices();
var listResult = profileServices.getHDTJobByPrice(lstHDTJob, dateFrom, dateTo);
var ListProfileID = listResult.Select(m => m.ProfileID).Distinct().ToList();
foreach (var profileID in ListProfileID)
{
var firstProfile = listResult.Where(m => m.ProfileID == profileID).FirstOrDefault();
var lstWorkDaysByProfile = lstworkDays.Where(m => m.ProfileID == profileID && (m.FirstInTime != null || m.LastOutTime != null)).ToList();
var lstmeadlbypro = lstmeadrecored.Where(s => s.ProfileID == profileID).ToList();
if (firstProfile != null && lstWorkDaysByProfile.Count != 0)
{
bool isAdd = false;
DataRow row = table.NewRow();
row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.ProfileName] = firstProfile.ProfileName;
row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.CodeEmp] = firstProfile.CodeEmp;
//.........这里部分代码省略.........