void ChangeSelectedRow()
 {
     if (SelectedRow != null)
     {
         SelectedRow.SetValue(1, (int)SelectedRow.Properties[1].Value + 1);
     }
 }
Example #2
0
 private void Submit(bool isUnload = false)
 {
     try
     {
         if (SelectedRow.IsNotNullOrEmpty())
         {
             ActiveEntity.MACHINE_TYPE = SelectedRow.DESCRIPTION;
         }
         //Progress.ProcessingText = PDMsg.ProgressUpdateText;
         //Progress.Start();
         isSaved = bll.Update <DDFORGING_MAC>(new List <DDFORGING_MAC>()
         {
             ActiveEntity
         });
         //Progress.End();
         ShowInformationMessage(PDMsg.SavedSuccessfully);
         //MessageBox.Show("Records saved successfully", "SmartPD", MessageBoxButton.OK, MessageBoxImage.Information);
         if (!isUnload)
         {
             CloseAction();
         }
     }
     catch (Exception ex)
     {
         throw ex.LogException();
     }
 }
 private void EcoClass_DG_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
 {
     SelectedRow = economyClassSeatChartDataGrid.SelectedIndex;
     SelectedCol = economyClassSeatChartDataGrid.CurrentColumn.DisplayIndex - 1;
     userSelectedRowTextbox.Text = SelectedRow.ToAlphabet();
     userSelectedColTextbox.Text = (SelectedCol + 1).ToString();
 }
 void TimerElapsed(object sender, ElapsedEventArgs e)
 {
     _timer.Stop();
     if (SelectedRow != null)
     {
         SelectedRow.UpdateDetails();
     }
 }
        private async void Download(MainWindowDownloadMessage message)
        {
            if (SelectedRow != null)
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() => IsBusy = true);

                IShelveset shelveset = SelectedRow.ToShelveset();
                int        fileCount = await Task.Run(() => _backupService.DownloadShelveset(message.DestinationFolder, new[] { shelveset }));

                DispatcherHelper.CheckBeginInvokeOnUI(() => IsBusy = false);
            }
        }
