コード例 #1
0
        private void ServerForm_Load(object sender, EventArgs e)
        {
            try
            {
                //load the data from the table first
                foreach (RealTimePositionObject pos in calc.RealTimePositions.Values)
                {
                    if (pos.DtcActivity.Exists(d => IsHedge(d.ReasonCode)))
                    {
                        RealTimeOccPositionObject r = new RealTimeOccPositionObject(pos);
                        AllRealTimePositions.Add(r);
                    }
                }

                AllRealTimePositions.Sort("SortField", ListSortDirection.Descending);

                ColorRows();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex, TraceEnum.LoggedError);
                MessageBox.Show("Error starting app: \r\n" + ex.ToString());
            }

            foreach (DataGridViewColumn c in dgvRealTimePosition.Columns)
            {
                c.ReadOnly = true;
            }
            dgvRealTimePosition.Columns["Notes"].ReadOnly = false;
        }
コード例 #2
0
        private void DgvStudentList_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex == dgvStudentList.Columns["BirthDate"].Index)
            {
                return;
            }

            SortOrder so = SortOrder.None;

            if (currentResultSortOrder == SortOrder.None ||
                currentResultSortOrder == SortOrder.Ascending)
            {
                so = SortOrder.Descending;
            }
            else
            {
                so = SortOrder.Ascending;
            }

            if (so == SortOrder.Ascending)
            {
                studentsViewModel.Sort(Student.CompareByName);
            }
            else
            {
                studentsViewModel.Sort(Student.CompareByNameDescending);
            }

            currentResultSortOrder = so;
        }
コード例 #3
0
        void OnCusipSelected(object sender, CusipSelectEventArgs e)
        {
            IncomingDeliveryOrderParam p = new IncomingDeliveryOrderParam();

            p.DateAndTimeStamp_Date.AddParamValue(DateTime.Today);
            p.Cusip.AddParamValue(e.Cusip);

            df.Load(Orders, p);

            //Remove records that are receives but 5239 is not the receiver, same for deliver
            Orders.RemoveAll(delegate(IncomingDeliveryOrderObject d)
                             { return((d.Receiver != Settings.Account.Padded() && d.DelivererReceiverIndicator == "R") || (d.Deliverer != Settings.Account.Padded() && d.DelivererReceiverIndicator == "D")); });

            Display.Load(Orders);

            Display.Sort("DateAndTimeStamp");

            ColorRows();

            this.Text = "DTC Activity " + e.Cusip;

            //ALANDIAS
            cbPendingFilter_CheckedChanged(null, null);
            //--------
        }
コード例 #4
0
 private void cbxFilter_SelectedIndexChanged(object sender, EventArgs e)
 {
     UpdateFilter(positions5239, filtered5239);
     UpdateFilter(positions269, filtered269);
     filtered5239.Sort("SortField", ListSortDirection.Descending);
     filtered269.Sort("SortField", ListSortDirection.Descending);
 }
