Esempio n. 1
0
        //Решение Эрланга
        private void Er()
        {
            int f, g;

            if (Int32.TryParse(ErCountBox.Text, out g) && g > 0 && Int32.TryParse(ErModa.Text, out f) && f > 0)
            {
                ErBox.Items.Clear();
                chartEr.Series["Числа"].Points.Clear();
                chartEr.Series["График"].Points.Clear();

                int    n     = Convert.ToInt32(ErCountBox.Text);
                int    count = (int)ErCountNormal.Value;
                double moda  = Double.Parse(ErModa.Text);

                Er er = new Er();
                er.SolveEr(n, moda, count);

                for (int i = 0; i < er.list.Count; i++)
                {
                    ErBox.Items.Add(er.list[i]);
                }
                foreach (var i in er.Dic)
                {
                    chartEr.Series["График"].Points.AddXY(i.Key, i.Value);
                    chartEr.Series["Числа"].Points.AddXY(i.Key, i.Value);
                }
            }
        }
Esempio n. 2
0
 private string GetNBKRSide(Er item)
 {
     foreach (var party in partiesRepo.GetAll().Where(c => c.Erid == item.Id && c.Partyidrole == 11).ToList())
     {
         if (IsPartySellside(party))
         {
             return("SELL");
         }
     }
     return("BUY");
 }
Esempio n. 3
0
        private void atimer_Tick(object sender, EventArgs e)
        {
            duration--;
            //lblCountdown.Text = duration.ToString();
            //if (duration == ticks) timeup = true;

            DateTime dtNow = DateTime.Now;

            if ((dtNow.Hour == h) && (dtNow.Minute == m))
            {
                timeup = true;                                           //BNJ
            }
            if (timeup)
            {
                //Microsoft.VisualBasic.Interaction.Beep();
                Console.Beep();


                try
                {
                    if (FrmKaffET.Visible == false)
                    {
                        FrmKaffET.Visible = true;
                    }
                    ;
                }

                catch (ObjectDisposedException Er)
                {
                    //MessageBox.Show  ("ODisp   " + Er.ToString());
                    SingletonNotificationIcon.Instance.AlarmKaffET.Stop();
                    frmKaffET = new FrmKaffETalarm();
                }

                catch (Exception Er)
                {
                    MessageBox.Show(Er.ToString());
                    //frmKaffET = new FrmKaffETalarm();
                }
            }
        }
Esempio n. 4
0
        public List <OrderManagementSystem.Areas.OMS.Models.Fx> GetList(bool getbuy)
        {
            string dbsqlqueryNonswap = nonswap;
            string dbsqlquerySwap    = swap;
            string dbsqlquerySwapLeg = swapLeg;
            bool   isRateStraight;

            List <OrderManagementSystem.Areas.OMS.Models.Fx> fxs = new List <Areas.OMS.Models.Fx>();
            IList <Er> er = Session.CreateSQLQuery(dbsqlqueryNonswap).AddEntity(typeof(Er)).List <Er>();
            string     nbkrside;

            OrderManagementSystem.Areas.OMS.Models.Fx tempitem;
            foreach (var item in er)
            {
                nbkrside           = GetNBKRSide(item);
                tempitem           = new Areas.OMS.Models.Fx();
                tempitem.TradeDate = item.Tradedate;
                tempitem.SettlDate = item.Settldate;
                //(BUY)

                if ((nbkrside == "BUY" && item.Side == 1) || (nbkrside == "SELL" && item.Side == 2))
                {
                    tempitem.Currency         = item.Currency;
                    tempitem.CurrencyAmt      = item.Orderqty;
                    tempitem.SettlCurrency    = item.Settlcurrency;
                    tempitem.SettlCurrencyAmt = item.Settlcurramt;
                }
                else
                {
                    tempitem.Currency         = item.Settlcurrency;
                    tempitem.CurrencyAmt      = item.Settlcurramt;
                    tempitem.SettlCurrency    = item.Currency;
                    tempitem.SettlCurrencyAmt = item.Orderqty;
                }
                item.Symbol = item.Symbol.Trim();
                if (item.Symbol.IndexOf(tempitem.Currency) == 0)
                {
                    tempitem.LastPx = 1.0 / item.Lastpx;
                }
                else
                {
                    tempitem.LastPx = item.Lastpx;
                }
                tempitem.OrderID  = item.Execid;
                tempitem.isFXSwap = false;
                fxs.Add(tempitem);
            }
            er = Session.CreateSQLQuery(dbsqlquerySwap).AddEntity(typeof(Er)).List <Er>();
            Er            parentEr = null;
            IList <ErLeg> erlegs   = Session.CreateSQLQuery(dbsqlquerySwapLeg).AddEntity(typeof(ErLeg)).List <ErLeg>();
            ErLeg         leg;

            foreach (var item in erlegs)
            {
                //looking for parent SWAP DEAL
                parentEr = er.Where(c => c.Id == item.Erid).First();
                //
                nbkrside           = GetNBKRSide(parentEr);
                tempitem           = new Areas.OMS.Models.Fx();
                tempitem.TradeDate = parentEr.Tradedate;
                tempitem.SettlDate = item.Legsettldate;
                if ((nbkrside == "BUY" && item.Legside == 1) || (nbkrside == "SELL" && item.Legside == 2))
                {
                    tempitem.Currency         = item.Legcurrency;
                    tempitem.CurrencyAmt      = item.Legqty;
                    tempitem.SettlCurrency    = parentEr.Settlcurrency;
                    tempitem.SettlCurrencyAmt = item.Legcalculatedccylastqty;
                    tempitem.LastPx           = item.Leglastpx;
                }
                else
                {
                    tempitem.Currency         = parentEr.Settlcurrency;
                    tempitem.CurrencyAmt      = item.Legcalculatedccylastqty;
                    tempitem.SettlCurrency    = item.Legcurrency;
                    tempitem.SettlCurrencyAmt = item.Legqty;
                    tempitem.LastPx           = item.Leglastpx;
                }
                item.Legsymbol = item.Legsymbol.Trim();
                if (item.Legsymbol.IndexOf(tempitem.Currency) == 0)
                {
                    tempitem.LastPx = 1.0 / item.Leglastpx;
                }
                else
                {
                    tempitem.LastPx = item.Leglastpx;
                }

                tempitem.OrderID  = parentEr.Execid;
                tempitem.isFXSwap = true;
                fxs.Add(tempitem);
            }
            return(fxs);
        }