public static ReadOnlyDictionary<MethodBase, MethodBase> MapInterfacesToImpls(this Type t, Type iface)
        {
            if (t == null || iface == null) return null;
            return _if2imCache.GetOrCreate(Tuple.Create(t, iface), () =>
            {
                var map = t.GetInterfaceMap(iface);

                var res = new Dictionary<MethodBase, MethodBase>();
                for (var i = 0; i < map.TargetMethods.Length; i++)
                {
                    res.Add(map.InterfaceMethods[i], map.TargetMethods[i]);
                }

                return res.ToReadOnly();
            });
        }
Example #2
0
        /// <summary>
        /// Capture all of the current Order Data
        /// </summary>
        /// <returns></returns>
        public ImmutableOrderData cloneFormOrderData(string orderNum)
        {
            Func<string, bool> queryTestSent = test => getSqlServer
                .asBoolOption(string.Format("SELECT [hl7Sent] FROM [downtime].[dbo].[ordersWithTests] where ordernumber = '{0}' and test = '{1}'", orderNum, test))
                .getOrElse(() => false);

            var testsToOrder = new Dictionary<DataRow, bool>();
            this.orderedTests.forEach(x => testsToOrder.Add(x, queryTestSent.Invoke(x["Id"].ToString())));

            return new ImmutableOrderData(orderNum, collectiontime.Text, receivetime.Text,
                 comboBoxWard.Text, ComboBoxPriority.Text, mrn.Text, DOB.Text,
                 firstname.Text, problem.Text, cal1.Text, comment.Text,
                 lastname.Text, TextBoxTechId.Text, TextBoxbillingnumber.Text,this.TextboxCollectDate.Text,
                 testsToOrder.ToReadOnly());
        }
 public static ReadOnlyDictionary<MethodBase, MethodBase> MapInterfacesToImpls(this Type t, IEnumerable<Type> ifaces)
 {
     var map = new Dictionary<MethodBase, MethodBase>();
     ifaces.ForEach(iface => map.AddElements(t.MapInterfacesToImpls(iface)));
     return map.ToReadOnly();
 }