コード例 #5
0
        private void UpdatePositions(RealTimePositionObject pos)
        {
            try
            {
                if (pos != null)
                {
                    //find the position
                    int i = AllRealTimePositions.Find("Cusip", pos.Cusip);

                    if (i != -1)
                    {
                        //position already exists, remove it and add new one
                        pos.Notes = AllRealTimePositions[i].Notes;

                        AllRealTimePositions.RemoveAt(i);
                        AllRealTimePositions.Add(pos);
                    }
                    else
                    {
                        //new position. add it
                        AllRealTimePositions.Add(pos);
                    }
                    AllRealTimePositions.Sort("SortField", ListSortDirection.Descending);
                    ColorRows();

//                    dgvRealTimePosition.Refresh();

                    DtcChannel.Instance.PositionUpdated(pos);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #6
0
        private void LoadHeldUp()
        {
            SortableBindingList <RealTimeOccPositionObject> tmp = new SortableBindingList <RealTimeOccPositionObject>();

            AllocationViewFactory       avf           = new AllocationViewFactory();
            List <AllocationViewObject> heldUpReturns = new List <AllocationViewObject>();
            AllocationViewParam         avp           = new AllocationViewParam();

            tmp.Load(AllRealTimePositions);
            HeldUpRealTimePositions.Clear();

            avp.HeldUp.AddParamValue(1);
            avf.Load(heldUpReturns, avp);

            //now remove the non Held Up positions
            foreach (RealTimeOccPositionObject rt in tmp)
            {
                if (heldUpReturns.Exists(av => av.Cusip == rt.Cusip))
                {
                    HeldUpRealTimePositions.Add(rt);
                }
            }

            HeldUpRealTimePositions.Sort("TradeCategory", ListSortDirection.Ascending);
        }
コード例 #7
0
 public void SortButton_Handler(object sender, EventArgs e)
 {
     _personList.Sort();
     ((CurrencyManager)_listBox.BindingContext[_personList]).Refresh();
     if (_personList.Count > 0)
     {
         UpdateEntryControls(_listBox.SelectedIndex = 0);
     }
 }
コード例 #8
0
 /// <summary>
 /// Erzeugt eine neue Instanz der <seealso cref="MaschinenauftragListView"/> Formularklasse.
 /// </summary>
 /// <param name="auftragsListe"></param>
 public MaschinenauftragListView(SortableBindingList <Maschinenauftrag> auftragsListe)
 {
     InitializeComponent();
     if (auftragsListe == null)
     {
         auftragsListe = Model.ModelManager.MachineService.GetMaschinenauftragAktivListe();
     }
     this.myDatasource = auftragsListe.Sort("Kundennummer");
     this.InitializeData();
 }
コード例 #9
0
 void Sort(string key, bool ascending)
 {
     if (_bindingList.Any()) // only sort if array contains something
     {
         var comparer = _bindingList.First().GetComparer(key, ascending);
         if (comparer != null)
         {
             _bindingList.Sort(comparer);
         }
     }
 }
コード例 #10
0
        public SortableBindingList <AngebotsDetail> GetAngebotsDetails(Angebot angebot)
        {
            var list  = new SortableBindingList <AngebotsDetail>();
            var dRows = DataManager.SalesDataService.GetAngebotSagePositionRows(angebot.Nummer);

            foreach (var dRow in dRows)
            {
                var detail = new AngebotsDetail(dRow);
                if (detail != null && detail.Typ == "Artikel")
                {
                    list.Add(detail);
                }
            }

            return(list.Sort("Sequence"));
        }
コード例 #11
0
        private void trvFolders_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var dirInfo = e.Node.Tag as DirectoryInfo;

            if (dirInfo != null)
            {
                var option = SearchOption.TopDirectoryOnly;
                if (e.Node.Parent == null)
                {
                    option = SearchOption.AllDirectories;
                }
                var getFilesResult = dirInfo.GetFiles("*.*", option);
                var files          = new SortableBindingList <FileInfo>(getFilesResult);
                this.dgvFiles.DataSource = files.Sort("LastWriteTime", System.ComponentModel.ListSortDirection.Descending);
            }
        }
コード例 #12
0
        public RecentDtcActivityForm(IList <IncomingDeliveryOrderObject> orders)
        {
            InitializeComponent();

            Orders.Load(orders);

            Orders.Sort("DateAndTimeStamp", ListSortDirection.Descending);

            dgvDeliveryOrders.DataSource = Orders;

            helper.Add(new DgvHelper(dgvDeliveryOrders, this.Name, true));
            helper.handleCellSelected += new CellSelectEventHandler(h_handleCellSelected);


            handleDtcMessageReceived = new IncomingDtcMessageEventHandler(Instance_handleDtcMessageReceived);
            DtcChannel.Instance.handleDtcMessageReceived += handleDtcMessageReceived;
        }
コード例 #13
0
        private void LoadHedged()
        {
            SortableBindingList <RealTimePositionObject> tmp = new SortableBindingList <RealTimePositionObject>();

            tmp.Load(AllRealTimePositions);
            HedgedRealTimePositions.Clear();

            //now remove the non Hedge
            foreach (RealTimePositionObject rt in tmp)
            {
                if (rt.ContainsHedge)
                {
                    HedgedRealTimePositions.Add(rt);
                }
            }

            HedgedRealTimePositions.Sort("HedgedSortField", ListSortDirection.Descending);
        }
コード例 #14
0
        private void tsmiExport_Click_1(object sender, EventArgs e)
        {
            SortableBindingList <ProjectedNeedsSummaryObject> pns = new SortableBindingList <ProjectedNeedsSummaryObject>();

            foreach (DataGridViewRow row in dgvRealTimePosition.Rows)
            {
                ProjectedNeedsSummaryObject p = (ProjectedNeedsSummaryObject)row.DataBoundItem;

                if (p.OpenNeedRounded > 0)
                {
                    pns.Add(p);
                }
            }

            pns.Sort("CUSIP");

            string s = ToHtml(pns);

            ExportToExcel(s);
        }
コード例 #15
0
        public override void FindAllDataBind()
        {
            try
            {
                FindAll();

                var list = new SortableBindingList <Category>(To.List);
                if (View.SortInfo.SortOrder != PropertySortOrder.None)
                {
                    list.Sort(View.SortInfo);
                }

                View.BindableList    = list;
                View.CurrentPosition = View.BindableList.IndexOf(To.CurrentModel);

                View.AdjustDataGridRowHeightColumnWidth();
            }
            catch (Exception ex)
            {
                HelperFactory.MessageHelper.ShowMessageError("Error", "Could not DataBind the list", ex);
            }
        }
コード例 #16
0
        private void AddFile(ModFile file, ModPack pack)
        {
            DataGridViewRow item = this.gridView.Rows.Cast <DataGridViewRow>().FirstOrDefault <DataGridViewRow>((DataGridViewRow r) => ModsSelector.GetFileName(r).Equals(file.FileName));

            if (item == null)
            {
                DataGridViewRowCollection rows = this.gridView.Rows;
                object[] objArray = new object[] { (file.Blocked ? Images16px.Warning : new Bitmap(1, 1)), file.FileName, file.Description, null, ModsSelector.DisabledItem };
                int      num      = rows.Add(objArray);
                item = this.gridView.Rows[num];
                if (file.Blocked)
                {
                    DataGridViewImageCell imageCell = ModsSelector.GetImageCell(item);
                    imageCell.ToolTipText = string.Format(gPatcher.Localization.Text.ModsSelector_FileBlockedInServers, ModsSelector.GetFileName(item), file.BlockedServers);
                }
                ModsSelector.GetPlayCell(item).ValueIsIcon = false;
                DataGridViewComboBoxCell      comboBoxCell        = ModsSelector.GetComboBoxCell(item);
                SortableBindingList <ModPack> sortableBindingList = new SortableBindingList <ModPack>()
                {
                    ModsSelector.DisabledItem,
                    pack
                };
                sortableBindingList.Sort <ModPack>((ModPack t) => t);
                comboBoxCell.DisplayMember = "Name";
                comboBoxCell.ValueMember   = "Self";
                comboBoxCell.ValueType     = typeof(ModPack);
                comboBoxCell.DataSource    = sortableBindingList;
                this.Sort();
            }
            else
            {
                BindingList <ModPack> dataSource = ModsSelector.GetDataSource(item);
                if (!dataSource.Contains(pack))
                {
                    dataSource.AddSorted <ModPack>(pack);
                    return;
                }
            }
        }
コード例 #17
0
        void mtogglAlleAnzeigen_CheckedChanged(object sender, EventArgs e)
        {
            SortableBindingList <Maschinenauftrag> source = this.dgvMaschinenauftraege.DataSource as SortableBindingList <Maschinenauftrag>;
            var sortedBy      = source.SortPropertyName;
            var sortDirection = source.SortDirection;

            switch (this.mtogglAlleAnzeigen.Checked)
            {
            case true:
                source = Model.ModelManager.MachineService.GetMaschinenauftragListe();
                break;

            case false:
                source = Model.ModelManager.MachineService.GetMaschinenauftragAktivListe();
                break;
            }

            if (sortedBy != null)
            {
                this.dgvMaschinenauftraege.DataSource = source.Sort(sortedBy, sortDirection);
                return;
            }
            this.dgvMaschinenauftraege.DataSource = source;
        }
コード例 #18
0
        /// <summary>
        ///     Loads the given box score.
        /// </summary>
        /// <param name="bse">The BoxScoreEntry to load.</param>
        private void loadBoxScore(BoxScoreEntry bse)
        {
            TeamBoxScore bs = bse.BS;
            MainWindow.bs = bse.BS;
            txtPTS1.Text = bs.PTS1.ToString();
            txtREB1.Text = bs.REB1.ToString();
            txtAST1.Text = bs.AST1.ToString();
            txtSTL1.Text = bs.STL1.ToString();
            txtBLK1.Text = bs.BLK1.ToString();
            txtTO1.Text = bs.TOS1.ToString();
            txtFGM1.Text = bs.FGM1.ToString();
            txtFGA1.Text = bs.FGA1.ToString();
            txt3PM1.Text = bs.TPM1.ToString();
            txt3PA1.Text = bs.TPA1.ToString();
            txtFTM1.Text = bs.FTM1.ToString();
            txtFTA1.Text = bs.FTA1.ToString();
            txtOREB1.Text = bs.OREB1.ToString();
            txtFOUL1.Text = bs.FOUL1.ToString();
            txtMINS1.Text = bs.MINS1.ToString();
            txtPTS2.Text = bs.PTS2.ToString();
            txtREB2.Text = bs.REB2.ToString();
            txtAST2.Text = bs.AST2.ToString();
            txtSTL2.Text = bs.STL2.ToString();
            txtBLK2.Text = bs.BLK2.ToString();
            txtTO2.Text = bs.TOS2.ToString();
            txtFGM2.Text = bs.FGM2.ToString();
            txtFGA2.Text = bs.FGA2.ToString();
            txt3PM2.Text = bs.TPM2.ToString();
            txt3PA2.Text = bs.TPA2.ToString();
            txtFTM2.Text = bs.FTM2.ToString();
            txtFTA2.Text = bs.FTA2.ToString();
            txtOREB2.Text = bs.OREB2.ToString();
            txtFOUL2.Text = bs.FOUL2.ToString();
            txtMINS2.Text = bs.MINS2.ToString();

            dtpGameDate.SelectedDate = bs.GameDate;
            _curSeason = bs.SeasonNum;
            //LinkInternalsToMainWindow();
            chkIsPlayoff.IsChecked = bs.IsPlayoff;

            calculateScoreAway();
            calculateScoreHome();

            pbsAwayList = new SortableBindingList<PlayerBoxScore>();
            pbsHomeList = new SortableBindingList<PlayerBoxScore>();

            pbsAwayList.AllowNew = true;
            pbsAwayList.AllowEdit = true;
            pbsAwayList.AllowRemove = true;
            pbsAwayList.RaiseListChangedEvents = true;

            pbsHomeList.AllowNew = true;
            pbsHomeList.AllowEdit = true;
            pbsHomeList.AllowRemove = true;
            pbsHomeList.RaiseListChangedEvents = true;

            dgvPlayersAway.ItemsSource = pbsAwayList;
            dgvPlayersHome.ItemsSource = pbsHomeList;
            _loading = true;
            foreach (PlayerBoxScore pbs in bse.PBSList)
            {
                if (pbs.TeamID == bs.Team1ID)
                {
                    pbsAwayList.Add(pbs);
                }
                else
                {
                    pbsHomeList.Add(pbs);
                }
            }

            pbsAwayList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));
            pbsHomeList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));

            try
            {
                cmbTeam1.SelectedItem = MainWindow.TST[bs.Team1ID].DisplayName;
                cmbTeam2.SelectedItem = MainWindow.TST[bs.Team2ID].DisplayName;
            }
            catch
            {
                MessageBox.Show("One of the teams requested is disabled for this season. This box score is not available.\n" +
                                "To be able to see this box score, enable the teams included in it.");
                Close();
            }
            populateSeasonCombo();

            _loading = false;
        }
