Exemplo n.º 1
0
        public int GetProductionOrderStatusID(ProductionOrderStatus oProductionOrderStatus)
        {
            var iProductionOrderStatusID = 0;
             var sCacheItemKey = "ProductionOrderStatus-" + oProductionOrderStatus.ToString();

             if (HttpContext.Current.Cache[sCacheItemKey] == null)
             {
            iProductionOrderStatusID = GetProductionOrderStatusFromDB(oProductionOrderStatus).IAProductionOrderStatusID;
            HttpContext.Current.Cache.Add(sCacheItemKey, iProductionOrderStatusID, null, DateTime.Now.AddSeconds(3600), TimeSpan.Zero, CacheItemPriority.Normal, null);
             }
             else
             {
            iProductionOrderStatusID = (int) HttpContext.Current.Cache[sCacheItemKey];
             }

             return iProductionOrderStatusID;
        }
 public static StatusOption GetStatusOption(ProductionOrderStatus status, DataAccessDataContext context)
 {
     return StatusService.GetStatuses(context)[StatusType.ProductionOrderStatus].Where(s => s.SystemName == status.ToString()).SingleOrDefault();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Retreives the apporpirate ProductionOrderStatus object from the DB based on the enum value passed in
        /// </summary>
        /// <param name="oProductionOrderStatus"></param>
        /// <returns></returns>
        private IAProductionOrderStatus GetProductionOrderStatusFromDB(ProductionOrderStatus oProductionOrderStatus)
        {
            IAProductionOrderStatus oIAProductionOrderStatus = null;
             switch (oProductionOrderStatus)
             {
            case ProductionOrderStatus.Incomplete:
               oIAProductionOrderStatus = DataAccess.IAProductionOrderStatus.SingleOrDefault(row => row.Name == "Incomplete");
               break;
            case ProductionOrderStatus.Complete:
               oIAProductionOrderStatus = DataAccess.IAProductionOrderStatus.SingleOrDefault(row => row.Name == "Complete");
               break;
            default:
               throw new ApplicationException(string.Format("Production Order status is undefined or doesn't exist: {0}", oProductionOrderStatus.ToString()));
             }

             return oIAProductionOrderStatus;
        }