FR
FR
CC#
Created by FR on 7/1/2024 in #help
✅ SSRS | How To Upload Multiple RDL File to Report Server ?
oh itss worked ty 👍 ✅
3 replies
CC#
Created by FR on 7/1/2024 in #help
✅ SSRS | How To Upload Multiple RDL File to Report Server ?
3 replies
CC#
Created by FR on 8/23/2023 in #help
❔ Entity Framework, How To Join Second Table To Third Table In The First Table?
here some result from my JSON
{
"branchId": "DF",
"cityId": 1,
"name": "Default",
"status": false,
"city": {
"cityCode": "default_in",
"cityName": "default_in",
"areaId": 11,
"area": {
"name": "default_in",
"cityName": "default_in",
"status": false,
"countryId": "IN",
"parentId": null,
"id": 11
},
"id": 1
},
"area": {
"name": "default_in",
"cityName": "default_in",
"status": false,
"countryId": "IN",
"parentId": null,
"id": 11
},
"id": 1
}
{
"branchId": "DF",
"cityId": 1,
"name": "Default",
"status": false,
"city": {
"cityCode": "default_in",
"cityName": "default_in",
"areaId": 11,
"area": {
"name": "default_in",
"cityName": "default_in",
"status": false,
"countryId": "IN",
"parentId": null,
"id": 11
},
"id": 1
},
"area": {
"name": "default_in",
"cityName": "default_in",
"status": false,
"countryId": "IN",
"parentId": null,
"id": 11
},
"id": 1
}
idk why if i exclude Area = areaBranch.City.Area from my linq, my City didnt want to show up Area, but hei if its work its work. anyway ty that was fast
17 replies
CC#
Created by FR on 8/23/2023 in #help
❔ Entity Framework, How To Join Second Table To Third Table In The First Table?
my man, i accidentally found it! just change my linq query from this
.Select(areaBranch => new AreaBranch
{
Id = areaBranch.Id,
BranchId = areaBranch.BranchId,
CityId = areaBranch.CityId,
Name = areaBranch.Name,
Status = areaBranch.Status,
City = areaBranch.City,
})
.Select(areaBranch => new AreaBranch
{
Id = areaBranch.Id,
BranchId = areaBranch.BranchId,
CityId = areaBranch.CityId,
Name = areaBranch.Name,
Status = areaBranch.Status,
City = areaBranch.City,
})
to this
_persistence.AsQueryable()
.Select(areaBranch => new AreaBranch
{
Id = areaBranch.Id,
BranchId = areaBranch.BranchId,
CityId = areaBranch.CityId,
Name = areaBranch.Name,
Status = areaBranch.Status,
City = areaBranch.City,
Area = areaBranch.City.Area
})
.ToList());
_persistence.AsQueryable()
.Select(areaBranch => new AreaBranch
{
Id = areaBranch.Id,
BranchId = areaBranch.BranchId,
CityId = areaBranch.CityId,
Name = areaBranch.Name,
Status = areaBranch.Status,
City = areaBranch.City,
Area = areaBranch.City.Area
})
.ToList());
also add prop public virtual Area { get; set; } in City Model and remove Join Area in AreaBranch Builder
17 replies
CC#
Created by FR on 8/23/2023 in #help
❔ Entity Framework, How To Join Second Table To Third Table In The First Table?
yeah prob like that, Area it should be Provience but i forgot to change the name
17 replies
CC#
Created by FR on 8/23/2023 in #help
❔ Entity Framework, How To Join Second Table To Third Table In The First Table?
it was a simple model like this
public class AreaBranch
{
public long Id {get; set;}
public long CityId {get; set;}
xxx property
public virtual City {get; set;}
public virtual Area {get; set;}
}
public class City
{
public long Id {get; set;}
public long AreaId {get; set;}
xxx property
}
public class Area
{
public long Id {get; set;}
xxx property
}
public class AreaBranch
{
public long Id {get; set;}
public long CityId {get; set;}
xxx property
public virtual City {get; set;}
public virtual Area {get; set;}
}
public class City
{
public long Id {get; set;}
public long AreaId {get; set;}
xxx property
}
public class Area
{
public long Id {get; set;}
xxx property
}
17 replies
CC#
Created by FR on 8/23/2023 in #help
❔ Entity Framework, How To Join Second Table To Third Table In The First Table?
welp i think i could cheat like that xD
17 replies
CC#
Created by FR on 11/25/2022 in #help
❔ SQL Server | Count How Much Installment Paid and Left
just rest my brain a bit and some smol research, by using datediff and subquery i finally understand what u say here my final query
select
p.POLICYNO as PolicyNo
, c.CLAIMNO as ClaimNo
, c.PARENTID as ParentId
, p.Name as CustomerName
, case
when c.parentid is null then 1
else datedif(month, (select paymentdate from claim where claimno = c.parentid), c.paymentdate) + 1
end as Installemnt
, datediff(month,c.paymentdate, c.LastPaymentDate) as RemainingInstallment
, c.PaymentDate
, c.LastInstallmentdate
from Claim c
inner join policy p on c.policyno = p.policyno
order by p.POLICYNO, c.PaymentDate, c.ClaimNo ,c.PARENTID asc
select
p.POLICYNO as PolicyNo
, c.CLAIMNO as ClaimNo
, c.PARENTID as ParentId
, p.Name as CustomerName
, case
when c.parentid is null then 1
else datedif(month, (select paymentdate from claim where claimno = c.parentid), c.paymentdate) + 1
end as Installemnt
, datediff(month,c.paymentdate, c.LastPaymentDate) as RemainingInstallment
, c.PaymentDate
, c.LastInstallmentdate
from Claim c
inner join policy p on c.policyno = p.policyno
order by p.POLICYNO, c.PaymentDate, c.ClaimNo ,c.PARENTID asc
is there a way to improve this query ?
12 replies
CC#
Created by FR on 11/25/2022 in #help
❔ SQL Server | Count How Much Installment Paid and Left
my brain cant think of doing it with only a single select query
12 replies
CC#
Created by FR on 11/25/2022 in #help
❔ SQL Server | Count How Much Installment Paid and Left
and do a bunch of select an inserting
12 replies
CC#
Created by FR on 11/25/2022 in #help
❔ SQL Server | Count How Much Installment Paid and Left
im just thinking to do the same method in c# to SQL Server
12 replies
CC#
Created by FR on 11/25/2022 in #help
❔ SQL Server | Count How Much Installment Paid and Left
yeahhh..... lets change a question a little bit, so u know how to store a selected data into array in SQL Server and Looping it?
12 replies
CC#
Created by FR on 11/25/2022 in #help
❔ SQL Server | Count How Much Installment Paid and Left
sry i didnt make it a clear, so the real issue is how do i count it in SQL Server ? so if im using c#
- im create a array to save the result
- select the policy into array and the looping it
[Loop]
- - select claim based on policyno and looping it
- - [Loop]
- - - use i and i++ to count how much claim paid
- - - like u say use diff month between Claim.PaymentDate to Claim.LastPaymentDateto count how much claim left
- - - store data to the result
- - [End Loop]
[End Loop]
- im create a array to save the result
- select the policy into array and the looping it
[Loop]
- - select claim based on policyno and looping it
- - [Loop]
- - - use i and i++ to count how much claim paid
- - - like u say use diff month between Claim.PaymentDate to Claim.LastPaymentDateto count how much claim left
- - - store data to the result
- - [End Loop]
[End Loop]
but in SQL Server im really confuse to do it
12 replies
CC#
Created by FR on 10/21/2022 in #help
❔ SQL Server | Can i use 'Case When' in Where Clause?
hahaha sry my grammar really bad, but ty a lot brow
11 replies
CC#
Created by FR on 10/21/2022 in #help
❔ SQL Server | Can i use 'Case When' in Where Clause?
i see, my brain still processing but i bit understand ,so if it cant find the value it will goes to second operatos and because the statement is inside brackets it will not bother the other statment outside it (product = @ProductFilterValue OR @ProductFilterValue is not null)
11 replies
CC#
Created by FR on 10/21/2022 in #help
❔ SQL Server | Can i use 'Case When' in Where Clause?
i want to put it into sp so probably not using orm
11 replies