Пример #1
0
        private static IEnumerable<ITimeAndMaterialLineItem> GetMBTimeAndMaterialLineItemsByCostCode(ICostCode c)
        {
            MasterBuilder.TimeAndMaterialLineItem.SetCache("select * from tmemln", c.Recnum);

            try
            {
                return MasterBuilder.TimeAndMaterialLineItem.GetFromCache(r => Convert.ToDecimal(r["cstcde"]) == c.Recnum);
            }
            catch
            {
                return Cache.CacheResult(() =>
                {
                    using (var cmd = Connections.Connection.CreateCommand())
                    {
                        var rv = new List<ITimeAndMaterialLineItem>();
                        cmd.CommandText = string.Format("select recnum, linnum from tmemln where cstcde = {0}", c.Recnum);
                        var rdr = cmd.ExecuteReader();
                        while (rdr.Read())
                        {
                            rv.Add(new MasterBuilder.TimeAndMaterialLineItem(Convert.ToInt32(rdr[0]), Convert.ToInt32(rdr[1])));
                        }

                        return rv;
                    }
                }, c.Recnum);
            }
        }
Пример #2
0
 public CostCodeController(ICostCode _ICostCode)
 {
     this._ICostCode = _ICostCode;
 }
Пример #3
0
 public static IEnumerable<ITimeAndMaterialLineItem> GetTimeAndMaterialLineItemsByCostCode(ICostCode c)
 {
     return Cache.CacheResult(() =>
     {
         switch (AccountingSystem)
         {
             case AccountingSystems.MasterBuilder:
                 return GetMBTimeAndMaterialLineItemsByCostCode(c);
             default:
                 throw new NotImplementedException();
         }
     }, c.Recnum);
 }