コード例 #1
0
 public static void SummaryStatisticInfo(string from, string method, SummaryItem summaryItem, bool convertFromBase64 = false)
 {
     if (convertFromBase64)
     {
         Debug.WriteLine($"[{from}] {method}");
         Debug.WriteLine($"[{from}] RunItem received object values as base64");
         Debug.WriteLine($"[{from}] \t \t TotalRuns: {SEALUtils.Base64Decode(summaryItem.TotalRuns)}");
         Debug.WriteLine($"[{from}] \t \t TotalDistance: {SEALUtils.Base64Decode(summaryItem.TotalDistance)}");
         Debug.WriteLine($"[{from}] \t \t TotalHours: {SEALUtils.Base64Decode(summaryItem.TotalHours)}");
     }
     else
     {
         Debug.WriteLine($"[{from}] {method}");
         Debug.WriteLine($"[{from}] RunItem received object values as base64");
         Debug.WriteLine($"[{from}] \t \t TotalRuns: " +
                         $"{(summaryItem.TotalRuns.Length > 25 ? summaryItem.TotalRuns.Substring(0, 25) : summaryItem.TotalRuns)}" +
                         $"{(summaryItem.TotalRuns.Length > 25 ? "..." : "")}");
         Debug.WriteLine($"[{from}] \t \t TotalDistance: " +
                         $"{(summaryItem.TotalDistance.Length > 25 ? summaryItem.TotalDistance.Substring(0, 25) : summaryItem.TotalDistance)}" +
                         $"{(summaryItem.TotalDistance.Length > 25 ? "..." : "")}");
         Debug.WriteLine($"[{from}] \t \t TotalHours: " +
                         $"{(summaryItem.TotalHours.Length > 25 ? summaryItem.TotalHours.Substring(0, 25) : summaryItem.TotalHours)}" +
                         $"{(summaryItem.TotalHours.Length > 25 ? "..." : "")}");
     }
 }
コード例 #2
0
        /// <summary>
        /// Occurs each time the average speed changes.  Allows for UI update by marshalling the call accordingly.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MetricsChangedEventHandler(object sender, NormalizedPower.MetricsChangedEventArgs e)
        {
            //if (!m_dispatcher.CheckAccess()) // are we currently on the UI thread?
            //{
            //    // We're not in the UI thread, ask the dispatcher to call this same method in the UI thread, then exit
            //    m_dispatcher.BeginInvoke(new MetricsChangedEventHandlerDelegate(MetricsChangedEventHandler), new object[] { sender, e });
            //    return;
            //}

            lock (this.lvOverall)
            {
                SummaryListViewItem listViewItem = m_summaryHelper.SummaryListViewItem;
                SummaryItem         summaryItem  = listViewItem.SummaryItem;

                summaryItem.Average = e.OverallPower.ToString();

                if (m_currentUser.WeightAsKgs > 0)
                {
                    summaryItem.AverageWkg = Math.Round(e.OverallPower / m_currentUser.WeightAsKgs, 2).ToString("#.00");
                }


                summaryItem.Speed    = e.AverageMph.ToString("#.0");
                summaryItem.SpeedKph = e.AverageKph.ToString("#.0");
            }
        }
コード例 #3
0
        private void FailedStateRegistration(HttpClient client, Guid folderSessionId, Guid processId, string errorMessage)
        {
            OpenAPIService.StatusClient status = new OpenAPIService.StatusClient(WebApi.ToString(), client);

            var failedStateResponse = status.FailedAsync(processId, new BodyMessage {
                Message = errorMessage
            }).GetAwaiter().GetResult();

            if (failedStateResponse.StatusCode != 200)
            {
                throw new ApplicationException(String.Format("Failed state registration returned a bad response (not 200 code)! Action ID {0}, Folder / Session ID {1}.", processId, folderSessionId));
            }

            SummaryItem summaryObj = new SummaryItem {
                Accepted = 0, Processed = 0, Rejected = 1, Start = DateTimeOffset.Now, End = DateTimeOffset.Now
            };
            string summaryStr = JsonConvert.SerializeObject(summaryObj);
            //final update
            var finalUpdateResponse = status.UpdateAsync(processId, new BodyUpdate {
                Result = "Failed", Summary = summaryStr
            }).GetAwaiter().GetResult();

            if (finalUpdateResponse.StatusCode != 200)
            {
                throw new ApplicationException(String.Format("Final update status returned a bad response (not 200 code)! Action ID {0}, Folder / Session ID {1}.", processId, folderSessionId));
            }

            OnNotify(new NotificationEvent {
                Client = client, Id = folderSessionId, Result = NotificationEvent.State.CompletedOrFailed
            });
        }
コード例 #4
0
        //GET: Item
        public ActionResult SummaryItem()
        {
            List <LogItem> logItemList = new List <LogItem>();

            using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["InventoryManagementSoftware.Properties.Settings.ProductConnectionString"].ConnectionString))
            {
                string date = DateTime.Now.ToString("yyyy-MM-dd");
                logItemList = db.Query <LogItem>("Select * From LogItems Where CAST(LastUpdatedTime as DATE)='" + date + "'").ToList();
            }
            Dictionary <String, SummaryItem> checkItems = new Dictionary <string, SummaryItem>();

            for (int i = 0; i < logItemList.Count; i++)
            {
                string currentItem = logItemList[i].ItemBrand + " " + logItemList[i].ItemModel + " " + logItemList[i].ItemName;
                if (!checkItems.ContainsKey(currentItem))
                {
                    SummaryItem newItem = new SummaryItem();
                    newItem.ItemName    = logItemList[i].ItemName;
                    newItem.ItemBrand   = logItemList[i].ItemBrand;
                    newItem.ItemModel   = logItemList[i].ItemModel;
                    newItem.QuantityIn  = logItemList[i].QuantityIn;
                    newItem.QuantityOut = logItemList[i].QuantityOut;
                    checkItems.Add(currentItem, newItem);
                }
                else
                {
                    SummaryItem item;
                    checkItems.TryGetValue(currentItem, out item);
                    item.QuantityIn  = item.QuantityIn + logItemList[i].QuantityIn;
                    item.QuantityOut = item.QuantityOut + logItemList[i].QuantityOut;
                }
            }
            return(View(checkItems.Values.ToList()));
        }
