Hello,

In the code below, I get data from the database and I create a a
List<> from these data. The result is as expected ..... the first
time. In fact for each refresh (ASP.NET MVC), and I see update in the
database. But I don't want these update the calculation is just for
display

In the foreach loop, I don't want any DB update.

How can I solve this ?

Thanks,

               List<CustomerTypeOfWork> res = new List<CustomerTypeOfWork>();
               IList<Scheduled> list =
session.CreateCriteria(typeof(Scheduled))
                   .CreateCriteria("Customer")
                       .Add(Expression.Eq("IsActive", true))
                   .List<Scheduled>();

               foreach (Scheduled sch in list)
               {
                   var exist = res.Contains(sch.CustomerTypeOfWork);
                   if (!exist)
                   {
                       sch.CustomerTypeOfWork.HourByWeek =
sch.CustomerTypeOfWork.HourByWeek - sch.HourByWeek;
                       res.Add(sch.CustomerTypeOfWork);
                   }
                   else
                   {
                       var pos = res.IndexOf(sch.CustomerTypeOfWork);
                       res[pos].HourByWeek = res[pos].HourByWeek -
sch.HourByWeek;
                   }
               }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to