コード例 #19
0
        private void PriceControlForm_Load(object sender, EventArgs e)
        {
            try
            {
                //load the data from the table first
                foreach (IncomingDeliveryOrderObject d in calc.AllDtcActivity)
                {
                    ProcessOrders(d);
                }

                RemoveNonCashItemsFromProblemOrders(ProblemOrders); //ALANDIAS

                ColorRows();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex, TraceEnum.LoggedError);
            }

            foreach (DataGridViewColumn c in dgvControl.Columns)
            {
                c.ReadOnly = true;
            }

            foreach (DataGridViewColumn c in dgvDifferentPrices.Columns)
            {
                c.ReadOnly = true;
            }

            dgvControl.Columns["Notes"].ReadOnly         = false;
            dgvDifferentPrices.Columns["Notes"].ReadOnly = false;

            ProblemOrders.Sort("SortField", ListSortDirection.Descending);

            //Use this for testing

            /*
             * IncomingDeliveryOrderObject o = new IncomingDeliveryOrderObject();
             *
             * o.Id = 147293;
             * o.DateAndTimeStamp = DateTime.Now;
             * o.Cusip = "88023U101";
             *
             * o.DtcStatusIndicator = " ";
             *
             * o.Receiver = "00005239";
             * o.Deliverer = "00000773";
             * o.DelivererReceiverIndicator = "R";
             * o.ActionCode = "1";
             * o.ActivityCode = "027";
             * o.ReasonCode = "020";
             * o.MoneyValue = 2000;
             * o.ShareQuantity = 100;
             * ProcessOrders(o);
             *
             * o.Receiver = "00000774";
             * o.Deliverer = "00005239";
             * o.DelivererReceiverIndicator = "D";
             * ProcessOrders(o);
             *
             * o.Receiver = "00000775";
             * o.Cusip = "759351109";
             * o.MoneyValue = 200;
             * o.ShareQuantity = 100;
             * ProcessOrders(o);
             *
             * o.Receiver = "00005239";
             * o.Deliverer = "00000776";
             * o.DelivererReceiverIndicator = "R";
             * ProcessOrders(o);
             *
             * o.Cusip = "004329108";
             * o.MoneyValue = 200;
             * o.ShareQuantity = 100;
             * o.Receiver = "00005239";
             * o.Deliverer = "00000777";
             * o.DelivererReceiverIndicator = "R";
             * ProcessOrders(o);
             */
        }
