本文整理汇总了C#中CustomBaseRepository.FindBy方法的典型用法代码示例。如果您正苦于以下问题:C# CustomBaseRepository.FindBy方法的具体用法?C# CustomBaseRepository.FindBy怎么用?C# CustomBaseRepository.FindBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomBaseRepository
的用法示例。
在下文中一共展示了CustomBaseRepository.FindBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClaimApprovedList
public List<FIN_ClaimEntity> GetClaimApprovedList(Guid UserLogin)
{
List<FIN_ClaimEntity> lstReturn = new List<FIN_ClaimEntity>();
string appType = ApproveType.E_FIN_ClaimRequest.ToString();
string status = string.Empty;
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoFIN_Claim = new CustomBaseRepository<FIN_Claim>(unitOfWork);
List<Sys_ConditionApproved> lstCondition = new List<Sys_ConditionApproved>();
List<Hre_ProfileEntity> lstProfile = new List<Hre_ProfileEntity>();
GetProfileWithPermissionLogin(UserLogin, appType, out lstCondition, out lstProfile);
var lstExpensesCondition = lstCondition.Select(s => s.ExpensesType).Distinct().ToList();
var dataClaim = repoFIN_Claim
.FindBy(s => s.IsDelete == null && lstExpensesCondition.Contains(s.ExpensesType))
.ToList().Translate<FIN_ClaimEntity>();
foreach (var condition in lstCondition)
{
List<Guid> lstGuidOrg = GetOrgInCondition(condition);
var profileInOrg = lstProfile.Where(s => lstGuidOrg.Contains(s.OrgStructureID.Value)).Select(a => a.ID).ToList();
var resultCondition = dataClaim.Where(s => profileInOrg.Contains(s.ProfileID.Value)).ToList();
lstReturn.AddRange(resultCondition);
}
}
return lstReturn;
}
示例2: getAllGrade2
public static List<Att_Grade> getAllGrade2(List<Guid> listProfileId, DateTime monthYear)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoAtt_Grade = new CustomBaseRepository<Att_Grade>(unitOfWork);
List<Att_Grade> lst = new List<Att_Grade>();
string[] strInclude = new string[] { "Cat_GradeAttendance" };
lst = repoAtt_Grade.FindBy(gd => listProfileId.Contains(gd.ProfileID.Value)
&& gd.MonthStart <= monthYear).OrderByDescending(prop => prop.MonthStart).ToList();
List<Att_Grade> lstGrade = new List<Att_Grade>();
foreach (Att_Grade grade in lst)
{
Att_Grade grade1 = lstGrade.FirstOrDefault(prop => prop.ProfileID == grade.ProfileID);
if (grade1 == null)
{
lstGrade.Add(grade);
}
}
return lstGrade;
}
}
示例3: GetGrade
public static Att_Grade GetGrade(Hre_Profile profile, DateTime effectMonth)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoAtt_Grade = new CustomBaseRepository<Att_Grade>(unitOfWork);
//NOTE: can modify lai cau truy van de gioi han data lay len
List<Att_Grade> lst = repoAtt_Grade
.FindBy(alw => alw.IsDelete == null
&& alw.ProfileID == profile.ID
&& alw.MonthStart <= effectMonth)
.OrderByDescending(alw => alw.MonthStart).ToList();
if (lst != null && lst.Count > 0)
{
// Lấy grade có ngày đến hạn, nếu không có ngày đến hạn xem như Ok không hết hạn, nếu có ngày đến hạn
DateTime temp = new DateTime(effectMonth.Year, effectMonth.Month, 1);
if (!lst[0].MonthEnd.HasValue || (lst[0].MonthEnd.HasValue && lst[0].MonthEnd.Value >= temp))
{
return lst[0];
}
}
return null;
}
}
示例4: ProcessSendRequest
/// <summary>
/// [Hieu.Van]
/// Xử lý Gửi yêu cầu phê duyệt
/// </summary>
/// <param name="LoginID"></param>
/// <param name="userApprovedID"></param>
/// <param name="recordID"></param>
/// <param name="type"></param>
/// <returns></returns>
public string ProcessSendRequest(string host, Guid LoginID, Guid userApprovedID, Guid recordID, string type)
{
DataErrorCode status = DataErrorCode.Success;
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoFIN_PurchaseRequest = new CustomBaseRepository<FIN_PurchaseRequest>(unitOfWork);
var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
var record = repoFIN_PurchaseRequest.FindBy(s => s.ID == recordID).FirstOrDefault();
if (record.UserCreateID != LoginID)
{
return DataErrorCode.NoPermission.ToString();
}
if (record.Status == EnumDropDown.Status.E_REJECTED.ToString())
{
return DataErrorCode.Error_Reject.ToString();
}
if (record.Status != null)
{
return DataErrorCode.Error_SendRequest.ToString();
}
var userApproved = repoSys_UserApprove.FindBy(s => s.ID == userApprovedID).FirstOrDefault();
// Lấy status hiện tại của bản ghi
string currentStatus = record.Status;
// truyền từ Dropdownlist chọn người duyệt, lấy ra giá trị Status tiếp theo
string nextStatus = userApproved.CurrentStatus;
record.Status = nextStatus;
record.UserApproveID = userApprovedID;
repoFIN_PurchaseRequest.Edit(record);
status = repoFIN_PurchaseRequest.SaveChanges();
if (status == DataErrorCode.Success)
{
if (nextStatus != "Approved")
{
status = SendMail_ToNextApproved(host, recordID, userApprovedID, nextStatus, type);
}
var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == record.Status).FirstOrDefault();
if (configProcess == null)
{
return DataErrorCode.Success.ToString();
}
else
{
return DataErrorCode.Success_Forward.ToString();
}
}
return status.ToString();
}
}
示例5: GetWorkDaysByDate
public List<Att_WorkdayEntity> GetWorkDaysByDate(DateTime DateFrom, DateTime DateTo)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repo = new Att_WorkDayRepository(unitOfWork);
var repoAtt_Workday = new CustomBaseRepository<Att_Workday>(unitOfWork);
return repoAtt_Workday.FindBy(m => m.IsDelete == null && m.WorkDate >= DateFrom && m.WorkDate <= DateTo).Select(s => new Att_WorkdayEntity { ID = s.ID, ProfileID = s.ProfileID, InTimeRoot = s.InTimeRoot, OutTimeRoot = s.OutTimeRoot, LateEarlyDuration = s.LateEarlyDuration, ShiftID = s.ShiftID, MissInOutReason = s.MissInOutReason }).ToList<Att_WorkdayEntity>();
}
}
示例6: AddDataForBasicSalary
public void AddDataForBasicSalary(string ProfileIDs, string BasicSalary, DateTime DateHire, Guid SalaryRankID,string UserLogin)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
string status = string.Empty;
var repoBasicSalary = new CustomBaseRepository<Sal_BasicSalary>(unitOfWork);
List<Guid> lstProfileIDs = ProfileIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
List<Sal_BasicSalary> lstBasicSalary = new List<Sal_BasicSalary>();
//chua co cach giai quyet nen hard code lay mac dinh la VND
var repoCurrency = new CustomBaseRepository<Cat_Currency>(unitOfWork);
var currency = repoCurrency.FindBy(s => s.IsDelete == null && s.CurrencyName == "VND").FirstOrDefault();
//var repoSalaryRank = new CustomBaseRepository<Cat_SalaryRank>(unitOfWork);
//var repoSalaryClass = new CustomBaseRepository<Cat_SalaryClass>(unitOfWork);
//var salaryRank = repoSalaryRank.FindBy(s => s.IsDelete == null && s.ID == SalaryRankID).FirstOrDefault();
//var salaryClass = repoSalaryClass.FindBy(s => s.IsDelete == null && s.ID == salaryRank.SalaryClassID).FirstOrDefault();
var salaryRankServices = new Cat_SalaryRankServices();
var lstObjRank = new List<object>();
lstObjRank.Add(null);
lstObjRank.Add(null);
lstObjRank.Add(1);
lstObjRank.Add(int.MaxValue -1);
var lstRank = salaryRankServices.GetData<Cat_SalaryRankEntity>(lstObjRank, ConstantSql.hrm_cat_sp_get_SalaryRank, UserLogin, ref status).ToList().Translate<Cat_SalaryRank>();
var rankEntity = lstRank.Where(s => s.ID == SalaryRankID).FirstOrDefault();
var salaryClassServices = new Cat_SalaryClassServices();
var lstObjClass = new List<object>();
lstObjClass.Add(null);
lstObjClass.Add(1);
lstObjClass.Add(int.MaxValue -1);
var salaryClass = salaryClassServices.GetData<Cat_SalaryClassEntity>(lstObjClass, ConstantSql.hrm_cat_sp_get_SalaryClass, UserLogin, ref status).ToList().Translate<Cat_SalaryClass>();
var salaryClassEntity = salaryClass.Where(s => rankEntity.SalaryClassID == s.ID).FirstOrDefault();
foreach (var item in lstProfileIDs)
{
Sal_BasicSalary objBasicSalary = new Sal_BasicSalary();
objBasicSalary.ProfileID = item;
objBasicSalary.GrossAmount = BasicSalary;
objBasicSalary.Amount = BasicSalary.Encrypt();
objBasicSalary.DateOfEffect = DateHire;
objBasicSalary.RankRateID = SalaryRankID;
objBasicSalary.CurrencyID = currency.ID;
objBasicSalary.ClassRateID = salaryClassEntity == null ? Guid.Empty : salaryClassEntity.ID;
lstBasicSalary.Add(objBasicSalary);
}
repoBasicSalary.Add(lstBasicSalary);
repoBasicSalary.SaveChanges();
}
}
示例7: CreateFormulaTemplate
public void CreateFormulaTemplate(List<Cat_FormulaTemplateEntity> listFormulaTemplate,Guid GradeID)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)new UnitOfWork(context);
var repoCat_FormulaTemplate = new CustomBaseRepository<Cat_FormulaTemplate>(unitOfWork);
var repoCat_Element = new CustomBaseRepository<Cat_Element>(unitOfWork);
#region Xử lý bảng template
//lấy các phần tử template trong grade
List<Cat_FormulaTemplate> listFormulaTemplateByGrade = repoCat_FormulaTemplate.FindBy(m => m.IsDelete != true && m.GradeID != null && m.GradeID == GradeID).ToList();
//xóa các phần tử đó
repoCat_FormulaTemplate.Delete(listFormulaTemplateByGrade);
//insert lại các phần tử mới
List<Cat_FormulaTemplate> listFormulaTemplateModel = listFormulaTemplate.Translate<Cat_FormulaTemplate>();
listFormulaTemplateModel.ForEach(m => m.GradeID = GradeID);
repoCat_FormulaTemplate.Add(listFormulaTemplateModel);
#endregion
#region Xử lý bảng cat_element
//lấy các phần tử có cùng mã code với template
List<Cat_Element> listElement = repoCat_Element.FindBy(m => m.IsDelete != true && m.GradePayrollID == GradeID).ToList();
listElement = listElement.Where(m => listFormulaTemplate.Any(t => t.ElementCode.ReplaceSpace() == m.ElementCode.ReplaceSpace())).ToList();
//xóa các phần tử đó đi
repoCat_Element.Delete(listElement);
//tạo ra các element
List<Cat_Element> listElementModel = new List<Cat_Element>();
Cat_Element item = new Cat_Element();
foreach (var template in listFormulaTemplate)
{
item = new Cat_Element();
item.GradePayrollID = GradeID;
item.ElementCode = template.ElementCode.ReplaceSpace();
item.ElementName = template.ElementName;
item.Formula = template.Formula;
item.IsBold = template.IsBold;
item.Invisible = template.Invisible;
item.Description = template.Description;
item.TabType = CatElementType.Payroll.ToString();
item.MethodPayroll = MethodPayroll.E_NORMAL.ToString();
item.ElementType = CatElementType.Payroll.ToString();
item.Type = EnumDropDown.ElementDataType.Double.ToString();
listElementModel.Add(item);
}
repoCat_Element.Add(listElementModel);
unitOfWork.SaveChanges();
#endregion
}
}
示例8: UpdateStatus
public ResultsObject UpdateStatus(string Ids,string Status)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)new UnitOfWork(context);
var repoHDTJobGroup = new CustomBaseRepository<Cat_HDTJobGroup>(unitOfWork);
List<Cat_HDTJobGroup> listHDTJob = repoHDTJobGroup.FindBy(m => m.IsDelete != true).ToList();
string[] ListIds = Ids.Split(',');
listHDTJob = listHDTJob.Where(m => ListIds.Contains(m.ID.ToString())).ToList();
listHDTJob.ForEach(m => m.Status = Status);
unitOfWork.SaveChanges();
return new ResultsObject();
}
}
示例9: HasConfigAnnualLeaveAtTotalConfig
public bool HasConfigAnnualLeaveAtTotalConfig()
{
var isConfig = false;
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoSys_AppConfig = new CustomBaseRepository<Sys_AppConfig>(unitOfWork);
string E_STANDARD_WORKDAY = AppConfig.E_STANDARD_WORKDAY.ToString();
var appconfig = repoSys_AppConfig.FindBy(p => p.Info == E_STANDARD_WORKDAY).FirstOrDefault();
if (appconfig == null || string.IsNullOrEmpty(appconfig.Value78) ||
string.IsNullOrEmpty(appconfig.Value79))
{
//xuat thong bao : Vui lòng cấu hình tham số và công thức tính phép năm ở "Cấu hình chung" (PleaseConfigAnnualLeaveAtTotalConfig)
return false;
}
}
return isConfig;
}
示例10: GetUserApprovedForMulti_E_FIN_ClaimRequest
public List<Sys_UserApproveEntity> GetUserApprovedForMulti_E_FIN_ClaimRequest(Guid recordID, string userLogin)
{
List<Sys_UserApproveEntity> lstReturn = new List<Sys_UserApproveEntity>();
using (var context = new VnrHrmDataContext())
{
var type = ApproveType.E_FIN_ClaimRequest.ToString();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
string status = string.Empty;
var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
var lstUserInfo = repoSys_UserInfo.FindBy(s => s.IsDelete == null).ToList();
var record = GetData<FIN_ClaimEntity>(recordID, ConstantSql.hrm_hr_sp_get_ClaimById, userLogin, ref status).FirstOrDefault();
string currentStatus = record.Status;
var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == currentStatus).FirstOrDefault();
List<ElementFormula> listFomula = new List<ElementFormula>();
ElementFormula FomulaItem = new ElementFormula("Total", record.Total, 0);
ElementFormula statusItem = new ElementFormula(configProcess.NextStatusFormular, configProcess.NextStatusFormular, 1);
listFomula.Add(FomulaItem);
listFomula.Add(statusItem);
string nextStatus = GetObjectValue(new List<Cat_ElementEntity>(), listFomula, configProcess.NextStatusFormular).ToString();
var lstUserApprove = repoSys_UserApprove.FindBy(s => s.IsDelete == null && s.Type == type && s.CurrentStatus == nextStatus).ToList();
Sys_UserApproveEntity model = new Sys_UserApproveEntity();
foreach (var item in lstUserApprove)
{
if (item.UserRequestID != null && item.UserRequestID == record.UserCreateID)
{
model = new Sys_UserApproveEntity();
var temp = lstUserInfo.Where(s => s.ID == item.UserApproveID).FirstOrDefault();
model.ID = item.ID;
model.UserApproveName = temp.UserInfoName;
model.UserApproveID = item.UserApproveID;
lstReturn.Add(model);
}
}
}
return lstReturn;
}
示例11: SaveAmountKaiZen
public bool SaveAmountKaiZen(List<Guid> SelectIds)
{
using (var context = new VnrHrmDataContext())
{
try
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
string status = string.Empty;
var repoKai_KaizenData = new CustomBaseRepository<Kai_KaizenData>(unitOfWork);
List<Kai_KaizenData> listKai_KaizenData = repoKai_KaizenData.FindBy(m => m.IsDelete != true && SelectIds.Any(t => t == m.ID)).ToList();
listKai_KaizenData.ForEach(m => m.AmountTransfered = m.SumAmount);
unitOfWork.SaveChanges();
return true;
}
catch
{
return false;
}
}
}
示例12: ActionApproved
public string ActionApproved(string selectedIds)
{
using (var context = new VnrHrmDataContext())
{
string message = string.Empty;
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
//var repo = new Hre_WorkHistoryRepository(unitOfWork);
var repoWorkHistory = new CustomBaseRepository<Hre_WorkHistory>(unitOfWork);
var repoProfile = new CustomBaseRepository<Hre_Profile>(unitOfWork);
List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
var lstWorkHistorys = repoWorkHistory.FindBy(m => lstIds.Contains(m.ID)).ToList();
foreach (var WorkHistory in lstWorkHistorys)
{
WorkHistory.Status = WorkHistoryStatus.E_APPROVED.ToString();
if (WorkHistory.DateEffective != null && WorkHistory.DateEffective <= DateTime.Now.Date)
{
string status = string.Empty;
Hre_Profile profile = repoProfile.FindBy(m => m.IsDelete != true && m.ID == WorkHistory.ProfileID).FirstOrDefault();
if (profile != null)
{
profile.OrgStructureID = WorkHistory.OrganizationStructureID;
profile.JobTitleID = WorkHistory.JobTitleID;
profile.PositionID = WorkHistory.PositionID;
profile.DateOfEffect = WorkHistory.DateEffective;
profile.LaborType = WorkHistory.LaborType;
profile.CostCentreID = WorkHistory.CostCentreID;
profile.FormType = WorkHistory.FormType;
profile.EmpTypeID = WorkHistory.EmployeeTypeID;
profile.WorkingPlace = WorkHistory.WorkLocation;
//profileServices.Edit(profile);
}
}
}
unitOfWork.SaveChanges();
message = NotificationType.Success.ToString();
return message;
}
}
示例13: GetNextStatusOfRecord
public string GetNextStatusOfRecord(Guid recordID)
{
using (var context = new VnrHrmDataContext())
{
string type = ApproveType.E_FIN_PurchaseRequest.ToString();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
var UserLogin = string.Empty;
string stt = string.Empty;
var record = GetData<FIN_PurchaseRequestEntity>(recordID, ConstantSql.hrm_hr_sp_get_PurchaseRequestById, UserLogin, ref stt).FirstOrDefault();
var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == record.Status).FirstOrDefault();
double total = record.Total != null ? record.Total.Value : 0.0;
List<ElementFormula> listFomula = new List<ElementFormula>();
ElementFormula FomulaItem = new ElementFormula("Total", total, 0);
ElementFormula statusItem = new ElementFormula(configProcess.NextStatusFormular, configProcess.NextStatusFormular, 1);
listFomula.Add(FomulaItem);
listFomula.Add(statusItem);
string nextStatus = GetObjectValue(new List<Cat_ElementEntity>(), listFomula, configProcess.NextStatusFormular).ToString();
return nextStatus;
}
}
示例14: SearchAnnualInsuranceLeaveDetail
/// <summary>
/// Button Tìm Kiếm Trong Phân Tích BHXH
/// </summary>
/// <param name="Year"></param>
/// <param name="orgStructure"></param>
/// <param name="LstProfileStatus"></param>
/// <returns></returns>
public List<Att_AnnualLeaveDetailEntity> SearchAnnualInsuranceLeaveDetail(int Year, string orgStructure, string LstProfileStatus,string UserLogin)
{
using (var context = new VnrHrmDataContext())
{
string status = string.Empty;
var unitOfWork = (IUnitOfWork)new UnitOfWork(context);
var repoAtt_AnnualLeaveDetail = new CustomBaseRepository<Att_AnnualLeaveDetail>(unitOfWork);
List<object> lstObj = new List<object>();
lstObj.Add(orgStructure);
lstObj.Add(null);
lstObj.Add(null);
var lstProfileQuery = GetData<Hre_ProfileEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, UserLogin, ref status).ToList();
string E_INSURANCE_LEAVE = AnnualLeaveDetailType.E_INSURANCE_LEAVE.ToString();
List<Guid> lstProfileID = lstProfileQuery.Select(m => m.ID).ToList<Guid>();
List<Att_AnnualLeaveDetailEntity> lstAnnDetail = repoAtt_AnnualLeaveDetail
.FindBy(m => m.IsDelete == null && m.Type == E_INSURANCE_LEAVE && m.Year == Year
&& m.ProfileID != null && lstProfileID.Contains(m.ProfileID.Value)).ToList().Translate<Att_AnnualLeaveDetailEntity>();
return lstAnnDetail;
}
}
示例15: SetPayrmentOut
public int[] SetPayrmentOut(List<Guid> SelectIds, DateTime MonthYear)
{
using (var context = new VnrHrmDataContext())
{
try
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
string status = string.Empty;
var repoKai_KaizenData = new CustomBaseRepository<Kai_KaizenData>(unitOfWork);
List<Kai_KaizenData> ListKaiZendData = repoKai_KaizenData.FindBy(m => m.IsDelete != true && m.Status == EnumDropDown.Kai_KaizenDataStatus.E_APPROVED.ToString()).ToList();
ListKaiZendData = ListKaiZendData.Where(m => SelectIds.Any(t => t == m.ID)).ToList();
int Pass = 0;
int Fail = 0;
foreach (var i in ListKaiZendData)
{
if (i.IsPaymentOut == null && i.DateTransferPayment == null)
{
i.IsPaymentOut = true;
i.DateTransferPayment = MonthYear;
Pass++;
}
else
{
Fail++;
}
}
unitOfWork.SaveChanges();
return new int[] { Pass, Fail };
}
catch
{
return new int[] { 0, 0 };
}
}
}