0

hi all
i want create Query with Nhibernate
i problem with average time the object
my code :

public static int GetInboxFaultsCount(int InboxId, FaultState State)
        {
            Criteria criteria = new Criteria();
            criteria.Query = "select count(distinct fault) from IFault fault inner join fault.ReceiversInbox inbox where inbox.Id=:id and fault.State =:state AND (not exists (from fault.Results fr where fr.SendState=1 AND fr.OwnerFixUnit.Inbox.id=:id))";
            criteria.Parameters.Add("state", State);
            criteria.Parameters.Add("id", InboxId);
            DataFacade dFacade = new DataFacade();
            return dFacade.GetCount(criteria);
        }
1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Coward
0

sry correct code :

public static int GetAvgTime(int InboxId, DateTime StartTime, DateTime EndTime)
        {
            Criteria criteria = new Criteria();
            criteria.Query = "select avg(result.FixTime-flt.CreateTime )from Fault flt join flt.ReceivedFaults inbox join FaultResult result.Results where result.State != SentToAnotherUnit AND flt.Stat=FaultState AND inbox.Id= :InboxId";
            criteria.Parameters.Add("Id", InboxId);
            criteria.Parameters.Add("id", InboxId);
            DataFacade dFacade = new DataFacade();
            return dFacade.GetCount(criteria);

        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.