Click here to Skip to main content
15,919,879 members

Comments by dawood abbas (Top 19 by date)

dawood abbas 11-Jan-19 7:58am View    
@shawn patil I can join but cannot get data by grouping.
dawood abbas 11-Jan-19 7:56am View    
below just grouping which is in Ctroller.cs working and getting data..fine
var res = _objRefCustomerBS.GetAllRefCustomer().GroupBy(x => x.MobileNo).Select(x => x.ToList().OrderByDescending(y => y.cuRefID).First()).ToList();
but this below code is not working in DAL class file.
var res = CRMEntites.RefCustomers.GroupBy(x => x.MobileNo).Select(x => x.ToList().OrderByDescending(y => y.cuRefID).First()).ToList();
dawood abbas 11-Jan-19 7:54am View    
I got they query but throwing an error null exception...whereas in MVC controller it's coming, in DAL cant...

var res = from users in CRMEntites.Users
join cust in CRMEntites.Customers on users.uID equals cust.uID
join refCust in (
from refC in CRMEntites.RefCustomers
group refC by refC.MobileNo into grp
select grp.OrderByDescending(g => g.cuRefID).FirstOrDefault()
) on users.MobileNo equals refCust.MobileNo
where users.IsDelete != true && users.rID == 3 && cust.Status == "INV" && cust.Status == "VIS"
select new DashboardGrid
Name = users.Name,
CreatedOn = refCust.CreatedOn,
MobileNo = refCust.MobileNo,
Extension = refCust.Extension
dawood abbas 10-Jan-19 2:35am View    
I cant complete my linq query as per above sql query.
dawood abbas 8-Jul-15 0:51am View    
I got the right answer..

PackagePeriod varchar(20),
UserId INT,
OldExpiryDate DATE,
AmountToPay FLOAT,
PyingAmount FLOAT,
Balance FLOAT,
LastPaidDate DATE,
Company_Id INT

declare @PackagePeriod varchar(20)
declare @UserId int
declare @OldExpiryDate DATE
declare @AmountToPay FLOAT
declare @PyingAmount FLOAT
declare @Balance FLOAT
declare @LastPaidDate DATE
declare @Company_Id INT

declare result_cursor cursor for
SELECT PackagePeriod, UserId, OldExpiryDate, AmountToPay, PyingAmount, Balance, LastPaidDate, Company_Id from #result

OPEN result_cursor

FETCH NEXT FROM result_cursor INTO @PackagePeriod, @UserId, @OldExpiryDate, @AmountToPay, @PyingAmount, @Balance, @LastPaidDate, @Company_Id



-- update your table
else if(@PackagePeriod='Quarterly')
--update table

FETCH NEXT FROM result_cursor INTO @PackagePeriod, @UserId, @OldExpiryDate, @AmountToPay, @PyingAmount, @Balance, @LastPaidDate, @Company_Id


CLOSE result_cursor

DEALLOCATE result_cursor