コード例 #5
0
        /// <summary>
        /// Occurs each time the normalized power changes.  Allows for UI update by marshalling the call accordingly.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NormalizedPowerChangedEventHandler(object sender, NormalizedPower.NormalizedPowerChangedEventArgs e)
        {
            //if (!m_dispatcher.CheckAccess()) // are we currently on the UI thread?
            //{
            //    // We're not in the UI thread, ask the dispatcher to call this same method in the UI thread, then exit
            //    m_dispatcher.BeginInvoke(new NormalizedPowerChangedEventHandlerDelegate(NormalizedPowerChangedEventHandler), new object[] { sender, e });
            //    return;
            //}

            lock (this.lvOverall)
            {
                SummaryListViewItem listViewItem = m_summaryHelper.SummaryListViewItem;
                SummaryItem         summaryItem  = listViewItem.SummaryItem;


                if (m_currentUser.PowerThreshold > 0)
                {
                    summaryItem.If = Math.Round(e.NormalizedPower / (double)m_currentUser.PowerThreshold, 2).ToString("#.00");
                }
                else
                {
                    summaryItem.If = ".00";
                }

                summaryItem.Normalized = e.NormalizedPower.ToString();

                if (m_currentUser.WeightAsKgs > 0)
                {
                    summaryItem.NormalizedWkg = Math.Round(e.NormalizedPower / m_currentUser.WeightAsKgs, 2).ToString("#.00");
                }
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: emanbuc/SEAL_TrackerLab
 private static void PrintMetrics(SummaryItem summary)
 {
     Console.WriteLine(string.Empty);
     Console.WriteLine("********* Metrics *********");
     Console.WriteLine($"Total runs: {SEALUtils.Base64Decode(summary.TotalRuns)}");
     Console.WriteLine($"Total distance: {SEALUtils.Base64Decode(summary.TotalDistance)}");
     Console.WriteLine($"Total hours: {SEALUtils.Base64Decode(summary.TotalHours)}");
     Console.WriteLine(string.Empty);
 }
コード例 #7
0
 private static string[] SubItemStrings(SummaryItem item, RefreshUom refreshUom)
 {
     return(new string[]
     {
         item.Description,
         refreshUom == RefreshUom.RefreshImperial ? item.Average : item.AverageWkg,
         refreshUom == RefreshUom.RefreshImperial ? item.Normalized : item.NormalizedWkg,
         item.If,
         refreshUom == RefreshUom.RefreshImperial ? item.Speed : item.SpeedKph
     });
 }
コード例 #8
0
        private void UpdateSummaryNormalizedPower(string If, string Normalized, string NormalizedWkg, string Tss)
        {
            lock (this.lvOverall)
            {
                SummaryListViewItem listViewItem = m_summaryHelper.SummaryListViewItem;
                SummaryItem         summaryItem  = listViewItem.SummaryItem;

                summaryItem.If            = If;
                summaryItem.Normalized    = Normalized;
                summaryItem.NormalizedWkg = NormalizedWkg;
                summaryItem.Tss           = Tss;
            }
        }
コード例 #9
0
        private void UpdateSummaryMetrics(string Average, string AverageWkg, string Speed, string SpeedKph)
        {
            lock (this.lvOverall)
            {
                SummaryListViewItem listViewItem = m_summaryHelper.SummaryListViewItem;
                SummaryItem         summaryItem  = listViewItem.SummaryItem;

                summaryItem.Average    = Average;
                summaryItem.AverageWkg = AverageWkg;
                summaryItem.Speed      = Speed;
                summaryItem.SpeedKph   = SpeedKph;
            }
        }
コード例 #10
0
ファイル: ReadJson.cs プロジェクト: ly774508966/MapMoves
    void SpawnSummary(MovesJson.SummaryInfo summary, bool canChangeWeight)
    {
        if (summary.group == "transport" || summary.duration < 60)
        {
            return;
        }
        GameObject    summaryObject     = Instantiate(summaryPrefab, historySpawn.transform.position, historySpawn.transform.rotation);
        RectTransform summaryObjectRect = summaryObject.GetComponent <RectTransform>();

        summaryObject.transform.SetParent(summariesGO.transform);
        summaryObjectRect.localScale = summaryObjectRect.lossyScale;
        SummaryItem summaryItem = summaryObject.GetComponent <SummaryItem>();

        summaryItem.Setup(summary, canChangeWeight);
        summaries.Add(summaryItem);
    }
コード例 #11
0
        public SummaryPage()
        {
            InitializeComponent();
            BackgroundColor = Color.FromHex("AB000000");
            foreach (ProductionDetails businessDetails in businessSource)
            {
                var item = new SummaryItem();
                item.businessName = businessDetails.bussinessName;
                item.productToGet = new ObservableCollection <ProductDetails>();
                foreach (ProductItem product in businessDetails.productSource)
                {
                    var totalQuantity = 0;
                    foreach (Customer customer in product.customers)
                    {
                        if (customer.borderColor != Color.Red)
                        {
                            totalQuantity += ConvertStringToInt(customer.qty);
                        }
                    }

                    if (totalQuantity != 0)
                    {
                        item.productToGet.Add(new ProductDetails {
                            productImage = product.img, productName = product.title, productQuantity = totalQuantity.ToString()
                        });
                    }
                }

                if (item.productToGet.Count != 0)
                {
                    summarySource.Add(item);
                }
            }

            if (summarySource.Count != 0)
            {
                message.Text = "These are the items you are missing. Please go back to each business shown below and collect all the missing items before viewing your deliveries route.";
            }
            else
            {
                message.Text = "Awesome! You collected all the items to be delivered. Please press the 'continue' button to view your deliveries routes.";
            }
            summaryList.ItemsSource = summarySource;
        }
コード例 #12
0
        public ActionResult <SummaryItem> GetMetrics()
        {
            Ciphertext totalDistance = new Ciphertext();
            int        zero          = 0;
            Plaintext  plainTextZero = new Plaintext($"{zero.ToString("X")}");

            _encryptor.Encrypt(plainTextZero, totalDistance);



            foreach (var dString in _distances)
            {
                var cipherString = SEALUtils.BuildCiphertextFromBase64String(dString, _sealContext);
                _evaluator.Add(totalDistance, cipherString, totalDistance);
            }

            Ciphertext totalHours = new Ciphertext();

            _encryptor.Encrypt(plainTextZero, totalHours);

            foreach (var timeString in _times)
            {
                var cipherTimeString = SEALUtils.BuildCiphertextFromBase64String(timeString, _sealContext);
                _evaluator.Add(totalHours, cipherTimeString, totalHours);
            }

            Ciphertext totalRuns          = new Ciphertext();
            Plaintext  plainTextTotalRuns = new Plaintext($"{_distances.Count.ToString("X")}");

            _encryptor.Encrypt(plainTextTotalRuns, totalRuns);


            var summaryItem = new SummaryItem
            {
                TotalRuns     = SEALUtils.CiphertextToBase64String(totalRuns),
                TotalDistance = SEALUtils.CiphertextToBase64String(totalDistance),
                TotalHours    = SEALUtils.CiphertextToBase64String(totalHours)
            };

            LogUtils.SummaryStatisticInfo("API", "GetMetrics", summaryItem);
            LogUtils.SummaryStatisticInfo("API", "GetMetrics", summaryItem, true);

            return(summaryItem);
        }
コード例 #13
0
        // Adds the two summary ciphers together
        public static string AddSummary(this SummaryItem summaryItem1, SummaryItem summaryItem2)
        {
            String resultBase64 = "";

            try
            {
                Trace.WriteLine("Start AddSummary ");

                SEALWrapper sw = new SEALWrapper(4096);
                sw.AddCiphers(summaryItem1.Summary, summaryItem2.Summary);
                resultBase64 = sw.getAdded();
            }
            catch (Exception e)
            {
                System.Diagnostics.Trace.TraceError("{%s} occurred while Adding Summary ", e);
            }

            Trace.WriteLine("End AddSummary ");

            // Convert to base64
            return(resultBase64);
        }
コード例 #14
0
        public void SetView(SummaryItemDescription groupSummaryItem)
        {
            if (groupSummaryItem != null)
            {
                this.ItemChecked = true;

                this.summaryItem = groupSummaryItem.Copy();

                this.comboBox1.SelectedIndex = groupSummaryItem.OrderIndex;

                this.chkEdItem.Text = this.SummaryItem.ToString();
            }
            else
            {
                this.ItemChecked = false;

                SummaryItem.Revert();

                this.comboBox1.SelectedIndex = 0;

                this.chkEdItem.Text = this.SummaryItem.ToString();
            }
        }
コード例 #15
0
 private IEnumerable <IRecord> GetAllTheseRecords()
 {
     if (_cachedRecords == null)
     {
         _cachedRecords = RecordService
                          .RetrieveAllOrClauses(SummaryItem.RecordTypeSchemaName, SummaryItem
                                                .GetIds()
                                                .Select(id => new Condition(RecordService.GetPrimaryKey(SummaryItem.RecordTypeSchemaName), ConditionType.Equal, id)).ToArray(), null);
     }
     return(_cachedRecords);
 }
コード例 #16
0
        /// <summary>
        /// Provides access to the parent summary item of the current summary item
        /// </summary>
        /// <param name="summaryItem"></param>
        /// <returns></returns>
        private SummaryItem GetParentSummaryItem(SummaryItem summaryItem)
        {
            SummaryItem parentSummaryItem = new SummaryItem();

            if (summaryItem.HierarchyKey == 16) return null;

            var query = from items in _summaryWorkbenchInfo.WorkingSummaryItems
                        select items;

            // Determine which Level to inherit from
            if (summaryItem.HierarchyKey == 9)
            {
                query = query.Where(i => i.HierarchyKey == 10);
                query = query.Where(i => i.Department == summaryItem.Department);
                query = query.Where(i => i.Class == summaryItem.Class);
                query = query.Where(i => i.Market == summaryItem.Market);
                query = query.Where(i => i.Grade == summaryItem.Grade);
            }
            else if (summaryItem.HierarchyKey == 10)
            {
                query = query.Where(i => i.HierarchyKey == 11);
                query = query.Where(i => i.Department == summaryItem.Department);
                query = query.Where(i => i.Class == summaryItem.Class);
                query = query.Where(i => i.Market == summaryItem.Market);
            }
            else if (summaryItem.HierarchyKey == 11)
            {
                query = query.Where(i => i.HierarchyKey == 12);
                query = query.Where(i => i.Department == summaryItem.Department);
                query = query.Where(i => i.Class == summaryItem.Class);
            }
            else if (summaryItem.HierarchyKey == 12)
            {
                query = query.Where(i => i.HierarchyKey == 16);
                query = query.Where(i => i.Department == summaryItem.Department);
            }
            else if (summaryItem.HierarchyKey == 13)
            {
                query = query.Where(i => i.HierarchyKey == 14);
                query = query.Where(i => i.Department == summaryItem.Department);
                query = query.Where(i => i.Market == summaryItem.Market);
                query = query.Where(i => i.Grade == summaryItem.Grade);
            }
            else if (summaryItem.HierarchyKey == 14)
            {
                query = query.Where(i => i.HierarchyKey == 15);
                query = query.Where(i => i.Department == summaryItem.Department);
                query = query.Where(i => i.Market == summaryItem.Market);
            }
            else if (summaryItem.HierarchyKey == 15)
            {
                query = query.Where(i => i.HierarchyKey == 16);
                query = query.Where(i => i.Department == summaryItem.Department);
            }

            parentSummaryItem = query.FirstOrDefault();

            return parentSummaryItem;
        }
コード例 #17
0
 private Literal GetDiscountValueLiteral(SummaryItem summaryItem)
 {
     return(new Literal {
         Text = $"- {CurrencyInfoProvider.GetFormattedPrice(summaryItem.Value, ShoppingCart.Currency)}<br />", EnableViewState = false
     });
 }
コード例 #18
0
 private static Literal GetDiscountNameLiteral(SummaryItem summaryItem)
 {
     return(new Literal {
         Text = $"{HTMLHelper.HTMLEncode(ResHelper.LocalizeString(summaryItem.Name))}:<br />", EnableViewState = false
     });
 }
コード例 #19
0
        private void CompleteNewActionRegistration(HttpClient client, Guid folderSessionId, string errorMessage)
        {
            Entities.CommandKey.ValidationActionType currentActionType = this.ActionTypeName;

            OpenAPIService.StatusClient status = new OpenAPIService.StatusClient(WebApi.ToString(), client);
            //add new
            Guid processId = Guid.Empty;

            status.ProcessResponse += (object sender, Entities.Event.CallEvents e) =>
            {
                dynamic actionRegistration = JsonConvert.DeserializeObject <dynamic>(e.ResponseMessage);
                object  id       = actionRegistration.processId;
                bool    isParsed = Guid.TryParse(id == null ? "" : id.ToString(), out processId);
            };

            var addNewActionResponse = status.NewAsync(folderSessionId, new BodyNewAction
            {
                Name        = currentActionType.ToString(),
                Description = "Action created by WorkerService.",
                Result      = null
            }).GetAwaiter().GetResult();

            if (processId == Guid.Empty)
            {
                throw new ApplicationException("Parsing process (action) ID failed!");
            }

            if (addNewActionResponse.StatusCode != 200)
            {
                throw new ApplicationException(String.Format("New action registration returned a bad response (not 200 code)! Action ID {0}, Folder/Session ID {1}.", processId, folderSessionId));
            }
            //add 2 records (started/failed) for state
            var startStateResponse = status.StartAsync(processId).GetAwaiter().GetResult();

            if (startStateResponse.StatusCode != 200)
            {
                throw new ApplicationException(String.Format("Start state registration returned a bad response (not 200 code)! Action ID {0}, Folder / Session ID {1}.", processId, folderSessionId));
            }

            OnNotify(new NotificationEvent {
                Client = client, Id = folderSessionId, Result = NotificationEvent.State.Started
            });

            var failedStateResponse = status.FailedAsync(processId, new BodyMessage {
                Message = errorMessage
            }).GetAwaiter().GetResult();

            if (failedStateResponse.StatusCode != 200)
            {
                throw new ApplicationException(String.Format("Failed state registration returned a bad response (not 200 code)! Action ID {0}, Folder / Session ID {1}.", processId, folderSessionId));
            }

            SummaryItem summaryObj = new SummaryItem {
                Accepted = 0, Processed = 0, Rejected = 1, Start = DateTimeOffset.Now, End = DateTimeOffset.Now
            };
            string summaryStr = JsonConvert.SerializeObject(summaryObj);
            //final update
            var finalUpdateResponse = status.UpdateAsync(processId, new BodyUpdate {
                Result = "Failed", Summary = summaryStr
            }).GetAwaiter().GetResult();

            if (finalUpdateResponse.StatusCode != 200)
            {
                throw new ApplicationException(String.Format("Final update status returned a bad response (not 200 code)! Action ID {0}, Folder / Session ID {1}.", processId, folderSessionId));
            }

            OnNotify(new NotificationEvent {
                Client = client, Id = folderSessionId, Result = NotificationEvent.State.CompletedOrFailed
            });
        }
コード例 #20
0
 public SummaryListViewItem(SummaryItem item) : base(SubItemStrings(item, RefreshUom.RefreshImperial))
 {
     this.SummaryItem = item;
 }
コード例 #21
0
 public void MapValues()
 {
     Collectible.TryMapValue();
     SummaryItem.TryMapValue();
     foreach (var itemCategory in ItemCategories)
     {
         itemCategory.TryMapValue();
     }
     BreakerType.TryMapValue();
     DefaultDamageType.TryMapValue();
     if (Stats != null)
     {
         Stats.StatGroup.TryMapValue();
         Stats.PrimaryBaseStat.TryMapValue();
         foreach (var stat in Stats.Stats)
         {
             stat.Key.TryMapValue();
             stat.Value.Stat.TryMapValue();
         }
     }
     TalentGrid?.TalentGrid.TryMapValue();
     if (Value != null)
     {
         foreach (var value in Value.ItemValue)
         {
             value.Item.TryMapValue();
         }
     }
     if (SetData != null)
     {
         foreach (var setDataItem in SetData.ItemList)
         {
             setDataItem.Item.TryMapValue();
         }
     }
     if (Plug != null)
     {
         Plug.EnabledMaterialRequirement.TryMapValue();
         Plug.EnergyCapacity?.EnergyType.TryMapValue();
         Plug.EnergyCost?.EnergyType.TryMapValue();
         Plug.InsertionMaterialRequirement.TryMapValue();
         Plug.PlugCategory.TryMapValue();
         Plug.PreviewItemOverride.TryMapValue();
     }
     if (Preview != null)
     {
         Preview.Artifact.TryMapValue();
         Preview.PreviewVendor.TryMapValue();
         foreach (var category in Preview.DerivedItemCategories)
         {
             foreach (var item in category.Items)
             {
                 item.Item.TryMapValue();
             }
         }
     }
     if (Quality != null)
     {
         Quality.ProgressionLevelRequirement.TryMapValue();
         foreach (var version in Quality.Versions)
         {
             version.PowerCap.TryMapValue();
         }
     }
     if (Objectives != null)
     {
         foreach (var activity in Objectives.DisplayActivities)
         {
             activity.TryMapValue();
         }
         foreach (var objective in Objectives.Objectives)
         {
             objective.TryMapValue();
         }
         Objectives.QuestlineItem.TryMapValue();
         foreach (var property in Objectives.PerObjectiveDisplayProperties)
         {
             property.Activity.TryMapValue();
         }
     }
     Inventory.BucketType.TryMapValue();
     Inventory.TierType.TryMapValue();
     Inventory.RecoveryBucketType.TryMapValue();
     if (Action != null)
     {
         foreach (var reward in Action.ProgressionRewards)
         {
             reward.ProgressionMapping.TryMapValue();
         }
         foreach (var item in Action.RequiredItems)
         {
             item.Item.TryMapValue();
         }
         Action.RewardSheet.TryMapValue();
     }
     if (EquippingBlock != null)
     {
         EquippingBlock.EquipmentSlotType.TryMapValue();
         EquippingBlock.GearsetItem.TryMapValue();
     }
     if (Sockets != null)
     {
         foreach (var intrinsicSocket in Sockets.IntrinsicSockets)
         {
             intrinsicSocket.PlugItem.TryMapValue();
             intrinsicSocket.SocketType.TryMapValue();
         }
         foreach (var socketCategory in Sockets.SocketCategories)
         {
             socketCategory.SocketCategory.TryMapValue();
         }
         foreach (var socket in Sockets.SocketEntries)
         {
             socket.RandomizedPlugSet.TryMapValue();
             socket.ReusablePlugSet.TryMapValue();
             socket.SingleInitialItem.TryMapValue();
             socket.SocketType.TryMapValue();
         }
     }
     foreach (var stat in InvestmentStats)
     {
         stat.StatType.TryMapValue();
     }
     foreach (var perk in Perks)
     {
         perk.Perk.TryMapValue();
     }
     if (Gearset != null)
     {
         foreach (var item in Gearset.Items)
         {
             item.TryMapValue();
         }
     }
     EmblemObjective.TryMapValue();
     if (SourceData != null)
     {
         foreach (var rewardSource in SourceData.RewardSources)
         {
             rewardSource.TryMapValue();
         }
         foreach (var source in SourceData.Sources)
         {
             foreach (var sourceSource in source.Sources)
             {
                 sourceSource.TryMapValue();
             }
         }
         foreach (var vendorSource in SourceData.VendorSources)
         {
             vendorSource.Vendor.TryMapValue();
         }
     }
     if (Metrics != null)
     {
         foreach (var node in Metrics.AvailableMetricCategoryNodes)
         {
             node.TryMapValue();
         }
     }
     Lore.TryMapValue();
     foreach (var type in DamageTypes)
     {
         type.TryMapValue();
     }
     Season.TryMapValue();
 }
コード例 #22
0
 public bool DeepEquals(DestinyInventoryItemDefinition other)
 {
     return(other != null &&
            Collectible.DeepEquals(other.Collectible) &&
            SummaryItem.DeepEquals(other.SummaryItem) &&
            ItemCategories.DeepEqualsReadOnlyCollections(other.ItemCategories) &&
            AcquireRewardSiteHash == other.AcquireRewardSiteHash &&
            AcquireUnlockHash == other.AcquireUnlockHash &&
            AllowActions == other.AllowActions &&
            (BackgroundColor != null ? BackgroundColor.DeepEquals(other.BackgroundColor) : other.BackgroundColor == null) &&
            BreakerTypeEnumValue == other.BreakerTypeEnumValue &&
            BreakerType.DeepEquals(other.BreakerType) &&
            ClassType == other.ClassType &&
            DefaultDamageTypeEnumValue == other.DefaultDamageTypeEnumValue &&
            DefaultDamageType.DeepEquals(other.DefaultDamageType) &&
            ItemSubType == other.ItemSubType &&
            ItemType == other.ItemType &&
            SpecialItemType == other.SpecialItemType &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            DisplaySource == other.DisplaySource &&
            DoesPostmasterPullHaveSideEffects == other.DoesPostmasterPullHaveSideEffects &&
            Equippable == other.Equippable &&
            IconWatermark == other.IconWatermark &&
            IconWatermarkShelved == other.IconWatermarkShelved &&
            IsWrapper == other.IsWrapper &&
            ItemTypeAndTierDisplayName == other.ItemTypeAndTierDisplayName &&
            ItemTypeDisplayName == other.ItemTypeDisplayName &&
            UiItemDisplayStyle == other.UiItemDisplayStyle &&
            NonTransferrable == other.NonTransferrable &&
            SecondaryIcon == other.SecondaryIcon &&
            SecondaryOverlay == other.SecondaryOverlay &&
            SecondarySpecial == other.SecondarySpecial &&
            Screenshot == other.Screenshot &&
            TooltipStyle == other.TooltipStyle &&
            TraitIds.DeepEqualsReadOnlySimpleCollection(other.TraitIds) &&
            (Stats != null ? Stats.DeepEquals(other.Stats) : other.Stats == null) &&
            (TalentGrid != null ? TalentGrid.DeepEquals(other.TalentGrid) : other.TalentGrid == null) &&
            (TranslationBlock != null ? TranslationBlock.DeepEquals(other.TranslationBlock) : other.TranslationBlock == null) &&
            (Value != null ? Value.DeepEquals(other.Value) : other.Value == null) &&
            (SetData != null ? SetData.DeepEquals(other.SetData) : other.SetData == null) &&
            (Plug != null ? Plug.DeepEquals(other.Plug) : other.Plug == null) &&
            (Preview != null ? Preview.DeepEquals(other.Preview) : other.Preview == null) &&
            (Quality != null ? Quality.DeepEquals(other.Quality) : other.Quality == null) &&
            (Objectives != null ? Objectives.DeepEquals(other.Objectives) : other.Objectives == null) &&
            Inventory.DeepEquals(other.Inventory) &&
            (Action != null ? Action.DeepEquals(other.Action) : other.Action == null) &&
            (EquippingBlock != null ? EquippingBlock.DeepEquals(other.EquippingBlock) : other.EquippingBlock == null) &&
            (Sockets != null ? Sockets.DeepEquals(other.Sockets) : other.Sockets == null) &&
            InvestmentStats.DeepEqualsReadOnlyCollections(other.InvestmentStats) &&
            Perks.DeepEqualsReadOnlyCollections(other.Perks) &&
            TooltipNotifications.DeepEqualsReadOnlyCollections(other.TooltipNotifications) &&
            (Sack != null ? Sack.DeepEquals(other.Sack) : other.Sack == null) &&
            (Gearset != null ? Gearset.DeepEquals(other.Gearset) : other.Gearset == null) &&
            EmblemObjective.DeepEquals(other.EmblemObjective) &&
            (SourceData != null ? SourceData.DeepEquals(other.SourceData) : other.SourceData == null) &&
            (Metrics != null ? Metrics.DeepEquals(other.Metrics) : other.Metrics == null) &&
            (Summary != null ? Summary.DeepEquals(other.Summary) : other.Summary == null) &&
            Lore.DeepEquals(other.Lore) &&
            Animations.DeepEqualsReadOnlyCollections(other.Animations) &&
            Links.DeepEqualsReadOnlyCollections(other.Links) &&
            DamageTypes.DeepEqualsReadOnlyCollections(other.DamageTypes) &&
            DamageTypeEnumValues.DeepEqualsReadOnlySimpleCollection(other.DamageTypeEnumValues) &&
            Season.DeepEquals(other.Season) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
コード例 #23
0
        /// <summary>
        /// Maintains status of uplift factor lever
        /// </summary>
        /// <param name="summaryItem"></param>
        private void SetUpliftFactor(SummaryItem summaryItem)
        {
            if (summaryItem.UpliftFactor == null)
            {
                if (summaryItem.UpliftStatus == "A")
                    summaryItem.UpliftStatus = "U";
                else
                    summaryItem.UpliftStatus = "D";

                var parent = ((SummaryItem)GetParentSummaryItem(summaryItem));
                summaryItem.UpliftFactor = parent.UpliftFactor;
                summaryItem.UpliftActualFlag = false;
                summaryItem.UpliftInheritedLevel = parent.UpliftInheritedLevel;
            }
            else
            {
                // If this is already an actual lever value this is a 'C'hange
                if (summaryItem.UpliftActualFlag == true && summaryItem.UpliftStatus != "A")
                    summaryItem.UpliftStatus = "C";
                else // Otherwise mark it as an 'A'dded Lever
                    summaryItem.UpliftStatus = "A";

                summaryItem.UpliftActualFlag = true;
                summaryItem.UpliftInheritedLevel = 0;
            }
        }
コード例 #24
0
ファイル: libs.cs プロジェクト: oghenez/trade-software
        public static databases.baseDS.tradeAlertDataTable MakeAlertSummary(databases.baseDS.tradeAlertDataTable tbl)
        {
            SummaryItem buyCount, sellCount;
            databases.baseDS.tradeAlertRow sumRow;
            databases.baseDS.tradeAlertDataTable sumTbl = new databases.baseDS.tradeAlertDataTable();
            sumTbl.DefaultView.Sort = sumTbl.onTimeColumn.ColumnName + "," + sumTbl.stockCodeColumn.ColumnName;
            DataRowView[] foundRows;
            common.DictionaryList buyCountList = new common.DictionaryList();
            common.DictionaryList sellCountList = new common.DictionaryList();

            object obj;
            //Sum
            for (int idx = 0; idx < tbl.Count; idx++)
            {
                foundRows = sumTbl.DefaultView.FindRows(new object[] { tbl[idx].onTime.Date, tbl[idx].stockCode });
                if (foundRows.Length != 0)
                    sumRow = (databases.baseDS.tradeAlertRow)foundRows[0].Row;
                else
                {
                    sumRow = sumTbl.NewtradeAlertRow();
                    databases.AppLibs.InitData(sumRow);
                    sumRow.onTime = tbl[idx].onTime.Date;
                    sumRow.stockCode = tbl[idx].stockCode;
                    sumTbl.AddtradeAlertRow(sumRow);
                }
                AppTypes.TradeActions action = (AppTypes.TradeActions)tbl[idx].tradeAction;
                switch (action)
                {
                    case AppTypes.TradeActions.Buy:
                    case AppTypes.TradeActions.Accumulate:
                        obj = buyCountList.Find(sumRow.onTime.ToString() + sumRow.stockCode);
                        if (obj == null)
                            buyCount = new SummaryItem(sumRow.stockCode, sumRow.onTime);
                        else buyCount = (SummaryItem)obj;
                        buyCount.Qty++;
                        buyCountList.Add(sumRow.onTime.ToString() + sumRow.stockCode, buyCount);
                        break;
                    case AppTypes.TradeActions.Sell:
                    case AppTypes.TradeActions.ClearAll:
                        obj = sellCountList.Find(sumRow.onTime.ToString() + sumRow.stockCode);
                        if (obj == null)
                            sellCount = new SummaryItem(sumRow.stockCode, sumRow.onTime);
                        else sellCount = (SummaryItem)obj;
                        sellCount.Qty++;
                        sellCountList.Add(sumRow.onTime.Date.ToString() + sumRow.stockCode, sellCount);
                        break;
                }
            }
            //Make summary message
            for (int idx = 0; idx < sumTbl.Count; idx++)
            {
                sumTbl[idx].msg = "";
                obj = buyCountList.Find(sumTbl[idx].onTime.ToString() + sumTbl[idx].stockCode);
                if (obj != null)
                    sumTbl[idx].msg += (sumTbl[idx].msg.Trim() != "" ? " , " : "") + (obj as SummaryItem).Qty.ToString() + " " + Languages.Libs.GetString("buyAlert");

                obj = sellCountList.Find(sumTbl[idx].onTime.ToString() + sumTbl[idx].stockCode);
                if (obj != null)
                    sumTbl[idx].msg += (sumTbl[idx].msg.Trim() != "" ? " , " : "") + (obj as SummaryItem).Qty.ToString() + " " + Languages.Libs.GetString("sellAlert");
            }
            return sumTbl;
        }
コード例 #25
0
        public void Deserialize(XmlNode node)
        {
            double tempDouble;
            Guid   tempGuid;

            foreach (XmlAttribute programAttribute in node.Attributes)
            {
                switch (programAttribute.Name)
                {
                case "Name":
                    _name = programAttribute.Value;
                    break;

                case "UniqueID":
                    if (Guid.TryParse(programAttribute.Value, out tempGuid))
                    {
                        UniqueID = tempGuid;
                    }
                    break;

                case "Station":
                    Station = programAttribute.Value;
                    break;

                case "Daypart":
                    Daypart = programAttribute.Value;
                    break;

                case "Day":
                    Day = programAttribute.Value;
                    break;

                case "Time":
                    Time = programAttribute.Value;
                    break;

                case "Length":
                    Length = programAttribute.Value;
                    break;

                case "Rate":
                    if (double.TryParse(programAttribute.Value, out tempDouble))
                    {
                        Rate = tempDouble;
                    }
                    break;

                case "Rating":
                    if (double.TryParse(programAttribute.Value, out tempDouble))
                    {
                        Rating = tempDouble;
                    }
                    break;
                }
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                switch (childNode.Name)
                {
                case "Spots":
                    foreach (XmlNode spotNode in childNode.ChildNodes)
                    {
                        var spot = new Spot(this);
                        spot.Deserialize(spotNode);
                        Spots.Add(spot);
                    }
                    break;

                case "SummaryItem":
                    SummaryItem.Deserialize(childNode);
                    break;

                case "Logo":
                    Logo = new ImageSource();
                    Logo.Deserialize(childNode);
                    break;
                }
            }
        }
コード例 #26
0
ファイル: Program.cs プロジェクト: 3583Bytes/UnitySlim
        static void Main(string[] args)
        {
            //Set Default Values, used if no args are passed
            string fileName = Utils.GetDefaultFilePath();
            int    limiter  = 20;

            if (args.Length == 0)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("No Arguments Found using default values");
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.White;
            }

            foreach (string arg in args)
            {
                //TryParse overwrites to 0 on failure.
                int tmp;
                //Check if parameter is the limiter (int)
                bool success = Int32.TryParse(args[0], out tmp);

                if (success)
                {
                    limiter = tmp;
                }
                //Not limiter maybe its -h for help
                else
                {
                    //Display Help
                    if (arg == "-h" || arg == "-help")
                    {
                        Console.WriteLine("Usage: UnitySlim [filepath] [limiter]");
                        Console.WriteLine();
                        Console.WriteLine("Unity Game Engine Build Size Analyzer.");
                        Console.WriteLine();
                        Console.WriteLine("filepath : Path to the Editor.log file created by Unity at build time.");
                        Console.WriteLine("limiter  : Number of assets to display sorted by size desc");
                        Console.WriteLine();
                        return;
                    }
                    else
                    {
                        //Maybe it is a file
                        if (File.Exists(arg))
                        {
                            fileName = arg;
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            Console.WriteLine("Warning:" + arg + "is not a valid argument");
                            Console.WriteLine();
                            Console.ForegroundColor = ConsoleColor.White;
                        }
                    }
                }
            }

            // We still want to check if file exists in case we are using a default path
            if (!File.Exists(fileName))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error: Invalid Path: " + fileName);
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.White;
                return;
            }
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Found Editor Log: " + fileName);
            Console.WriteLine();

            LogParser parser = new LogParser(fileName);

            //Parse Editor Log to get Results
            parser.LoadFile().Wait();

            List <SummaryItem> summaryData = new List <SummaryItem>();

            //Display Summary
            foreach (LogItem item in parser.Result)
            {
                var tempItem = new SummaryItem {
                    ItemType = Utils.GetRootFolder(item.ItemPath), ItemSize = item.ItemSize
                };

                if (!summaryData.Contains(tempItem))
                {
                    summaryData.Add(new SummaryItem {
                        ItemType = Utils.GetRootFolder(item.ItemPath), ItemSize = item.ItemSize
                    });
                }
                else
                {
                    summaryData.Find(x => x.ItemType.Contains(tempItem.ItemType)).ItemSize += tempItem.ItemSize;
                }
            }

            //Display Summary
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("Summary:");
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.White;
            foreach (SummaryItem item in summaryData)
            {
                if (item.ItemSize >= 1000)
                {
                    Console.WriteLine(item.ItemType + " " + Math.Round(item.ItemSize / 1000, 2) + " mb");
                }
                else
                {
                    Console.WriteLine(item.ItemType + " " + Math.Round(item.ItemSize, 2) + " kb");
                }
            }

            //Display Results
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine();
            Console.WriteLine("Top " + limiter + " Assets By Size:");
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.White;
            int count = 0;

            foreach (LogItem item in parser.Result)
            {
                count++;
                if (item.ItemSize >= 1000)
                {
                    Console.WriteLine(Math.Round(item.ItemSize / 1000, 2) + " mb " + item.ItemPercent + "% " + Utils.ShrinkPath(item.ItemPath, 90));
                }
                else
                {
                    Console.WriteLine(Math.Round(item.ItemSize, 2) + " kb " + item.ItemPercent + "% " + Utils.ShrinkPath(item.ItemPath, 90));
                }

                if (count >= limiter)
                {
                    break;
                }
            }
        }
コード例 #27
0
 private static LocalizedLabel GetDiscountNameLabel(SummaryItem summaryItem)
 {
     return(new LocalizedLabel {
         Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(summaryItem.Name)) + ":", EnableViewState = false
     });
 }
コード例 #28
0
 public BalanceSheetRow GetSummaryItem(SummaryItem item)
 {
     return(summaryItems[item]);
 }
コード例 #29
0
 private Label GetDiscountValueLabel(SummaryItem summaryItem)
 {
     return(new Label {
         Text = "- " + CurrencyInfoProvider.GetFormattedPrice(summaryItem.Value, ShoppingCart.Currency), EnableViewState = false
     });
 }
コード例 #30
0
        public void Deserialize(XmlNode node)
        {
            int     tempInt;
            decimal tempDecimal;

            foreach (XmlAttribute productAttribute in node.Attributes)
            {
                switch (productAttribute.Name)
                {
                    #region Basic Properties
                case "Name":
                    Name = productAttribute.Value;
                    break;

                case "UniqueID":
                    Guid tempGuid;
                    if (Guid.TryParse(productAttribute.Value, out tempGuid))
                    {
                        UniqueID = tempGuid;
                    }
                    break;

                case "Index":
                    if (int.TryParse(productAttribute.Value, out tempInt))
                    {
                        Index = tempInt;
                    }
                    break;

                case "Category":
                    Category = productAttribute.Value;
                    break;

                case "SubCategory":
                    SubCategory = productAttribute.Value;
                    break;

                case "RateType":
                    RateType = productAttribute.Value;
                    switch (RateType)
                    {
                    case "0":
                        RateType = "CPM";
                        break;

                    case "1":
                        RateType = "Fixed";
                        break;
                    }
                    break;

                case "Location":
                    Location = productAttribute.Value;
                    break;

                case "Width":
                    if (int.TryParse(productAttribute.Value, out tempInt))
                    {
                        Width = tempInt;
                    }
                    else
                    {
                        Width = null;
                    }
                    break;

                case "Height":
                    if (int.TryParse(productAttribute.Value, out tempInt))
                    {
                        Height = tempInt;
                    }
                    else
                    {
                        Height = null;
                    }
                    break;

                case "EnableTarget":
                {
                    bool temp;
                    if (Boolean.TryParse(productAttribute.Value, out temp))
                    {
                        EnableTarget = temp;
                    }
                }
                break;

                case "EnableLocation":
                {
                    bool temp;
                    if (Boolean.TryParse(productAttribute.Value, out temp))
                    {
                        EnableLocation = temp;
                    }
                }
                break;

                case "EnableRichMedia":
                {
                    bool temp;
                    if (Boolean.TryParse(productAttribute.Value, out temp))
                    {
                        EnableRichMedia = temp;
                    }
                }
                break;
                    #endregion

                    #region Additional Properties
                case "UserDefinedName":
                    UserDefinedName = productAttribute.Value;
                    break;

                case "DurationType":
                    DurationType = productAttribute.Value;
                    break;

                case "DurationValue":
                    if (int.TryParse(productAttribute.Value, out tempInt))
                    {
                        DurationValue = tempInt;
                    }
                    else
                    {
                        DurationValue = null;
                    }
                    break;

                case "Strength1":
                    Strength1 = productAttribute.Value;
                    break;

                case "Strength2":
                    Strength2 = productAttribute.Value;
                    break;

                case "MonthlyInvestment":
                    if (Decimal.TryParse(productAttribute.Value, out tempDecimal))
                    {
                        MonthlyInvestment = tempDecimal;
                    }
                    else
                    {
                        MonthlyInvestment = null;
                    }
                    break;

                case "MonthlyImpressions":
                    if (Decimal.TryParse(productAttribute.Value, out tempDecimal))
                    {
                        MonthlyImpressions = tempDecimal;
                    }
                    else
                    {
                        MonthlyImpressions = null;
                    }
                    break;

                case "MonthlyCPM":
                    if (Decimal.TryParse(productAttribute.Value, out tempDecimal))
                    {
                        MonthlyCPM = tempDecimal;
                    }
                    else
                    {
                        MonthlyCPM = null;
                    }
                    break;

                case "TotalInvestment":
                    if (Decimal.TryParse(productAttribute.Value, out tempDecimal))
                    {
                        TotalInvestment = tempDecimal;
                    }
                    else
                    {
                        TotalInvestment = null;
                    }
                    break;

                case "TotalImpressions":
                    if (Decimal.TryParse(productAttribute.Value, out tempDecimal))
                    {
                        TotalImpressions = tempDecimal;
                    }
                    else
                    {
                        TotalImpressions = null;
                    }
                    break;

                case "TotalCPM":
                    if (Decimal.TryParse(productAttribute.Value, out tempDecimal))
                    {
                        TotalCPM = tempDecimal;
                    }
                    else
                    {
                        TotalCPM = null;
                    }
                    break;

                case "DefaultRate":
                    if (Decimal.TryParse(productAttribute.Value, out tempDecimal))
                    {
                        DefaultRate = tempDecimal;
                    }
                    else
                    {
                        DefaultRate = null;
                    }
                    break;

                case "Formula":
                    if (int.TryParse(productAttribute.Value, out tempInt))
                    {
                        Formula = (FormulaType)tempInt;
                    }
                    break;

                case "InvestmentDetails":
                    InvestmentDetails = productAttribute.Value;
                    break;

                case "EnableComment":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        EnableComment = tempBool;
                    }
                }
                break;

                case "CommentManualEdit":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        CommentManualEdit = tempBool;
                    }
                }
                break;

                case "ShowCommentTargeting":
                {
                    bool temp;
                    if (Boolean.TryParse(productAttribute.Value, out temp))
                    {
                        ShowCommentTargeting = temp;
                    }
                }
                break;

                case "ShowCommentRichMedia":
                {
                    bool temp;
                    if (Boolean.TryParse(productAttribute.Value, out temp))
                    {
                        ShowCommentRichMedia = temp;
                    }
                }
                break;

                case "Comment":
                    _userComment = productAttribute.Value;
                    break;

                case "DescriptionManualEdit":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        DescriptionManualEdit = tempBool;
                    }
                }
                break;

                case "ShowDimensions":
                {
                    bool temp;
                    if (Boolean.TryParse(productAttribute.Value, out temp))
                    {
                        ShowDimensions = temp;
                    }
                }
                break;

                case "ShowDescriptionTargeting":
                {
                    bool temp;
                    if (Boolean.TryParse(productAttribute.Value, out temp))
                    {
                        ShowDescriptionTargeting = temp;
                    }
                }
                break;

                case "ShowDescriptionRichMedia":
                {
                    bool temp;
                    if (Boolean.TryParse(productAttribute.Value, out temp))
                    {
                        ShowDescriptionRichMedia = temp;
                    }
                }
                break;

                case "Description":
                    Description = productAttribute.Value;
                    break;

                case "UserDescription":
                    _userDescription = productAttribute.Value;
                    break;
                    #endregion

                    #region Show Properties
                case "ShowFlightDates":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        ShowFlightDates = tempBool;
                    }
                }
                break;

                case "ShowDuration":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        ShowDuration = tempBool;
                    }
                }
                break;

                case "ShowAllPricingMonthly":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        ShowAllPricingMonthly = tempBool;
                    }
                }
                break;

                case "ShowAllPricingTotal":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        ShowAllPricingTotal = tempBool;
                    }
                }
                break;

                case "ShowMonthlyInvestments":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        ShowMonthlyInvestments = tempBool;
                    }
                }
                break;

                case "ShowMonthlyImpressions":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        ShowMonthlyImpressions = tempBool;
                    }
                }
                break;

                case "ShowTotalInvestments":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        ShowTotalInvestments = tempBool;
                    }
                }
                break;

                case "ShowTotalImpressions":
                {
                    bool tempBool;
                    if (bool.TryParse(productAttribute.Value, out tempBool))
                    {
                        ShowTotalImpressions = tempBool;
                    }
                }
                break;
                    #endregion
                }
            }
            Websites.Clear();
            foreach (XmlNode childNode in node.ChildNodes)
            {
                switch (childNode.Name)
                {
                case "Website":
                    Websites.Add(childNode.InnerText);
                    break;

                case "PackageRecord":
                    PackageRecord.Deserialize(childNode);
                    break;

                case "SummaryItem":
                    SummaryItem.Deserialize(childNode);
                    break;

                case "ProductInfo":
                    var productInfo = new ProductInfo();
                    productInfo.Deserialize(childNode);
                    AddtionalInfo.Add(productInfo);
                    break;
                }
            }
        }
