System.reflection.targetexception非静态方法需要一个目标 public IQueryable GetEx( 表达式筛选器=空, SearchDto search=null, int?lawyerID=null, bool?I
System.reflection.targetexception非静态方法需要一个目标System.reflection.targetexception非静态方法需要一个目标 public IQueryable GetEx( 表达式筛选器=空, SearchDto search=null, int?lawyerID=null, bool?I,reflection,system,non-static,Reflection,System,Non Static,System.reflection.targetexception非静态方法需要一个目标 public IQueryable GetEx( 表达式筛选器=空, SearchDto search=null, int?lawyerID=null, bool?IsInDetailTab=null ) { 过滤器=过滤器??(p=>true); 搜索=搜索??新搜索到(); IsInDetailTab=IsInDetailTab??假; //这行是关于授权的 var hyDepList=context.
public IQueryable GetEx(
表达式筛选器=空,
SearchDto search=null,
int?lawyerID=null,
bool?IsInDetailTab=null
)
{
过滤器=过滤器??(p=>true);
搜索=搜索??新搜索到();
IsInDetailTab=IsInDetailTab??假;
//这行是关于授权的
var hyDepList=context.Department.Where(p=>p.ID==UserData.iDepartmentId&&p.ID!=0).RecursiveSelect(p=>context.Department.Where(pd=>pd.ParentID==p.ID).AsQueryable()).Select(p=>p.DepartmentBankCode.Distinct().ToList();
//这行是关于授权的
var AssociatedDepartmentList=(来自context.DepartmentUserAssociation.Where(p=>p.AssociateAccountUserID==UserData.iUserId&&p.AssociateAccountUserID!=0)中的depID。选择(p=>p.DepartmentID)
在上下文中加入dep。depID上的部门等于dep.ID
选择dep.DepartmentBankCode).Distinct().ToList();
var query=来自dbSet.Where中的项(过滤器)
在上下文中加入借方。item.DebitorID上的借方等于debitor.ID
//库鲁姆萨尔
来自context.debitorProducts.Where(p=>!p.IsDeleted&&p.DebitorID==debitor.ID).OrderBy(a=>a.TrackingDate).Take(1).DefaultIfEmpty()
从context.product.Where(p=>!p.IsDeleted&&p.ID==debitorProducts.ProductID).DefaultIfEmpty()中的产品
//比雷塞尔
来自context.DebitorProducts.Where中的debitorProducts2(p=>!p.IsDeleted&&p.ID==item.DebitorProductsID).DefaultIfEmpty()
从context.Product.Where(p=>!p.IsDeleted&&p.ID==debitorProducts2.ProductID).DefaultIfEmpty()中的product2
来自context.main律师delegationDebitorProduct.Where(p=>(p.DebitorProductID.HasValue&((debitor.MistralCustomerStatusID==3 | | | debitor.MistralCustomerStatusID==8)?p.DebitorProductID==debitorProducts2.ID:p.DebitorProductID==debitorProducts.ID)).DefaultIfEmpty()
从context.MainLawyerDelegation.Where(p=>!p.IsDeleted&&p.ID==delegationDebitorProduct.MainLawyerDelegationID.DefaultIfEmpty()中的委托
从context.debitorType.Where中的debitorType(p=>!p.IsDeleted&&p.ID==debitor.DebitorTypeID).DefaultIfEmpty()
从context.exchangeType.Where(p=>!p.IsDeleted&&(item.ExchangeTypeID.HasValue&&p.ID==(int)item.ExchangeTypeID)).DefaultIfEmpty()
来自context.AccountUser.Where(p=>p.ID==item.InsertedBy.DefaultIfEmpty()中的insertedAccountUser
来自context.AccountPerson.Where(p=>p.ID==insertedAccountUser.PersonID.DefaultIfEmpty()中的insertedAccountPerson
来自context.AccountUser.Where(p=>p.ID==item.UpdatedBy).DefaultIfEmpty()中的UpdateAccountUser
来自context.AccountPerson.Where(p=>p.ID==updatedAccountUser.PersonID.DefaultIfEmpty()中的updatedAccountPerson
哪里
(!search.DebitorID.HasValue | | debitor.ID==search.DebitorID)
&&(search.DebitorNo==null | | debitor.DebitorNo==search.DebitorNo)
&&(search.TCKNOrTaxOfficeNumber==null | | debitor.TCKN==search.TCKNOrTaxOfficeNumber | | | debitor.TaxOfficeNumber==search.TCKNOrTaxOfficeNumber)
&&(search.FirstName==null | | debitor.Name.Contains(search.FirstName))
&&(search.姓氏==null | |借方.姓氏.包含(search.姓氏))
&&(search.BankCode==null | | context.DebitorProducts.Any(p=>!p.IsDeleted&&p.DebitorID==debitor.ID&&p.TrackingUnitCode==search.BankCode))
&&(search.PhoneNo==null | | context.DebitorPhones.Any(p=>!p.IsDeleted&&p.DebitorID==debitor.ID&&p.PhoneNo.Contains(search.PhoneNo)))
&&(search.ExecutionFileNo1==null | | context.ExecutionTracking.Any(p=>!p.IsDeleted&&p.DebitorID==debitor.ID&&p.ExecutionFileNo.StartsWith(search.ExecutionFileNo1.ToString()))
&&(search.ExecutionFileNo2==null | | context.ExecutionTracking.Any(p=>!p.IsDeleted&&p.DebitorID==debitor.ID&&p.ExecutionFileNo.EndsWith(search.ExecutionFileNo2.ToString()))
&&(!search.LawyerID.HasValue | |!delegationDebitorProduct.IsDeleted和delegation.Status==(int)LawyerConfirmStatus.Accept和(delegation.MainLawyerID==search.LawyerID | | delegation.ObserverLawyerID==search.LawyerID))
&&(!lawyerID.HasValue | | |!delegationDebitorProduct.IsDeleted和delegation.Status==(int)LawyerConfirmStatus.Accept和(delegation.MainLawyerID==lawyerID | | delegation.observer lawyerID==lawyerID))
&&(!(context.AccountRole.Where(p=>p.KimyonCode==“B”| | p.KimyonCode==“SP”| | p.KimyonCode==“SM”).Select(p=>p.ID.Contains(UserData.iRoleId))| hyDepList.Contains(debitorProducts.TrackingUnitCode.ToString())
&&(!(context.AccountRole.Where(p=>p.KimyonCode==“MM”| | p.KimyonCode==“MTL”| | p.KimyonCode==“MP”).Select(p=>p.ID.Contains(UserData.iRoleId))| AssociatedDepartmentList.Contains(debitorProducts.TrackingUnitCode.ToString())
选择新借项
{
ID=item.ID,
DebitorID=debitor.ID,
DebitorProductsID=item.DebitorProductsID,
ExchangeTypeID=item.ExchangeTypeID,
NotaryName=item.NotaryName,
ReferenceNo=item.ReferenceNo,
public IQueryable<DebitorProductCautionsEx> GetEx(
Expression<Func<DebitorProductCautions, bool>> filter = null,
SearchDto search = null,
int? lawyerID = null,
bool? IsInDetailTab = null
)
{
filter = filter ?? (p => true);
search = search ?? new SearchDto();
IsInDetailTab = IsInDetailTab ?? false;
//this line about authorization
var hyDepList = context.Department.Where(p => p.ID == UserData.iDepartmentId && p.ID != 0).RecursiveSelect(p => context.Department.Where(pd => pd.ParentID == p.ID).AsQueryable<Department>()).Select(p => p.DepartmentBankCode).Distinct().ToList();
//this line about authorization
var associatedDepartmenList = (from depID in context.DepartmentUserAssociation.Where(p => p.AssociateAccountUserID == UserData.iUserId && p.AssociateAccountUserID != 0).Select(p => p.DepartmentID)
join dep in context.Department on depID equals dep.ID
select dep.DepartmentBankCode).Distinct().ToList();
var query = from item in dbSet.Where(filter)
join debitor in context.Debitor on item.DebitorID equals debitor.ID
//kurumsal
from debitorProducts in context.DebitorProducts.Where(p => !p.IsDeleted && p.DebitorID == debitor.ID).OrderBy(a => a.TrackingDate).Take(1).DefaultIfEmpty()
from product in context.Product.Where(p => !p.IsDeleted && p.ID == debitorProducts.ProductID).DefaultIfEmpty()
//bireysel
from debitorProducts2 in context.DebitorProducts.Where(p => !p.IsDeleted && p.ID == item.DebitorProductsID).DefaultIfEmpty()
from product2 in context.Product.Where(p => !p.IsDeleted && p.ID == debitorProducts2.ProductID).DefaultIfEmpty()
from delegationDebitorProduct in context.MainLawyerDelegationDebitorProduct.Where(p => (p.DebitorProductID.HasValue && ((debitor.MistralCustomerStatusID == 3 || debitor.MistralCustomerStatusID == 8) ? p.DebitorProductID == debitorProducts2.ID : p.DebitorProductID == debitorProducts.ID))).DefaultIfEmpty()
from delegation in context.MainLawyerDelegation.Where(p => !p.IsDeleted && p.ID == delegationDebitorProduct.MainLawyerDelegationID).DefaultIfEmpty()
from debitorType in context.DebitorType.Where(p => !p.IsDeleted && p.ID == debitor.DebitorTypeID).DefaultIfEmpty()
from exchangeType in context.ExchangeType.Where(p => !p.IsDeleted && (item.ExchangeTypeID.HasValue && p.ID == (int)item.ExchangeTypeID)).DefaultIfEmpty()
from insertedAccountUser in context.AccountUser.Where(p => p.ID == item.InsertedBy).DefaultIfEmpty()
from insertedAccountPerson in context.AccountPerson.Where(p => p.ID == insertedAccountUser.PersonID).DefaultIfEmpty()
from updatedAccountUser in context.AccountUser.Where(p => p.ID == item.UpdatedBy).DefaultIfEmpty()
from updatedAccountPerson in context.AccountPerson.Where(p => p.ID == updatedAccountUser.PersonID).DefaultIfEmpty()
where
(!search.DebitorID.HasValue || debitor.ID == search.DebitorID)
&& (search.DebitorNo == null || debitor.DebitorNo == search.DebitorNo)
&& (search.TCKNOrTaxOfficeNumber == null || debitor.TCKN == search.TCKNOrTaxOfficeNumber || debitor.TaxOfficeNumber == search.TCKNOrTaxOfficeNumber)
&& (search.FirstName == null || debitor.Name.Contains(search.FirstName))
&& (search.Surname == null || debitor.Surname.Contains(search.Surname))
&& (search.BankCode == null || context.DebitorProducts.Any(p => !p.IsDeleted && p.DebitorID == debitor.ID && p.TrackingUnitCode == search.BankCode))
&& (search.PhoneNo == null || context.DebitorPhones.Any(p => !p.IsDeleted && p.DebitorID == debitor.ID && p.PhoneNo.Contains(search.PhoneNo)))
&& (search.ExecutionFileNo1 == null || context.ExecutionTracking.Any(p => !p.IsDeleted && p.DebitorID == debitor.ID && p.ExecutionFileNo.StartsWith(search.ExecutionFileNo1.ToString())))
&& (search.ExecutionFileNo2 == null || context.ExecutionTracking.Any(p => !p.IsDeleted && p.DebitorID == debitor.ID && p.ExecutionFileNo.EndsWith(search.ExecutionFileNo2.ToString())))
&& (!search.LawyerID.HasValue || !delegationDebitorProduct.IsDeleted && delegation.Status == (int)LawyerConfirmStatus.Accept && (delegation.MainLawyerID == search.LawyerID || delegation.ObserverLawyerID == search.LawyerID))
&& (!lawyerID.HasValue || !delegationDebitorProduct.IsDeleted && delegation.Status == (int)LawyerConfirmStatus.Accept && (delegation.MainLawyerID == lawyerID || delegation.ObserverLawyerID == lawyerID))
&& ((!(context.AccountRole.Where(p => p.KimyonCode == "B" || p.KimyonCode == "SP" || p.KimyonCode == "SM").Select(p => p.ID).Contains(UserData.iRoleId))) || hyDepList.Contains(debitorProducts.TrackingUnitCode.ToString()))
&& ((!(context.AccountRole.Where(p => p.KimyonCode == "MM" || p.KimyonCode == "MTL" || p.KimyonCode == "MP").Select(p => p.ID).Contains(UserData.iRoleId))) || associatedDepartmenList.Contains(debitorProducts.TrackingUnitCode.ToString()))
select new DebitorProductCautionsEx
{
ID = item.ID,
DebitorID = debitor.ID,
DebitorProductsID = item.DebitorProductsID,
ExchangeTypeID = item.ExchangeTypeID,
NotaryName = item.NotaryName,
ReferenceNo = item.ReferenceNo,
DailyChargeNo = item.DailyChargeNo,
CautionDate = item.CautionDate,
CautionPeriod = item.CautionPeriod,
NotificationDate = item.NotificationDate,
BankStatementDate = item.BankStatementDate,
BSMVRate = item.BSMVRate,
KKDFRate = item.KKDFRate,
CautionAmount = item.CautionAmount,
CapitalAmount = item.CapitalAmount,
InterestAmount = item.InterestAmount,
CommissionAmount = item.CommissionAmount,
LegalWageCutAmount = item.LegalWageCutAmount,
CautionCashAmount = item.CautionCashAmount,
CautionNonCashAmount = item.CautionNonCashAmount,
TotalDebt = item.TotalDebt,
MistralCustomerStatusID = debitor.MistralCustomerStatusID,
DebitorNo = debitor.DebitorNo,
DebitorName = (debitor.MistralCustomerStatusID == 3 || debitor.MistralCustomerStatusID == 8) ? debitor.Name.Replace(" ", "") + " " + debitor.Surname.Replace(" ", "") : debitor.Name,
DebitorSurname = debitor.Surname,
TCKN = debitor.TCKN,
NCN = debitor.NCN,
isKurumsal = (debitor.MistralCustomerStatusID != 3 && debitor.MistralCustomerStatusID != 8),
ProductName = (debitor.MistralCustomerStatusID == 3 || debitor.MistralCustomerStatusID == 8) ? product2.ProductName : (item.DebitorProductsID == 0 ? "KURUMSAL KREDİ" : product.ProductName),
ExchangeType = exchangeType.Description,
BSMV = (debitor.MistralCustomerStatusID == 3 || debitor.MistralCustomerStatusID == 8) ? (item.InterestAmount.HasValue ? Math.Truncate(((item.InterestAmount.Value * 5) / 100) * 100) / 100 : 0) : 0,
KKDF = (debitor.MistralCustomerStatusID == 3 || debitor.MistralCustomerStatusID == 8) ? (item.InterestAmount.HasValue ? Math.Truncate(((item.InterestAmount.Value * 15) / 100) * 100) / 100 : 0) : 0,
UpdateDate = item.UpdateDate,
InsertedBy = item.InsertedBy,
UpdatedBy = item.UpdatedBy,
InsertDate = item.InsertDate,
IsDeleted = item.IsDeleted,
InsertedName = insertedAccountPerson.FirstName.Trim() + " " + insertedAccountPerson.LastName.Trim(),
UpdatedName = updatedAccountPerson.FirstName.Trim() + " " + updatedAccountPerson.LastName.Trim()
};
if (IsInDetailTab.Value)
{
return query;
}
var bireysel = new List<int>(); // Müşteri Tipi Bireysel olan ihtar ID'leri listesi.
var kurumsal = new Dictionary<string, int>(); // Müşteri Tipi Kurumsal olan İhtarların DebitorId ve Yevmiye No'ya göre gruplanmış listesi.
//porblem is query non-static method
**foreach (var item in query.OrderByDescending(p => p.ID).ToList())**
{
var deb = context.Debitor.FirstOrDefault(p => p.ID == item.DebitorID);
if (deb != null && (deb.MistralCustomerStatusID == 3 || deb.MistralCustomerStatusID == 8))
{
bireysel.Add(item.ID);
continue;
}
var key = string.Concat(item.DebitorID, "-", item.DailyChargeNo);
if (kurumsal.ContainsKey(key))
continue;
kurumsal.Add(key, item.ID);
}
var datKurumsal = query.Where(p => kurumsal.Values.Contains(p.ID));
var datBireysel = query.Where(p => bireysel.Contains(p.ID));
return datBireysel.Union(datKurumsal);
}