コード例 #20
0
        void Instance_handleDtcMessageReceived(object sender, IncomingDtcMessageEventArgs e)
        {
            IncomingDeliveryOrderObject d;

            if (e.DtcMessage is IncomingDeliveryOrderObject)
            {
                d = (IncomingDeliveryOrderObject)e.DtcMessage;
            }
            else
            {
                return;
            }

            /*AlanDias New way to multithread
             * new Thread(() => {
             *  this.BeginInvoke(new Action(() => { }));
             * }).Start();
             */


            new Thread((ThreadStart) delegate()
            {
                this.BeginInvoke((ThreadStart) delegate()
                {
                    try
                    {
                        if (d.Receiver == "00000888" && d.Deliverer == Settings.Account.Padded())
                        {
                            int i = ProjectedNeeds.Find("Cusip", d.Cusip);

                            if (i != -1 && ProjectedNeeds[i].NeedType == "ProjectedNeed")
                            {
                                ProjectedNeeds[i].DeliveredToCns += d.ShareQuantity.Value;
                                CalcSummary();
                                ProjectedNeeds.Sort("OpenNeed", ListSortDirection.Descending);
                            }
                        }

                        if (d.Deliverer == "00000888" && d.Receiver == Settings.Account.Padded())
                        {
                            int i = ProjectedNeeds.Find("Cusip", d.Cusip);

                            if (i != -1 && ProjectedNeeds[i].NeedType == "ProjectedNeed")
                            {
                                ProjectedNeeds[i].Received += d.ShareQuantity.Value;
                                CalcSummary();
                                ProjectedNeeds.Sort("OpenNeed", ListSortDirection.Descending);
                            }
                        }


                        //Reason Code 620 is for Balance Orders
                        if (d.ReasonCode == "620" && d.Deliverer == Settings.Account.Padded())
                        {
                            int i = ProjectedNeeds.Find("Cusip", d.Cusip);

                            if (i != -1 && (ProjectedNeeds[i].NeedType == "BalanceOrder" || ProjectedNeeds[i].NeedType == "ProjectedNeed"))
                            {
                                ProjectedNeeds[i].DeliveredToCns += d.ShareQuantity.Value;
                                CalcSummary();
                                ProjectedNeeds.Sort("OpenNeed", ListSortDirection.Descending);
                            }
                        }

                        if (d.ReasonCode == "620" && d.Receiver == Settings.Account.Padded())
                        {
                            int i = ProjectedNeeds.Find("Cusip", d.Cusip);

                            if (i != -1 && (ProjectedNeeds[i].NeedType == "BalanceOrder" || ProjectedNeeds[i].NeedType == "ProjectedNeed"))
                            {
                                ProjectedNeeds[i].Received += d.ShareQuantity.Value;
                                CalcSummary();
                                ProjectedNeeds.Sort("OpenNeed", ListSortDirection.Descending);
                            }
                        }

                        /*
                         * //ALANDIAS added for NSCCMISC
                         * if (d.ReasonCode == "620" && d.Deliverer == Settings.Account.Padded())
                         * {
                         *  int i = ProjectedNeeds.Find("Cusip", d.Cusip);
                         *
                         *  if (i != -1 && ProjectedNeeds[i].NeedType == "MiscellaneousFile")
                         *  {
                         *      ProjectedNeeds[i].DeliveredToCns += d.ShareQuantity.Value;
                         *      CalcSummary();
                         *      ProjectedNeeds.Sort("OpenNeed", ListSortDirection.Descending);
                         *  }
                         * }
                         */
                    }
                    catch (Exception ex)
                    {
                        Trace.WriteLine(ex, TraceEnum.LoggedError);
                    }
                });
            }).Start();
        }