Example #6
0
        private void SelectDataRow()
        {
            if (SelectedRow.IsNotNullOrEmpty())
            {
                DataTable dt = bll.GetEntitiesByCode(ActiveEntity).ToDataTable <PartNumberConfig>().Clone();
                dt.ImportRow(SelectedRow.Row);

                List <PartNumberConfig> lstEntity = (from row in dt.AsEnumerable()
                                                     select new PartNumberConfig()
                {
                    ID = row.Field <string>("ID").ToIntValue(),
                    Code = row.Field <string>("Code"),
                    Description = row.Field <string>("Description"),
                    Location_code = row.Field <string>("location_code"),
                    Prefix = row.Field <string>("Prefix"),
                    BeginningNo = row.Field <string>("BeginningNo"),
                    EndingNo = row.Field <string>("EndingNo"),
                    IsObsolete = row.Field <string>("IsObsolete").ToBooleanAsString(),
                    DELETE_FLAG = row.Field <string>("DELETE_FLAG").ToBooleanAsString(),
                    ENTERED_BY = row.Field <string>("ENTERED_BY"),
                    ENTERED_DATE = row.Field <string>("ENTERED_DATE").ToDateTimeValue(),
                    UPDATED_BY = row.Field <string>("UPDATED_BY"),
                    UPDATED_DATE = row.Field <string>("UPDATED_DATE").ToDateTimeValue()
                }).ToList <PartNumberConfig>();
                if (lstEntity.IsNotNullOrEmpty() && lstEntity.Count > 0)
                {
                    ActiveEntity = lstEntity[0].DeepCopy <PartNumberConfig>();

                    MandatoryFields.Code          = ActiveEntity.Code;
                    MandatoryFields.Description   = ActiveEntity.Description;
                    MandatoryFields.Location_code = ActiveEntity.Location_code;
                    MandatoryFields.Prefix        = ActiveEntity.Prefix;
                    MandatoryFields.BeginningNo   = ActiveEntity.BeginningNo.ToValueAsString();
                    MandatoryFields.EndingNo      = ActiveEntity.EndingNo.ToValueAsString();

                    OldMandatoryFields.Code          = ActiveEntity.Code;
                    OldMandatoryFields.Description   = ActiveEntity.Description;
                    OldMandatoryFields.Location_code = ActiveEntity.Location_code;
                    OldMandatoryFields.Prefix        = ActiveEntity.Prefix;
                    OldMandatoryFields.BeginningNo   = ActiveEntity.BeginningNo.ToValueAsString();
                    OldMandatoryFields.EndingNo      = ActiveEntity.EndingNo.ToValueAsString();
                }
            }
        }
        DataTable CalculateStrategyPnls(DataTable StrategyTableInput)
        {
            for (int i = 0; i < StrategyTableInput.Rows.Count; i++)
            {
                string    Alias            = StrategyTableInput.Rows[i].Field <string>("Alias");
                DataTable StrategyPosition = StrategyPositionDictionary[Alias];
                DataRow   SelectedRow;

                double ContractMultiplier = ContractUtilities.ContractMetaInfo.ContractMultiplier[StrategyPosition.Rows[0].Field <string>("TickerHead")];



                int NumButterflies = Convert.ToInt32(Math.Sign(StrategyPosition.Rows[0].Field <double>("Qty")) *
                                                     Math.Min(Math.Abs(StrategyPosition.Rows[0].Field <double>("Qty")), Math.Abs(StrategyPosition.Rows[2].Field <double>("Qty"))));

                double ButterflyPriceClose = StrategyPosition.Rows[0].Field <double>("ClosePrice")
                                             - 2 * StrategyPosition.Rows[1].Field <double>("ClosePrice")
                                             + StrategyPosition.Rows[2].Field <double>("ClosePrice");

                SelectedRow = PriceTable.Select("Ticker='" + StrategyPosition.Rows[0].Field <string>("Ticker") + "-" + StrategyPosition.Rows[1].Field <string>("Ticker") + "_" +
                                                StrategyPosition.Rows[1].Field <string>("Ticker") + "-" + StrategyPosition.Rows[2].Field <string>("Ticker") + "'")[0];

                double ButterflyMidPrice = (SelectedRow.Field <double>("BidPrice") + SelectedRow.Field <double>("AskPrice")) / 2;
                StrategyTableInput.Rows[i]["ButterflyMidPrice"] = ButterflyMidPrice;
                double ButterflyWorstPrice = double.NaN;

                if (!Double.IsNaN(ButterflyMidPrice))
                {
                    ButterflyMidPrice = (double)TA.PriceConverters.FromTT2DB(ttPrice: (decimal)ButterflyMidPrice, tickerHead: StrategyPosition.Rows[0].Field <string>("TickerHead"));
                }

                if (NumButterflies > 0)
                {
                    ButterflyWorstPrice = SelectedRow.Field <double>("BidPrice");
                }
                else if (NumButterflies < 0)
                {
                    ButterflyWorstPrice = SelectedRow.Field <double>("AskPrice");
                }

                StrategyTableInput.Rows[i]["ButterflyWorstPrice"] = ButterflyWorstPrice;

                if (!Double.IsNaN(ButterflyWorstPrice))
                {
                    ButterflyWorstPrice = (double)TA.PriceConverters.FromTT2DB(ttPrice: (decimal)ButterflyWorstPrice, tickerHead: StrategyPosition.Rows[0].Field <string>("TickerHead"));
                }

                StrategyTableInput.Rows[i]["ButterflyQuantity"] = NumButterflies;
                double ButterflyMidPnl   = ContractMultiplier * NumButterflies * (ButterflyMidPrice - ButterflyPriceClose);
                double ButterflyWorstPnl = ContractMultiplier * NumButterflies * (ButterflyWorstPrice - ButterflyPriceClose);

                string AdditionalTicker           = "";
                int    AdditionalQuantity         = 0;
                double AdditionalTickerClosePrice = Double.NaN;

                if ((Math.Abs(NumButterflies) < Math.Abs(StrategyPosition.Rows[0].Field <double>("Qty"))))
                {
                    AdditionalTicker           = StrategyPosition.Rows[0].Field <string>("Ticker") + "-" + StrategyPosition.Rows[1].Field <string>("Ticker");
                    AdditionalQuantity         = (int)StrategyPosition.Rows[0].Field <double>("Qty") - NumButterflies;
                    AdditionalTickerClosePrice = StrategyPosition.Rows[0].Field <double>("ClosePrice") - StrategyPosition.Rows[1].Field <double>("ClosePrice");
                }
                else if ((Math.Abs(NumButterflies) < Math.Abs(StrategyPosition.Rows[2].Field <double>("Qty"))))
                {
                    AdditionalTicker           = StrategyPosition.Rows[1].Field <string>("Ticker") + "-" + StrategyPosition.Rows[2].Field <string>("Ticker");
                    AdditionalQuantity         = -((int)StrategyPosition.Rows[2].Field <double>("Qty") - NumButterflies);
                    AdditionalTickerClosePrice = StrategyPosition.Rows[1].Field <double>("ClosePrice") - StrategyPosition.Rows[2].Field <double>("ClosePrice");
                }

                double AdditionalTickerMidPnl   = 0;
                double AdditionalTickerWorstPnl = 0;

                if (AdditionalQuantity != 0)
                {
                    SelectedRow = PriceTable.Select("Ticker='" + StrategyPosition.Rows[0].Field <string>("Ticker") + "-" + StrategyPosition.Rows[1].Field <string>("Ticker") + "'")[0];
                    double AdditionalTickerMidPrice = (SelectedRow.Field <double>("BidPrice") + SelectedRow.Field <double>("AskPrice")) / 2;
                    StrategyTableInput.Rows[i]["SpreadMidPrice"] = AdditionalTickerMidPrice;

                    AdditionalTickerMidPrice = (double)TA.PriceConverters.FromTT2DB(ttPrice: (decimal)AdditionalTickerMidPrice, tickerHead: StrategyPosition.Rows[0].Field <string>("TickerHead"));

                    AdditionalTickerMidPnl = ContractMultiplier * AdditionalQuantity * (AdditionalTickerMidPrice - AdditionalTickerClosePrice);

                    double AdditionalTickerWorstPrice = double.NaN;

                    if (AdditionalQuantity > 0)
                    {
                        AdditionalTickerWorstPrice = SelectedRow.Field <double>("BidPrice");
                    }
                    else if (AdditionalQuantity < 0)
                    {
                        AdditionalTickerWorstPrice = SelectedRow.Field <double>("AskPrice");
                    }

                    StrategyTableInput.Rows[i]["SpreadWorstPrice"] = AdditionalTickerWorstPrice;
                    AdditionalTickerWorstPrice = (double)TA.PriceConverters.FromTT2DB(ttPrice: (decimal)AdditionalTickerWorstPrice, tickerHead: StrategyPosition.Rows[0].Field <string>("TickerHead"));

                    AdditionalTickerWorstPnl = ContractMultiplier * AdditionalQuantity * (AdditionalTickerWorstPrice - AdditionalTickerClosePrice);
                }

                StrategyTableInput.Rows[i]["SpreadQuantity"] = AdditionalQuantity;
                StrategyTableInput.Rows[i]["PnlMid"]         = Math.Round(ButterflyMidPnl + AdditionalTickerMidPnl);
                StrategyTableInput.Rows[i]["PnlWorst"]       = Math.Round(ButterflyWorstPnl + AdditionalTickerWorstPnl);
            }

            return(StrategyTableInput);
        }