コード例 #31
0
        /// <summary>
        /// Removes all overrides from the current level
        /// </summary>
        private void RemoveOverridesFromLevel()
        {
            SummaryItem parentSummaryItem = new SummaryItem();
            _summaryWorkbenchInfo.ChangedSummaryItems.Clear();

            foreach (SummaryItem summaryItem in _summaryWorkbenchInfo.WorkingSummaryItems
                .Where(i => i.HierarchyKey.Equals(_summaryWorkbenchInfo.SelectedSummaryLevel))
                .Where(i => i.AllocationActualFlag.Equals(true)
                         || i.CutOffActualFlag.Equals(true)
                         || i.PatternActualFlag.Equals(true)
                         || i.SmoothFactorActualFlag.Equals(true)
                         || i.UpliftActualFlag.Equals(true))
                 )
            {
                parentSummaryItem = GetParentSummaryItem(summaryItem);
                if (summaryItem.AllocationActualFlag == true)
                {
                    summaryItem.Allocation = parentSummaryItem.Allocation;
                    summaryItem.AllocationActualFlag = false;
                    summaryItem.AllocationStatus = "D";

                    if (parentSummaryItem.AllocationActualFlag)
                    {
                        summaryItem.AllocationInheritedLevel = parentSummaryItem.HierarchyKey;
                    }
                    else
                    {
                        summaryItem.AllocationInheritedLevel = parentSummaryItem.AllocationInheritedLevel;
                    }

                    _summaryWorkbenchInfo.ApplyAllocationToLowerLevels(_summaryWorkbenchInfo.SelectedSummaryLevel, summaryItem);
                }

                if (summaryItem.CutOffActualFlag == true)
                {
                    summaryItem.CutOff = parentSummaryItem.CutOff;
                    summaryItem.CutOffActualFlag = false;
                    summaryItem.CutOffStatus = "D";

                    if (parentSummaryItem.CutOffActualFlag)
                    {
                        summaryItem.CutOffInheritedLevel = parentSummaryItem.HierarchyKey;
                    }
                    else
                    {
                        summaryItem.CutOffInheritedLevel = parentSummaryItem.CutOffInheritedLevel;
                    }

                    _summaryWorkbenchInfo.ApplyCutoffToLowerLevels(_summaryWorkbenchInfo.SelectedSummaryLevel, summaryItem);
                }

                if (summaryItem.PatternActualFlag == true)
                {
                    summaryItem.Pattern = parentSummaryItem.Pattern;
                    summaryItem.PatternActualFlag = false;
                    summaryItem.PatternStatus = "D";

                    if (parentSummaryItem.PatternActualFlag)
                    {
                        summaryItem.PatternInheritedLevel = parentSummaryItem.HierarchyKey;
                    }
                    else
                    {
                        summaryItem.PatternInheritedLevel = parentSummaryItem.PatternInheritedLevel;
                    }

                    _summaryWorkbenchInfo.ApplyPatternToLowerLevels(_summaryWorkbenchInfo.SelectedSummaryLevel, summaryItem);
                }

                if (summaryItem.SmoothFactorActualFlag == true)
                {
                    summaryItem.SmoothFactor = parentSummaryItem.SmoothFactor;
                    summaryItem.SmoothFactorActualFlag = false;
                    summaryItem.SmoothFactorStatus = "D";

                    if (parentSummaryItem.SmoothFactorActualFlag)
                    {
                        summaryItem.SmoothFactorInheritedLevel = parentSummaryItem.HierarchyKey;
                    }
                    else
                    {
                        summaryItem.SmoothFactorInheritedLevel = parentSummaryItem.SmoothFactorInheritedLevel;
                    }

                    _summaryWorkbenchInfo.ApplySmoothFactorToLowerLevels(_summaryWorkbenchInfo.SelectedSummaryLevel, summaryItem);
                }

                if (summaryItem.UpliftActualFlag == true)
                {
                    summaryItem.UpliftFactor = parentSummaryItem.UpliftFactor;
                    summaryItem.UpliftActualFlag = false;
                    summaryItem.UpliftStatus = "D";

                    if (parentSummaryItem.UpliftActualFlag)
                    {
                        summaryItem.UpliftInheritedLevel = parentSummaryItem.HierarchyKey;
                    }
                    else
                    {
                        summaryItem.UpliftInheritedLevel = parentSummaryItem.UpliftInheritedLevel;
                    }

                    _summaryWorkbenchInfo.ApplyUpliftFactorToLowerLevels(_summaryWorkbenchInfo.SelectedSummaryLevel, summaryItem);
                }

                summaryItem.Changed = "1";
                _summaryWorkbenchInfo.ChangedSummaryItems.Add(summaryItem);

            }

            if (_summaryWorkbenchInfo.Save())
                RefreshGrid(GetCurrentGrid(), GetCurrentView(), _summaryWorkbenchInfo.SelectedSummaryLevel);
            else
                UpdateStatusMessage("Failed to save changes");
        }