コード例 #21
0
        private void ServerForm_Load(object sender, EventArgs e)
        {
            dgv5239.DataSource     = filtered5239;
            dgv269.DataSource      = positions269;
            dgvExpected.DataSource = expected;

            helper.Add(new DgvHelper(dgv5239, this.Name, true));
            helper.Add(new DgvHelper(dgv269, this.Name, true));
            helper.Add(new DgvHelper(dgvExpected, this.Name, true));

            cbxFilter.Items.Add("All");
            cbxFilter.Items.Add("OverBorrows");
            cbxFilter.Items.Add("OverLoans");

            cbxFilter.SelectedIndex = 0;

            try
            {
                txtBorrowPosition269.Text  = "$0";
                txtBorrowPosition5239.Text = "$0";
                txtDifference.Text         = "$0";
                txtHedgeMark.Text          = "$0";
                txtHedgeSpread.Text        = "$0";
                txtLoanPosition269.Text    = "$0";
                txtLoanPosition5239.Text   = "$0";
                txtSpread269.Text          = "$0";
                txtSpread5239.Text         = "$0";

                //calc mark
                HedgeMarkTotalViewParam hmp = new HedgeMarkTotalViewParam();
                hmp.ActivityDate_Date.AddParamValue(Utils.GetNthBusinessDay(DateTime.Today, -1));

                hmvf.Load(marks, hmp);

                double markTotal = 0;

                marks.ForEach(m => markTotal += m.Total.Value);

                //load collateral values
                HedgeCollateralViewParam hcp = new HedgeCollateralViewParam();
                hcp.ActivityDate_Date.AddParamValue(Utils.GetNthBusinessDay(DateTime.Today, -1));

                hcvf.Load(collateral, hcp);

                double borrowPosition5239 = 0;
                double borrowPosition269  = 0;
                double loanPosition5239   = 0;
                double loanPosition269    = 0;

                foreach (HedgeCollateralViewObject h in collateral)
                {
                    if (h.BorrowLoan == "B")
                    {
                        if (h.ClearingNo == "05239")
                        {
                            borrowPosition5239 = h.total.Value;
                        }
                        if (h.ClearingNo == "00269")
                        {
                            borrowPosition269 = h.total.Value;
                        }
                    }
                    else if (h.BorrowLoan == "L")
                    {
                        if (h.ClearingNo == "05239")
                        {
                            loanPosition5239 = h.total.Value;
                        }
                        if (h.ClearingNo == "00269")
                        {
                            loanPosition269 = h.total.Value;
                        }
                    }
                }

                txtBorrowPosition5239.Text = borrowPosition5239.ToString("c0");
                txtBorrowPosition269.Text  = borrowPosition269.ToString("c0");
                txtLoanPosition5239.Text   = loanPosition5239.ToString("c0");
                txtLoanPosition269.Text    = loanPosition269.ToString("c0");

                double spread269   = borrowPosition269 - loanPosition269;
                double spread5239  = borrowPosition5239 - loanPosition5239;
                double hedgeMark   = Math.Abs(markTotal);
                double difference  = (spread269 + spread5239);
                double hedgeSpread = difference - hedgeMark;

                txtSpread269.Text  = spread269.ToString("c0");
                txtSpread5239.Text = spread5239.ToString("c0");
                txtHedgeMark.Text  = hedgeMark.ToString("c0");

                txtDifference.Text = difference.ToString("c0");

                if (borrowPosition5239 > loanPosition5239)
                {
                    txtHedgeSpread.Text = hedgeSpread.ToString("c0") + "\r\n" + "OverBorrow";
                }
                else
                {
                    txtHedgeSpread.Text = hedgeSpread.ToString("c0") + "\r\n" + "OverLoan";
                }
                //calculate over borrows and loans
                HedgePositionSummaryViewFactory       hpsf     = new HedgePositionSummaryViewFactory();
                List <HedgePositionSummaryViewObject> hedgePos = new List <HedgePositionSummaryViewObject>();
                HedgePositionSummaryViewParam         hpsp     = new HedgePositionSummaryViewParam();
                List <PositionSummaryObject>          temp     = new List <PositionSummaryObject>();

                hpsp.ActivityDate.AddParamValue(Utils.GetNthBusinessDay(DateTime.Today, -1));

                hpsf.Load(hedgePos, hpsp);

                foreach (HedgePositionSummaryViewObject h in hedgePos)
                {
                    PositionSummaryObject p = temp.Find(t => t.Cusip == h.Cusip &&
                                                        t.ClearingNo == h.ClearingNo);

                    //does not exist
                    if (p == null)
                    {
                        PositionSummaryObject t = new PositionSummaryObject(h);
                        temp.Add(t);
                    }
                    else
                    {
                        if (h.BorrowLoan == "B")
                        {
                            p.StartingBorrowQty   += h.Quantity.Value;
                            p.StartingBorrowValue += h.ContractValue.Value;
                        }

                        if (h.BorrowLoan == "L")
                        {
                            p.StartingLoanQty   += h.Quantity.Value;
                            p.StartingLoanValue += h.ContractValue.Value;
                        }
                    }
                }

                foreach (PositionSummaryObject p in temp)
                {
                    if (p.ClearingNo == "05239")
                    {
                        positions5239.Add(p);
                    }
                    if (p.ClearingNo == "00269")
                    {
                        positions269.Add(p);
                    }
                }

                //now calculate what the current positions are
                foreach (IncomingDeliveryOrderObject ido in calc.AllDtcActivity)
                {
                    CalcSummary(ido, "00005239", positions5239);
                    CalcSummary(ido, "00000269", positions269);
                }

                UpdateFilter(positions5239, filtered5239);
                UpdateFilter(positions269, filtered269);

                CalculateExpected();
                CalcSpread();

                filtered5239.Sort("SortField", ListSortDirection.Descending);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex, TraceEnum.LoggedError);
                MessageBox.Show("Error starting app: \r\n" + ex.ToString());
            }
        }
