protected override void PostReadIDOs(int index = 0)
 {
     base.PostReadIDOs(index);
     foreach (AdapterList ListTemp in AdapterListTemplate)
     {
         if (ListTemp.ObjIndex != index)
         {
             continue;
         }
         AdapterList colonList = new AdapterList
         {
             KeyName = ListTemp.KeyName
         };
         foreach (string key in ListTemp.ObjectList.Keys) //go through adapter items
         {
             AdapterListItem obj       = ListTemp.ObjectList[key];
             AdapterListItem colonItem = new AdapterListItem
             {
                 Name           = obj.Name,
                 Label          = obj.Label,
                 LayoutID       = obj.LayoutID,
                 Value          = obj.Value,
                 ValueType      = obj.ValueType,
                 DisplayedValue = obj.DisplayedValue,
                 Key            = obj.Key,
                 ActivityType   = obj.ActivityType
             };
             colonList.Add(colonItem);
         }
         AdapterLists.Add(colonList);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CrashTelemetry" /> class.
        /// </summary>
        /// <param name="crash">The crash.</param>
        internal CrashTelemetry(CrashData crash)
        {
            this.Data = crash ?? new CrashData();
            if (this.Data.headers == null)
            {
                this.Data.headers = new CrashDataHeaders();
            }

            this.headers = new CrashTelemetryHeaders(this.Data.headers);
            this.adapterThreads = new AdapterList<CrashTelemetryThread, CrashDataThread>(
                                                                new List<CrashTelemetryThread>(),
                                                                this.Data.threads,
                                                                threadPublic => threadPublic == null ? null : threadPublic.Data,
                                                                threadPrivate => threadPrivate == null ? null : new CrashTelemetryThread(threadPrivate));
            this.adapterThreads.SyncPrivateToPublic();

            this.adapterBinaries = new AdapterList<CrashTelemetryBinary, CrashDataBinary>(
                                                                new List<CrashTelemetryBinary>(),
                                                                this.Data.binaries,
                                                                binaryPublic => binaryPublic == null ? null : binaryPublic.Data,
                                                                binaryPrivate => binaryPrivate == null ? null : new CrashTelemetryBinary(binaryPrivate));
            this.adapterBinaries.SyncPrivateToPublic();

            this.context = new TelemetryContext(new Dictionary<string, string>(), new Dictionary<string, string>());
            this.Attachments = new Attachments();
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrashTelemetry" /> class.
        /// </summary>
        /// <param name="crash">The crash.</param>
        internal CrashTelemetry(CrashData crash)
        {
            this.Data = crash ?? new CrashData();
            if (this.Data.headers == null)
            {
                this.Data.headers = new CrashDataHeaders();
            }

            this.headers        = new CrashTelemetryHeaders(this.Data.headers);
            this.adapterThreads = new AdapterList <CrashTelemetryThread, CrashDataThread>(
                new List <CrashTelemetryThread>(),
                this.Data.threads,
                threadPublic => threadPublic == null ? null : threadPublic.Data,
                threadPrivate => threadPrivate == null ? null : new CrashTelemetryThread(threadPrivate));
            this.adapterThreads.SyncPrivateToPublic();

            this.adapterBinaries = new AdapterList <CrashTelemetryBinary, CrashDataBinary>(
                new List <CrashTelemetryBinary>(),
                this.Data.binaries,
                binaryPublic => binaryPublic == null ? null : binaryPublic.Data,
                binaryPrivate => binaryPrivate == null ? null : new CrashTelemetryBinary(binaryPrivate));
            this.adapterBinaries.SyncPrivateToPublic();

            this.context     = new TelemetryContext(new Dictionary <string, string>(), new Dictionary <string, string>());
            this.Attachments = new Attachments();
        }
Beispiel #4
0
        public void TestLargeArrangement()
        {
            string[] input    = { "28", "33", "18", "42", "31", "14", "46", "20", "48", "47", "24", "23", "49", "45", "19", "38", "39", "11", "1", "32", "25", "35", "8", "17", "7", "9", "4", "2", "34", "10", "3" };
            var      adapters = new AdapterList(input);

            Assert.AreEqual(19208, adapters.JoltagesArrangements());
        }
Beispiel #5
0
        public void TestSmallArrangements()
        {
            string[] input    = { "16", "10", "15", "5", "1", "11", "7", "19", "6", "12", "4" };
            var      adapters = new AdapterList(input);

            Assert.AreEqual(8, adapters.JoltagesArrangements());
        }
Beispiel #6
0
 private void RangeFinder_Click(object sender, RoutedEventArgs e)
 {
     _adapters = new AdapterList();
     if (_adapters.ShowDialog() == true)
     {
         this.StartIP.IP = _adapters.Start;
         this.EndIP.IP   = _adapters.End;
     }
 }
Beispiel #7
0
        public void LargerTestExample()
        {
            string[] input    = { "28", "33", "18", "42", "31", "14", "46", "20", "48", "47", "24", "23", "49", "45", "19", "38", "39", "11", "1", "32", "25", "35", "8", "17", "7", "9", "4", "2", "34", "10", "3" };
            var      adapters = new AdapterList(input);

            adapters.TraverseAdapters();
            Assert.AreEqual(22, adapters.OneJolts);
            Assert.AreEqual(10, adapters.ThreeJolts);
        }
Beispiel #8
0
        public void TestSmallExample()
        {
            string[] input    = { "16", "10", "15", "5", "1", "11", "7", "19", "6", "12", "4" };
            var      adapters = new AdapterList(input);

            adapters.TraverseAdapters();
            Assert.AreEqual(7, adapters.OneJolts);
            Assert.AreEqual(5, adapters.ThreeJolts);
        }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrashTelemetryThread" /> class.
        /// </summary>
        /// <param name="thread">The thread.</param>
        internal CrashTelemetryThread(CrashDataThread thread)
        {
            this.Data          = thread ?? new CrashDataThread();
            this.adapterFrames = new AdapterList <CrashTelemetryThreadFrame, CrashDataThreadFrame>(
                new List <CrashTelemetryThreadFrame>(),
                this.Data.frames,
                framePublic => framePublic == null ? null : framePublic.Data,
                framePrivate => framePrivate == null ? null : new CrashTelemetryThreadFrame(framePrivate));

            this.adapterFrames.SyncPrivateToPublic();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CrashTelemetryThread" /> class.
        /// </summary>
        /// <param name="thread">The thread.</param>
        internal CrashTelemetryThread(CrashDataThread thread)
        {
            this.Data = thread ?? new CrashDataThread();
            this.adapterFrames = new AdapterList<CrashTelemetryThreadFrame, CrashDataThreadFrame>(
                                                                new List<CrashTelemetryThreadFrame>(),
                                                                this.Data.frames,
                                                                framePublic => framePublic == null ? null : framePublic.Data,
                                                                framePrivate => framePrivate == null ? null : new CrashTelemetryThreadFrame(framePrivate));

            this.adapterFrames.SyncPrivateToPublic();
        }
Beispiel #11
0
        protected override void BeforeReadIDOs()
        {
            base.BeforeReadIDOs();
            IDOItems Items = (IDOItems)PrimaryBusinessObject;

            Items.parm.PropertyList = "";

            AdapterList adptList = new AdapterList
            {
                KeyName = "Item"
            };

            adptList.Add("Item");
            adptList.Add("Description");
            adptList.Add("DerQtyOnHand", AdapterListItem.ValueTypes.Decimal);
            adptList.Add("UM");
            adptList.Add("MatlType");
            adptList.Add("PMTCode");
            adptList.Add("ProductCode");
            adptList.Add("LotTracked", AdapterListItem.ValueTypes.Boolean);
            adptList.Add("SerialTracked", AdapterListItem.ValueTypes.Boolean);
            if (new Configure().LoadPicture)
            {
                adptList.Add("Picture", AdapterListItem.ValueTypes.Bitmap);
            }
            if (QueryString == "")
            {
                //QueryString = "%";
                Items.BuilderFilterByItem("%");
            }
            else
            {
                Items.BuilderFilterByItemOrDesc(QueryString);
            }
            if (LastKey != "")
            {
                Items.BuilderAdditionalFilter(string.Format("Item > N'{0}'", LastKey));
            }
            SetAdapterLists(0, adptList);
        }
Beispiel #12
0
        public virtual void SetAdapterLists(int BaseObjectIndex, AdapterList adapterList)
        {
            string propertyList = BusinessObjects[BaseObjectIndex].parm.PropertyList;

            foreach (AdapterListItem obj in adapterList.ObjectList.Values)
            {
                if (!string.IsNullOrEmpty(obj.Name))
                {
                    if (string.IsNullOrEmpty(propertyList))
                    {
                        propertyList = "" + obj.Name;
                    }
                    else
                    {
                        propertyList += "," + obj.Name;
                    }
                }
            }
            BusinessObjects[BaseObjectIndex].parm.PropertyList = propertyList;
            adapterList.ObjIndex = BaseObjectIndex;
            AdapterListTemplate.Add(adapterList);
        }
Beispiel #13
0
        protected override void BeforeReadIDOs()
        {
            base.BeforeReadIDOs();
            IDOPurchaseOrders Orders = (IDOPurchaseOrders)PrimaryBusinessObject;

            Orders.parm.PropertyList = "";
            AdapterList adptList = new AdapterList()
            {
                KeyName = "PoNum"
            };

            adptList.Add("PoNum");
            adptList.Add("OrderDate", AdapterListItem.ValueTypes.Date);
            adptList.Add("Stat");
            adptList.Add("Type");
            adptList.Add("VendNum");
            adptList.Add("VendorName");
            adptList.Add("Whse");
            SetAdapterLists(0, adptList);

            if (QueryString == "")
            {
                //QueryString = "%";
                Orders.BuilderFilterByPoNum("%");
            }
            else
            {
                Orders.BuilderFilterByPoNumOrVendNumOrVendorName(QueryString);
            }
            if (LastKey != "")
            {
                Orders.BuilderAdditionalFilter(string.Format("PoNum > N'{0}'", LastKey));
            }
            if (DateQueryString != "")
            {
                Orders.BuilderAdditionalFilter(DateQueryString);
            }
            Orders.BuilderAdditionalFilter(string.Format("Stat IN (N'P', N'O') AND Whse = N'{0}'", DefaultWhse()));
        }
        protected override void PostReadIDOs(int index = 0)
        {
            base.PostReadIDOs(index);

            //foreach (BaseBusinessObject o in
            for (int i = 0; i < BusinessObjects[index].GetRowCount(); i++) //go through IDO rows
            {
                foreach (AdapterList ListTemp in AdapterListTemplate)
                {
                    bool skip = false;
                    if (ListTemp.ObjIndex != index)
                    {
                        continue;
                    }
                    AdapterList colonList = new AdapterList
                    {
                        KeyName = ListTemp.KeyName
                    };
                    foreach (string key in ListTemp.ObjectList.Keys) //go through adapter items
                    {
                        AdapterListItem obj = ListTemp.ObjectList[key];

                        //check if the field need to be hide when repeat displaying
                        if (BusinessObjects[index].IsDuplicatedCol(key))
                        {
                            if (i > 0 && BusinessObjects[index].GetPropertyValue(obj.Name, i) == BusinessObjects[index].GetPropertyValue(obj.Name, i - 1))
                            {
                                skip = true;
                                continue;
                            }
                        }

                        AdapterListItem colonItem = new AdapterListItem
                        {
                            Name           = obj.Name,
                            Label          = obj.Label,
                            LayoutID       = obj.LayoutID,
                            ValueType      = obj.ValueType,
                            DisplayedValue = obj.DisplayedValue,
                            Key            = obj.Key,
                            ActivityType   = obj.ActivityType
                        };
                        if (!string.IsNullOrEmpty(obj.Name))
                        {
                            switch (obj.ValueType)
                            {
                            case AdapterListItem.ValueTypes.String:
                                colonItem.Value          = BusinessObjects[index].GetPropertyValue(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Int:
                                colonItem.Value          = BusinessObjects[index].GetPropertyInt(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Decimal:
                                colonItem.Value          = string.Format("{0:###,###,###,###,##0.00######}", BusinessObjects[index].GetPropertyDecimalValue(obj.Name, i));
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Date:
                                colonItem.Value          = BusinessObjects[index].GetPropertyValue(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.DateTime:
                                colonItem.Value          = BusinessObjects[index].GetPropertyValue(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Bitmap:
                                colonItem.Value          = BusinessObjects[index].GetPropertyBitmap(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Boolean:
                                colonItem.Value          = BusinessObjects[index].GetPropertyBoolean(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            default:
                                colonItem.Value = null;
                                break;
                            }
                        }
                        colonList.ObjectList.Add(key, colonItem);
                    }
                    if (!skip)
                    {
                        AdapterLists.Add(colonList);
                    }
                }
            }
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            AdapterList item = objectList[position];

            View     view = convertView;
            TextView Text;
            TextView Label;
            Switch   Switch;

            string Key      = item.GetFirstKey();
            int    LayoutID = item.GetLayoutID(Key);

            try
            {
                if (view == null) // no view to re-use, create new
                {
                    view = context.LayoutInflater.Inflate(item.GetLayoutID(Key), null);
                }
                Label = view.FindViewById <TextView>(Resource.Id.Label);
                Label.SetText(item.GetLabel(Key), null);
                switch (LayoutID)
                {
                case Resource.Layout.CommonLabelSwitchViewer:
                    Switch         = view.FindViewById <Switch>(Resource.Id.Switch);
                    Switch.Checked = item.GetBoolean(Key);
                    break;

                case Resource.Layout.CommonSplitterViewer:
                case Resource.Layout.CommonSplitterSmallViewer:
                    break;

                case Resource.Layout.CommonFloatingLabelEditViewer:
                    Text = view.FindViewById <TextView>(Resource.Id.Text);
                    Text.SetText(item.GetString(Key), null);
                    if (string.IsNullOrEmpty(item.GetString(Key)))
                    {
                        Label.SetText("", null);
                    }
                    Text.Hint         = item.GetLabel(Key);
                    Text.TextChanged += (sender, e) =>
                    {
                        Label.SetText(item.GetLabel(Key), null);
                        item.SetString(Key, Text.Text);
                    };
                    break;

                case Resource.Layout.CommonLabelTextViewer:
                case Resource.Layout.CommonLabelMultiLinesTextViewer:
                default:
                    Text = view.FindViewById <TextView>(Resource.Id.Text);
                    Text.SetText(item.GetString(Key), null);
                    break;
                }
                return(view);
            }
            catch (Exception Ex)
            {
                Toast.MakeText(context, "CSIBaseDetailsAdapter -> GetView() -> " + Ex.Message, ToastLength.Short).Show();
                return(null);
            }
        }