本文整理汇总了C#中CustomBaseRepository.GetById方法的典型用法代码示例。如果您正苦于以下问题:C# CustomBaseRepository.GetById方法的具体用法?C# CustomBaseRepository.GetById怎么用?C# CustomBaseRepository.GetById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomBaseRepository
的用法示例。
在下文中一共展示了CustomBaseRepository.GetById方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProfileIDByTravelRequests
public Guid GetProfileIDByTravelRequests(Guid TravelRequestID)
{
Guid rs = Guid.Empty;
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoTravelRequest = new CustomBaseRepository<FIN_TravelRequest>(unitOfWork);
var TravelRequest = repoTravelRequest.GetById(TravelRequestID);
rs = TravelRequest.ProfileID.Value;
}
return rs;
}
示例2: CheckLeader
public bool CheckLeader(Guid LeaderID, Guid ProfileID)
{
bool rs = false;
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoProfile = new CustomBaseRepository<Hre_Profile>(unitOfWork);
var Profile = repoProfile.GetById(ProfileID);
if (Profile.SupervisorID == LeaderID || Profile.HighSupervisorID == LeaderID)
rs = true;
}
return rs;
}
示例3: ComputeDepartment
public void ComputeDepartment(Guid departmentID)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (UnitOfWork)(new UnitOfWork(context));
var repoSal_SalaryDepartment = new CustomBaseRepository<Sal_SalaryDepartment>(unitOfWork);
var repoSal_SalaryDepartmentItem = new CustomBaseRepository<Sal_SalaryDepartmentItem>(unitOfWork);
var repoAtt_CutOffDuration = new CustomBaseRepository<Att_CutOffDurationEntity>(unitOfWork);
Sal_SalaryDepartment item = new Sal_SalaryDepartment();
item = repoSal_SalaryDepartment.GetById(departmentID);
//xóa các item nếu đã tính trước đó
List<Sal_SalaryDepartmentItem> listDepartmentItem = new List<Sal_SalaryDepartmentItem>();
listDepartmentItem = repoSal_SalaryDepartmentItem.GetAll().Where(m => m.SalaryDepartmentID == departmentID).ToList();
repoSal_SalaryDepartmentItem.Delete(listDepartmentItem);
unitOfWork.SaveChanges();
//nếu chọn theo cutoff thì lấy datefrom dateto của cutoff
if (item.CutOffDurationID != null)
{
var cutoff= repoAtt_CutOffDuration.GetById((Guid)item.CutOffDurationID);
item.MonthYear = cutoff.MonthYear;
item.DateFrom = cutoff.DateStart;
item.DateTo = cutoff.DateEnd;
}
Hashtable hasTable = new Hashtable();
List<Sal_SalaryDepartment> listSalaryDepartment = new List<Sal_SalaryDepartment>();
listSalaryDepartment.Add(item);
ComputeSalaryDepartment(item.MonthYear, (DateTime)item.DateFrom, (DateTime)item.DateTo, listSalaryDepartment, ref hasTable);
}
}
示例4: Set_RejectRoster_ByModuleApprove
public string Set_RejectRoster_ByModuleApprove(string host, List<Guid> lstRoster, Guid UserLoginID, string userLogin)
{
using (var context = new VnrHrmDataContext())
{
string status = string.Empty;
string statusSendMail = DataErrorCode.Error.ToString();
BaseService service = new BaseService();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoAtt_Roster = new CustomBaseRepository<Att_Roster>(unitOfWork);
#region getdata
List<object> lstParamUser = new List<object>();
lstParamUser.AddRange(new object[4]);
lstParamUser[3] = Int32.MaxValue;
var lstUserAll = service.GetData<Sys_UserInfo>(lstParamUser, ConstantSql.hrm_sys_sp_get_users, userLogin, ref status);
var lstUser = lstUserAll.Where(m => !string.IsNullOrEmpty(m.Email)).Select(m => new { m.ID, m.Email }).ToList();
#endregion
#region process
string E_REJECTED = RosterStatus.E_REJECTED.ToString();
List<Att_Roster> lstRosterSendMail = new List<Att_Roster>();
foreach (var rosID in lstRoster)
{
var Roster = repoAtt_Roster.GetById(rosID);
lstRosterSendMail.Add(Roster);
Roster.Status = E_REJECTED;
}
var stt = repoAtt_Roster.SaveChanges();
#endregion
if (stt == DataErrorCode.Success)
{
#region getdata
List<Hre_ProfileEntity> lstProfile = new List<Hre_ProfileEntity>();
List<Sys_TemplateSendMail> template = new List<Sys_TemplateSendMail>();
Sys_TemplateSendMail tempApprove = new Sys_TemplateSendMail();
Sys_TemplateSendMail tempReturn = new Sys_TemplateSendMail();
string[] strsParaKey = null;
string bodyContent = null;
string titleMail = null;
string[] strsParaValues = null;
string[] strsParaValues_Return = null;
string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_ROSTER.ToString();
string _typeTemplate_return = EnumDropDown.EmailType.E_APPROVED_ROSTER_RETURN.ToString();
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate || s.Type == _typeTemplate_return).ToList();
if (template.Count < 2)
return DataErrorCode.Error_NoTemplateMail.ToString();
tempApprove = template.Where(s => s.Type == _typeTemplate).FirstOrDefault();
tempReturn = template.Where(s => s.Type == _typeTemplate_return).FirstOrDefault();
string proIDS = string.Join(",", lstRosterSendMail.Select(s => s.ProfileID.ToString()).Distinct().ToList());
proIDS = Common.DotNetToOracle(proIDS);
lstProfile = GetData<Hre_ProfileEntity>(proIDS, ConstantSql.hrm_hr_sp_get_ProfileByIds, userLogin, ref status);
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_ROSTER.E_UserName.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_ProfileName.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_CodeEmp.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_DateStart.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_DateEnd.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_Status.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_Type.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_LinkContent.ToString(),
};
#endregion
foreach (var Roster in lstRosterSendMail)
{
List<Guid> lstDelegateApproveUserID = new List<Guid>();
var UserRegister = lstUserAll.Where(m => m.ProfileID == Roster.ProfileID).FirstOrDefault();
if (UserRegister != null)
{
lstDelegateApproveUserID.Add(UserRegister.ID);
}
lstDelegateApproveUserID = lstDelegateApproveUserID.Distinct().ToList();
var lstUserInfoCanView = lstUser.Where(m => lstDelegateApproveUserID.Contains(m.ID)).ToList();
List<Att_EmailRequireEntity> lstEmailRequire = new List<Att_EmailRequireEntity>();
foreach (var UserInfoCanView in lstUserInfoCanView)
{
if (UserInfoCanView.Email == null)
continue;
Att_EmailRequireEntity EmailRequireEntity = new Att_EmailRequireEntity();
EmailRequireEntity.IdObject = Roster.ID;
EmailRequireEntity.EmailUserApprove = UserInfoCanView.Email;
EmailRequireEntity.IdUserApprove = UserInfoCanView.ID;
if (UserRegister != null && UserInfoCanView.ID == UserRegister.ID)
{
EmailRequireEntity.IsRegister = true;
//.........这里部分代码省略.........
示例5: Set_ApproveLeaveDay_ByModuleApprove
public string Set_ApproveLeaveDay_ByModuleApprove(string host, List<Guid> lstLeaveDay, Guid UserLoginID, string userLogin)
{
using (var context = new VnrHrmDataContext())
{
string status = string.Empty;
string statusSendMail = DataErrorCode.Error.ToString();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
BaseService service = new BaseService();
var repoAtt_LeaveDay = new CustomBaseRepository<Att_LeaveDay>(unitOfWork);
#region getdata
List<object> lstParamUser = new List<object>();
lstParamUser.AddRange(new object[4]);
lstParamUser[3] = Int32.MaxValue;
var lstUserAll = service.GetData<Sys_UserInfo>(lstParamUser, ConstantSql.hrm_sys_sp_get_users, userLogin, ref status);
var lstUser = lstUserAll.Where(m => !string.IsNullOrEmpty(m.Email)).Select(m => new { m.ID, m.Email }).ToList();
//Step1 : Check 1 Approve or 2 approve
DateTime today = DateTime.Today;
string E_LEAVEDAY = DelegateApproveType.E_LEAVE_DAY.ToString();
List<object> lstParam = new List<object>();
lstParam.AddRange(new object[10]);
var lstDelegateApproveAll = service.GetData<Sys_DelegateApprove>(lstParam, ConstantSql.hrm_sys_sp_get_DelegateApprove, userLogin, ref status);
var lstDelegateApprove = lstDelegateApproveAll.Where(m => m.UserID != null
&& m.UserDelegateID != null
&& m.DataTypeDelegate == E_LEAVEDAY
&& m.DateFrom <= today
&& m.DateTo >= today).ToList();
List<Guid> lstUserCanView = lstDelegateApprove.Where(m => m.UserDelegateID == UserLoginID).Select(m => m.UserID.Value).ToList();
lstUserCanView.Add(UserLoginID);
#endregion
#region process
string E_APPROVED = LeaveDayStatus.E_APPROVED.ToString();
string E_FIRST_APPROVED = LeaveDayStatus.E_FIRST_APPROVED.ToString();
List<Att_LeaveDay> lstLeaveDaySendMail = new List<Att_LeaveDay>();
foreach (var leaID in lstLeaveDay)
{
var LeaveDay = repoAtt_LeaveDay.GetById(leaID);
lstLeaveDaySendMail.Add(LeaveDay);
if (LeaveDay.UserApproveID2 != null && lstUserCanView.Contains(LeaveDay.UserApproveID2.Value))
{
LeaveDay.Status = E_APPROVED;
}
if (LeaveDay.UserApproveID != null && lstUserCanView.Contains(LeaveDay.UserApproveID.Value))
{
LeaveDay.Status = E_FIRST_APPROVED;
}
}
var stt = repoAtt_LeaveDay.SaveChanges();
#endregion
if (stt == DataErrorCode.Success)
{
#region getdata
List<Hre_ProfileEntity> lstProfile = new List<Hre_ProfileEntity>();
List<Sys_TemplateSendMail> template = new List<Sys_TemplateSendMail>();
Sys_TemplateSendMail tempApprove = new Sys_TemplateSendMail();
Sys_TemplateSendMail tempReturn = new Sys_TemplateSendMail();
List<Cat_LeaveDayType> lstLeaveDayType = new List<Cat_LeaveDayType>();
string[] strsParaKey = null;
string bodyContent = null;
string titleMail = null;
string[] strsParaValues = null;
string[] strsParaValues_Return = null;
string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_LEAVEDAY.ToString();
string _typeTemplate_return = EnumDropDown.EmailType.E_APPROVED_LEAVEDAY_RETURN.ToString();
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate || s.Type == _typeTemplate_return).ToList();
if (template.Count < 2)
return DataErrorCode.Error_NoTemplateMail.ToString();
var repoCat_LeaveDayType = new CustomBaseRepository<Cat_LeaveDayType>(unitOfWork);
lstLeaveDayType = repoCat_LeaveDayType.FindBy(s => s.IsDelete == null).ToList();
tempApprove = template.Where(s => s.Type == _typeTemplate).FirstOrDefault();
tempReturn = template.Where(s => s.Type == _typeTemplate_return).FirstOrDefault();
string proIDS = string.Join(",", lstLeaveDaySendMail.Select(s => s.ProfileID.ToString()).Distinct().ToList());
proIDS = Common.DotNetToOracle(proIDS);
lstProfile = GetData<Hre_ProfileEntity>(proIDS, ConstantSql.hrm_hr_sp_get_ProfileByIds, userLogin, ref status);
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_UserName.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_ProfileName.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_CodeEmp.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_DateStart.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_DateEnd.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_Status.ToString(),
//.........这里部分代码省略.........
示例6: ReportAmountOTandUnpadLeave
//.........这里部分代码省略.........
if (!lstProfile.Any(m => m.ID == profile.ID))
{
lstProfile.Add(profile);
}
}
}
#endregion
//string status = string.Empty;
//List<object> listModel = new List<object>();
//listModel = new List<object>();
//listModel.AddRange(new object[16]);
//listModel[2] = lstOrgstructureID;
//listModel[14] = 1;
//listModel[15] = Int32.MaxValue - 1;
//List<Hre_ProfileEntity> lstProfile = GetData<Hre_ProfileEntity>(listModel, ConstantSql.hrm_hr_sp_get_Profile, UserLogin,ref status);
if (workingPlaceID != null)
{
lstProfile = lstProfile.Where(s => s.WorkPlaceID != null && workingPlaceID.Value == s.WorkPlaceID).ToList();
}
if (!string.IsNullOrEmpty(statusSyn))
{
lstProfile = lstProfile.Where(s => s.StatusSyn != null && s.StatusSyn == statusSyn).ToList();
}
var lstProfileID = lstProfile.Select(hr => hr.ID).ToList();
//kỳ lương
if (cutOffDurationID != Guid.Empty)
{
var cutoff = reposAttCutoffDuration.GetById(cutOffDurationID);
if (cutoff != null)
{
monthyear = cutoff.MonthYear;
from = cutoff.DateStart;
to = cutoff.DateEnd;
}
}
//Bảng lương
string statusTb = string.Empty;
List<object> listModelprtb = new List<object>();
listModelprtb = new List<object>();
listModelprtb.AddRange(new object[6]);
listModelprtb[2] = from;
listModelprtb[3] = to;
listModelprtb[4] = 1;
listModelprtb[5] = Int32.MaxValue - 1;
List<Sal_PayrollTableEntity> lstPayrollTable = GetData<Sal_PayrollTableEntity>(listModelprtb, ConstantSql.hrm_sal_sp_get_PayrollTable, UserLogin, ref statusTb);
string statusTbit = string.Empty;
List<object> listModelprtbit = new List<object>();
listModelprtbit = new List<object>();
listModelprtbit.AddRange(new object[9]);
listModelprtbit[2] = from;
listModelprtbit[3] = to;
listModelprtbit[7] = 1;
listModelprtbit[8] = Int32.MaxValue - 1;
List<Sal_PayrollTableItemEntity> lstPayrollTableItem = GetData<Sal_PayrollTableItemEntity>(listModelprtbit, ConstantSql.hrm_sal_sp_get_PayrollTableItem, UserLogin, ref statusTbit);
lstPayrollTableItem = lstPayrollTableItem.Where(it => it.Value != null && it.Value != string.Empty).ToList();
//Ds phòng ban
var lstOrgStructure = reposOrgStructure.GetAll().Where(org => org.IsDelete == null).Select(org => new { org.ID, org.Code, org.OrgStructureName }).ToList();
示例7: ComputeBonusUnusualAllowance_Progress
public void ComputeBonusUnusualAllowance_Progress(Guid AsynTaskID, Sal_UnusualAllowanceEntity model, bool AllowanceEvaluationYear = false)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)new UnitOfWork(context);
var repoSys_AsynTask = new CustomBaseRepository<Sys_AsynTask>(unitOfWork);
var repoCat_Element = new CustomBaseRepository<Cat_Element>(unitOfWork);
var repoCat_UnusualAllowanceCfg = new CustomBaseRepository<Cat_UnusualAllowanceCfg>(unitOfWork);
var repoUnusualAllowance = new CustomBaseRepository<Sal_UnusualAllowance>(unitOfWork);
Sys_AsynTask asynTask = repoSys_AsynTask.GetById(AsynTaskID);
Sal_ComputePayrollServices CumputePayrollServices = new Sal_ComputePayrollServices();
List<object> listModel = new List<object>();
string status = string.Empty;
Sal_ComputePayrollServices Services = new Sal_ComputePayrollServices();
List<Sal_UnusualAllowanceEntity> ListResult = new List<Sal_UnusualAllowanceEntity>();
List<ElementFormula> listElementFormula = new List<ElementFormula>();
Sal_UnusualAllowanceServices UnusualAllowanceServices = new Sal_UnusualAllowanceServices();
Att_CutOffDurationEntity CutOffDuration = new Att_CutOffDurationEntity();
if (model.MonthEnd != null)
{
CutOffDuration.MonthYear = model.MonthStart.Value;
CutOffDuration.DateStart = model.MonthStart.Value;
CutOffDuration.DateEnd = model.MonthEnd.Value;
}
else
{
CutOffDuration.MonthYear = new DateTime(model.MonthStart.Value.Year, model.MonthStart.Value.Month, 1);
CutOffDuration.DateStart = new DateTime(model.MonthStart.Value.Year, model.MonthStart.Value.Month, 1);
CutOffDuration.DateEnd = new DateTime(model.MonthStart.Value.Year, model.MonthStart.Value.Month, 1).AddMonths(1).AddDays(-1);
}
List<Hre_ProfileEntity> ListProfile = new List<Hre_ProfileEntity>();
if (model.OrgStructureIDs != null && model.OrgStructureIDs != string.Empty)
{
listModel = new List<object>();
listModel.AddRange(new object[18]);
listModel[2] = model.OrgStructureIDs;
listModel[16] = 1;
listModel[17] = Int32.MaxValue - 1;
ListProfile = GetData<Hre_ProfileEntity>(listModel, ConstantSql.hrm_hr_sp_get_Profile, ref status);
if (model.ExProfileIDs != null)
{
string[] ExProfile = model.ExProfileIDs.Split(',');
ListProfile = ListProfile.Where(m => ExProfile.Contains(m.ID.ToString())).ToList();
}
}
else if (model.ProfileIDs != null && model.ProfileIDs != string.Empty)
{
ListProfile = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(model.ProfileIDs), ConstantSql.hrm_hr_sp_get_ProfileByIds, ref status);
}
//lọc profile theo workplace
if (model.WorkingPlaceID != null)
{
string[] listWorkPlare = model.WorkingPlaceID.Split(',');
ListProfile = ListProfile.Where(m => listWorkPlare.Contains(m.WorkPlaceID.ToString())).ToList();
}
List<Cat_UnusualAllowanceCfg> listUnusualAllowanceCfg = new List<Cat_UnusualAllowanceCfg>();
listUnusualAllowanceCfg = repoCat_UnusualAllowanceCfg.FindBy(m => m.IsDelete != true).ToList();
#region Delete các phụ cấp trong năm đã có
List<Sal_UnusualAllowance> listUnusualAllowance = repoUnusualAllowance.FindBy(m => m.IsDelete != true && m.MonthStart != null && model.MonthStart != null && m.MonthStart.Value.Year == model.MonthStart.Value.Year && m.Status != WorkHistoryStatus.E_APPROVED.ToString()).ToList();
//nếu là tính phép năm sức khỏe tốt thì delete thêm loại GoodHealth
if (AllowanceEvaluationYear)
{
var _tmp = listUnusualAllowanceCfg.FirstOrDefault(m => m.Code == "GoodHealth");
listUnusualAllowance = listUnusualAllowance.Where(m => (m.UnusualEDTypeID == model.UnusualEDTypeID || m.UnusualEDTypeID == _tmp.ID) && ListProfile.Any(t => t.ID == m.ProfileID)).ToList();
}
else
{
listUnusualAllowance = listUnusualAllowance.Where(m => m.UnusualEDTypeID == model.UnusualEDTypeID && ListProfile.Any(t => t.ID == m.ProfileID)).ToList();
}
//update isdelete is true
listUnusualAllowance.ForEach(m => m.IsDelete = true);
#endregion
//Cat_ElementEntity ElementItem = repoCat_Element.GetById((Guid)model.Element).Copy<Cat_ElementEntity>();
Cat_ElementEntity ElementItem = repoCat_Element.FindBy(m => m.ID == (Guid)model.Element).FirstOrDefault().Copy<Cat_ElementEntity>();
ComputePayrollDataModel TotalData = Services.GetDataForComputeSalary(CutOffDuration);
List<Cat_ElementEntity> listElementAll = new List<Cat_ElementEntity>();
listElementAll = TotalData.listElement_All;
#region Xử lý cho tính phép năm, sức khỏe tốt
List<Cat_UnusualAllowanceCfg> ListUnusualAllowanceCfg = new List<Cat_UnusualAllowanceCfg>();
Cat_UnusualAllowanceCfg PaidLeave = null;
Cat_UnusualAllowanceCfg GoodHealth = null;
ElementFormula FormulaValue = new ElementFormula();
if (AllowanceEvaluationYear)
{
ListUnusualAllowanceCfg = repoCat_UnusualAllowanceCfg.FindBy(m => m.IsDelete != true).ToList();
//.........这里部分代码省略.........