コード例 #32
0
        public static databases.baseDS.tradeAlertDataTable MakeAlertSummary(databases.baseDS.tradeAlertDataTable tbl)
        {
            SummaryItem buyCount, sellCount;

            databases.baseDS.tradeAlertRow       sumRow;
            databases.baseDS.tradeAlertDataTable sumTbl = new databases.baseDS.tradeAlertDataTable();
            sumTbl.DefaultView.Sort = sumTbl.onTimeColumn.ColumnName + "," + sumTbl.stockCodeColumn.ColumnName;
            DataRowView[]         foundRows;
            common.DictionaryList buyCountList  = new common.DictionaryList();
            common.DictionaryList sellCountList = new common.DictionaryList();

            object obj;

            //Sum
            for (int idx = 0; idx < tbl.Count; idx++)
            {
                foundRows = sumTbl.DefaultView.FindRows(new object[] { tbl[idx].onTime.Date, tbl[idx].stockCode });
                if (foundRows.Length != 0)
                {
                    sumRow = (databases.baseDS.tradeAlertRow)foundRows[0].Row;
                }
                else
                {
                    sumRow = sumTbl.NewtradeAlertRow();
                    databases.AppLibs.InitData(sumRow);
                    sumRow.onTime    = tbl[idx].onTime.Date;
                    sumRow.stockCode = tbl[idx].stockCode;
                    sumTbl.AddtradeAlertRow(sumRow);
                }
                AppTypes.TradeActions action = (AppTypes.TradeActions)tbl[idx].tradeAction;
                switch (action)
                {
                case AppTypes.TradeActions.Buy:
                case AppTypes.TradeActions.Accumulate:
                    obj = buyCountList.Find(sumRow.onTime.ToString() + sumRow.stockCode);
                    if (obj == null)
                    {
                        buyCount = new SummaryItem(sumRow.stockCode, sumRow.onTime);
                    }
                    else
                    {
                        buyCount = (SummaryItem)obj;
                    }
                    buyCount.Qty++;
                    buyCountList.Add(sumRow.onTime.ToString() + sumRow.stockCode, buyCount);
                    break;

                case AppTypes.TradeActions.Sell:
                case AppTypes.TradeActions.ClearAll:
                    obj = sellCountList.Find(sumRow.onTime.ToString() + sumRow.stockCode);
                    if (obj == null)
                    {
                        sellCount = new SummaryItem(sumRow.stockCode, sumRow.onTime);
                    }
                    else
                    {
                        sellCount = (SummaryItem)obj;
                    }
                    sellCount.Qty++;
                    sellCountList.Add(sumRow.onTime.Date.ToString() + sumRow.stockCode, sellCount);
                    break;
                }
            }
            //Make summary message
            for (int idx = 0; idx < sumTbl.Count; idx++)
            {
                sumTbl[idx].msg = "";
                obj             = buyCountList.Find(sumTbl[idx].onTime.ToString() + sumTbl[idx].stockCode);
                if (obj != null)
                {
                    sumTbl[idx].msg += (sumTbl[idx].msg.Trim() != "" ? " , " : "") + (obj as SummaryItem).Qty.ToString() + " " + Languages.Libs.GetString("buyAlert");
                }

                obj = sellCountList.Find(sumTbl[idx].onTime.ToString() + sumTbl[idx].stockCode);
                if (obj != null)
                {
                    sumTbl[idx].msg += (sumTbl[idx].msg.Trim() != "" ? " , " : "") + (obj as SummaryItem).Qty.ToString() + " " + Languages.Libs.GetString("sellAlert");
                }
            }
            return(sumTbl);
        }