Example #8
0
		void InitListGastos()
		{
			ListGastos = new List<Gasto>();
			SelectedGasto= new SelectedRow();
		}
        public void AddRowExecuted()
        {
            if (SelectedRow != null)
            {
                VoxelCollection.Insert(VoxelCollection.IndexOf(SelectedRow) + 1, (AsteroidByteFillProperties)SelectedRow.Clone());
            }
            else
            {
                VoxelCollection.Add(_dataModel.NewDefaultVoxel(VoxelCollection.Count + 1));
            }

            _dataModel.RenumberCollection();
        }
Example #10
0
		void InitListFuentes()
		{
			ListFuentes = new List<Fuente>();
			SelectedFuente= new SelectedRow();
		}
Example #11
0
		void InitListConceptos()
		{
			ListConceptos = new List<Concepto>();
			SelectedConcepto= new SelectedRow();
		}
Example #12
0
        /// <summary> Add a row. If insertatrow=-1, add to end. Else inserted before index</summary>
        public void AddRow(GLDataGridViewRow row, int insertatrow = -1)
        {
            System.Diagnostics.Debug.Assert(row.Parent == this && row.HeaderStyle.Parent != null); // ensure created by us
            row.HeaderStyle.Changed += (e1) => { ContentInvalidateLayout(); };                     // header style changed, need a complete refresh
            row.AutoSizeGeneration   = 0;
            row.Changed             += (e1) =>
            {
                contentpanel.RowChanged(row.Index); // inform CP
                UpdateScrollBar();                  // update scroll bar
            };

            row.SelectionChanged += (rw, cellno) =>
            {
                //System.Diagnostics.Debug.WriteLine($"Selection changed on {rw.Index} {cellno}");

                if (cellno == -1)                           // if whole row select
                {
                    if (rw.Selected)                        // turning on
                    {
                        if (!AllowUserToSelectMultipleRows) // if not allowed multirow, clear all
                        {
                            ClearSelection();
                        }

                        if (!selectedcells.ContainsKey(rw.Index))
                        {
                            selectedcells[rw.Index] = new HashSet <int>();
                        }

                        foreach (var c in rw.Cells)
                        {
                            selectedcells[rw.Index].Add(c.Index);
                        }

                        SelectedRow?.Invoke(rw, true);
                    }
                    else
                    {   // turning off
                        foreach (var c in rw.Cells)
                        {
                            selectedcells[rw.Index].Remove(c.Index);
                        }

                        if (selectedcells[rw.Index].Count == 0)
                        {
                            selectedcells.Remove(rw.Index);
                        }

                        SelectedRow?.Invoke(rw, false);
                    }
                }
                else if (rows[rw.Index].Cells[cellno].Selected)     // individual cell turning on
                {
                    if (!selectedcells.ContainsKey(rw.Index))
                    {
                        selectedcells[rw.Index] = new HashSet <int>();
                    }
                    selectedcells[rw.Index].Add(cellno);

                    SelectedCell?.Invoke(rows[rw.Index].Cells[cellno], true);
                }
                else
                {
                    selectedcells[rw.Index].Remove(cellno);     // or turning off

                    if (selectedcells[rw.Index].Count == 0)
                    {
                        selectedcells.Remove(rw.Index);
                    }

                    SelectedCell?.Invoke(rows[rw.Index].Cells[cellno], false);
                }

                contentpanel.RowChanged(row.Index);     // inform CP
            };

            if (insertatrow == -1)
            {
                row.SetRowNo(rows.Count, (rows.Count & 1) != 0 ? DefaultAltRowCellStyle : DefaultCellStyle);
                rows.Add(row);
                contentpanel.AddRow(row.Index);       // see if content panel needs redrawing
            }
            else
            {
                rows.Insert(insertatrow, row);
                for (int i = insertatrow; i < rows.Count; i++)
                {
                    rows[i].SetRowNo(i, (i & 1) != 0 ? DefaultAltRowCellStyle : DefaultCellStyle);
                }
                contentpanel.InsertRow(row.Index);       // see if content panel needs redrawing
            }

            UpdateScrollBar();
        }