コード例 #22
0
        /// <summary>Loads the given box score.</summary>
        /// <param name="bse">The BoxScoreEntry to load.</param>
        private void loadBoxScore(BoxScoreEntry bse)
        {
            var bs = bse.BS;
            MainWindow.TempBSE_BS = bse.BS;
            FillTeamBoxScore(bs);

            dtpGameDate.SelectedDate = bs.GameDate;
            _curSeason = bs.SeasonNum;
            //LinkInternalsToMainWindow();
            chkIsPlayoff.IsChecked = bs.IsPlayoff;

            calculateScoreAway();
            calculateScoreHome();

            pbsAwayList = new SortableBindingList<PlayerBoxScore>();
            pbsHomeList = new SortableBindingList<PlayerBoxScore>();

            pbsAwayList.AllowNew = true;
            pbsAwayList.AllowEdit = true;
            pbsAwayList.AllowRemove = true;
            pbsAwayList.RaiseListChangedEvents = true;

            pbsHomeList.AllowNew = true;
            pbsHomeList.AllowEdit = true;
            pbsHomeList.AllowRemove = true;
            pbsHomeList.RaiseListChangedEvents = true;

            dgvPlayersAway.ItemsSource = pbsAwayList;
            dgvPlayersHome.ItemsSource = pbsHomeList;
            _loading = true;
            foreach (var pbs in bse.PBSList)
            {
                if (pbs.TeamID == bs.Team1ID)
                {
                    pbsAwayList.Add(pbs);
                }
                else
                {
                    pbsHomeList.Add(pbs);
                }
            }

            pbsAwayList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));
            pbsHomeList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));

            try
            {
                cmbTeam1.SelectedItem = MainWindow.TST[bs.Team1ID].DisplayName;
                cmbTeam2.SelectedItem = MainWindow.TST[bs.Team2ID].DisplayName;
            }
            catch
            {
                MessageBox.Show(
                    "One of the teams requested is disabled for this season. This box score is not available.\n"
                    + "To be able to see this box score, enable the teams included in it.");
                Close();
            }
            populateSeasonCombo();

            pbpeList = new ObservableCollection<PlayByPlayEntry>(bse.PBPEList);
            pbpeList.Sort(new PlayByPlayEntryComparerAsc());
            lstPlayByPlay.ItemsSource = pbpeList;

            _loading = false;
        }
 public void SortButton_Handler(object sender, EventArgs e)
 {
     _personList.Sort();
     ((CurrencyManager)_dataGridView.BindingContext[_personList]).Refresh();
     SerializeBindingList(_personList);
 }