コード例 #33
0
        /// <summary>
        /// Handles pasting of copied item to other rows
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mnuPaste_Click(object sender, EventArgs e)
        {
            DevExpress.XtraGrid.GridControl activeGrid = GetCurrentGrid();

            // Get clicked column
            var clickedColumn = new SummaryWorkbenchInfo.SummaryItemColumns();
            if (((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).FocusedColumn.FieldName == SummaryWorkbenchInfo.GetSummaryItemName(SummaryWorkbenchInfo.SummaryItemColumns.Allocation))
                clickedColumn = SummaryWorkbenchInfo.SummaryItemColumns.Allocation;
            if (((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).FocusedColumn.FieldName == SummaryWorkbenchInfo.GetSummaryItemName(SummaryWorkbenchInfo.SummaryItemColumns.CutOff))
                clickedColumn = SummaryWorkbenchInfo.SummaryItemColumns.CutOff;
            if (((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).FocusedColumn.FieldName == SummaryWorkbenchInfo.GetSummaryItemName(SummaryWorkbenchInfo.SummaryItemColumns.Pattern))
                clickedColumn = SummaryWorkbenchInfo.SummaryItemColumns.Pattern;
            if (((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).FocusedColumn.FieldName == SummaryWorkbenchInfo.GetSummaryItemName(SummaryWorkbenchInfo.SummaryItemColumns.SmoothFactor))
                clickedColumn = SummaryWorkbenchInfo.SummaryItemColumns.SmoothFactor;
            if (((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).FocusedColumn.FieldName == SummaryWorkbenchInfo.GetSummaryItemName(SummaryWorkbenchInfo.SummaryItemColumns.UpliftFactor))
                clickedColumn = SummaryWorkbenchInfo.SummaryItemColumns.UpliftFactor;

            SummaryItem summaryItem = new SummaryItem();

            // apply copied data to clicked column
            foreach (int index in ((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).GetSelectedRows())
            {
                summaryItem = (SummaryItem)((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).GetRow(index);

                if (clickedColumn == SummaryWorkbenchInfo.SummaryItemColumns.Allocation)
                {
                    summaryItem.Allocation = _summaryWorkbenchInfo.CopiedSummaryItem.Allocation;
                    if (summaryItem.AllocationActualFlag)
                        summaryItem.AllocationStatus = "C";
                    else
                        summaryItem.AllocationStatus = "A";
                }

                if (clickedColumn == SummaryWorkbenchInfo.SummaryItemColumns.CutOff)
                {
                    summaryItem.CutOff = _summaryWorkbenchInfo.CopiedSummaryItem.CutOff;
                    if (summaryItem.CutOffActualFlag)
                        summaryItem.CutOffStatus = "C";
                    else
                        summaryItem.CutOffStatus = "A";
                }

                if (clickedColumn == SummaryWorkbenchInfo.SummaryItemColumns.Pattern)
                {
                    summaryItem.Pattern = _summaryWorkbenchInfo.CopiedSummaryItem.Pattern;
                    if (summaryItem.PatternActualFlag)
                        summaryItem.PatternStatus = "C";
                    else
                        summaryItem.PatternStatus = "A";
                }

                if (clickedColumn == SummaryWorkbenchInfo.SummaryItemColumns.SmoothFactor)
                {
                    summaryItem.SmoothFactor = _summaryWorkbenchInfo.CopiedSummaryItem.SmoothFactor;
                    if (summaryItem.SmoothFactorActualFlag)
                        summaryItem.SmoothFactorStatus = "C";
                    else
                        summaryItem.SmoothFactorStatus = "A";
                }

                if (clickedColumn == SummaryWorkbenchInfo.SummaryItemColumns.UpliftFactor)
                {
                    summaryItem.UpliftFactor = _summaryWorkbenchInfo.CopiedSummaryItem.UpliftFactor;
                    if (summaryItem.UpliftActualFlag)
                        summaryItem.UpliftStatus = "C";
                    else
                        summaryItem.UpliftStatus = "A";
                }
                summaryItem.Changed = "1";

                // Make the changes show in the grid
                ((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).RefreshRow(index);
            }

            base.UpdateStatusMessage(string.Format("Item pasted to {0} records.",
                ((DevExpress.XtraGrid.Views.Grid.GridView)activeGrid.Views[0]).GetSelectedRows().Count()));
        }
コード例 #34
0
 /// <summary>
 /// Maintains status of allocation flag 
 /// </summary>
 /// <param name="summaryItem"></param>
 private void SetAllocationFlag(SummaryItem summaryItem)
 {
     if (summaryItem.Allocation.Trim().Length == 0)
     {
         if (summaryItem.AllocationStatus == "A")
             summaryItem.AllocationStatus = "U";
         else
             summaryItem.AllocationStatus = "D";
         var parent = ((SummaryItem)GetParentSummaryItem(summaryItem));
         summaryItem.Allocation = parent.Allocation;
         summaryItem.AllocationActualFlag = false;
         summaryItem.AllocationInheritedLevel = parent.AllocationInheritedLevel;
     }
     else
     {
         // If this is already an actual lever value this is a 'C'hange
         if (summaryItem.AllocationActualFlag == true && summaryItem.AllocationStatus != "A")
             summaryItem.AllocationStatus = "C";
         else // Otherwise mark it as an 'A'dded Lever
             summaryItem.AllocationStatus = "A";
         summaryItem.AllocationActualFlag = true;
         summaryItem.AllocationInheritedLevel = 0;
     }
 }