Beispiel #1
0
 /// <summary>
 /// If ThruDate is set to the minimum time (00:00), 
 /// set to the maximum time instead (23:59). 
 /// </summary>
 /// <param name="context"></param>
 private void ExtendThruDate(IRequestContext context)
 {
     bool have = context.Contains(App.THRU_DATE);
     if (!have) return;
     DateTime thruDate = DateTime.MinValue;
     try
     {
         thruDate = (DateTime) context[App.THRU_DATE];
     }
     catch (Exception e)
     {
         if (e != null) return; // Placate Resharper
     }
     bool defaultTime = (thruDate.Hour == 0) && (thruDate.Minute == 0) && (thruDate.Second == 0) &&
         (thruDate.Millisecond == 0);
     if (defaultTime)
     {
         string strThruDate = thruDate.ToShortDateString() + LAST_TICK;
         DateTime newThruDate = Convert.ToDateTime(strThruDate);
         context.Remove(App.THRU_DATE);
         context.Add(App.THRU_DATE, newThruDate);
     }
 }
        private void ProcessRequired(IRequestContext context)
        {
            IList requiredIDs = context.CommandBin.RequiredIDs; // inner list
            if (requiredIDs == null) return;

            IList runtimeIDs = context.CommandBin.RuntimeIDs; // inner list
            if (runtimeIDs != null)
            {
                IEnumerator runtime = runtimeIDs.GetEnumerator();
                while (runtime.MoveNext())
                {
                    string id = runtime.Current as string;
                    requiredIDs.Remove(id);
                }
            }

            IEnumerator required = requiredIDs.GetEnumerator();
            while (required.MoveNext())
            {
                string id = required.Current as string;
                bool okay = (context.Contains(id) && (null != context[id]) && (!String.Empty.Equals(context[id].ToString())));
                if (!okay)
                {
                    context.AddAlertRequired(id);
                }
            }
        }