Exemplo n.º 1
0
        //对话框载入
        private void OrderForm_Load(object sender, EventArgs e)
        {
            dao = new DAO(m_con_str);
            if (!dao.execute_command("update [Seat] set ordering='True' where text='" + m_Seat.text + "'"))
            {
                BathClass.printErrorMsg("手牌状态更新失败!");
                return;
            }
            m_options = dao.get_options();
            if (typeList.Count == 0)
            {
                typeList = dao.get_catgories(null);
            }
            //typeList = db.Catgory.Select(x => x.name).ToList();

            dgvExpense.Columns[11].Visible = MConvert <bool> .ToTypeOrDefault(m_options.启用客房面板, false);

            inputBillId = MConvert <bool> .ToTypeOrDefault(m_options.录单输入单据编号, false);

            inputTechType = MConvert <bool> .ToTypeOrDefault(m_options.录单区分点钟轮钟, false);

            string local_ip = BathClass.get_local_ip();

            stock = dao.get_Stock("select * from [Stock] where ips='" + local_ip + "'");

            this.Invoke(new no_par_delegate(initial_ui), null);

            //MessageBox.Show((DateTime.Now - st).TotalMilliseconds.ToString());
        }
Exemplo n.º 2
0
 private void cboTicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cboTicker.SelectedIndex > -1)
     {
         stock = stocks[cboTicker.SelectedIndex];
     }
 }
Exemplo n.º 3
0
        // GET: Stock/Delete/5
        public ActionResult Delete(Guid id)
        {
            CStock stock = new CStock();

            stock.LoadById(id);
            return(View(stock));
        }
Exemplo n.º 4
0
        public void DeleteStock(Guid id)
        {
            CStock stock = new CStock {
                Id = id
            };

            stock.Delete();
        }
Exemplo n.º 5
0
        public string GetInventoryStockListInCSV(string InputValue, ref string PageInfo)
        {
            COutputValue   pInfo = new COutputValue();
            IList <CStock> list  = new CStockDao().GetInventoryStockList(InputValue, ref pInfo);

            PageInfo = pInfo.ToCSV();
            return(CStock.ToCSV <CStock>(list));
        }
Exemplo n.º 6
0
 private void btnAdd_Click(object sender, RoutedEventArgs e)
 {
     stock        = new CStock();
     stock.Ticker = txtStock.Text;
     stock.Insert();
     Refresh();
     //Close();
 }
Exemplo n.º 7
0
 private void cboStock_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cboStock.SelectedIndex > -1)
     {
         stock         = stocks[cboStock.SelectedIndex];
         txtStock.Text = stock.Ticker;
     }
 }
Exemplo n.º 8
0
 private void CreateOneDictStocksFull(Direction dir)
 {
     foreach (int prec in _pricePrecissions)
     {
         for (int i = 0; i < Count; i++)
         {
             this[dir][prec][i] = new CStock();
         }
     }
 }
Exemplo n.º 9
0
 private void CreateOneDirStocks(Direction dir)
 {
     foreach (int prec in _pricePrecissions)
     {
         for (int i = 0; i < GetStockDepth(prec); i++)
         {
             this[dir][prec][i] = new CStock();
         }
     }
 }
Exemplo n.º 10
0
        //-------------------------------------------------
        private void InitComboEquipementParent(CComboBoxArbreObjetDonneesHierarchique combo)
        {
            CSite  site  = null;
            CStock stock = null;

            if (combo == m_cmbEquipement)
            {
                site = m_selectSite.ElementSelectionne as CSite;
            }
            if (combo == m_cmbEquipementStock)
            {
                stock = m_selectStock.ElementSelectionne as CStock;
            }
            combo.LockEdition = true;
            if (m_equipement.TypeEquipement != null)
            {
                //Récupère les équipements du site qui peuvent contenir cet équipement
                CTypeEquipement[] equips = m_equipement.TypeEquipement.TousLesTypesIncluants;
                string            strIds = "";
                foreach (CTypeEquipement type in equips)
                {
                    strIds += type.Id + ",";
                }
                if (strIds != "")
                {
                    strIds = strIds.Substring(0, strIds.Length - 1);
                    CFiltreData filtreRacine = null;
                    if (site != null)
                    {
                        filtreRacine = new CFiltreData(
                            CSite.c_champId + "=@1", site.Id);
                    }
                    else if (stock != null)
                    {
                        filtreRacine = new CFiltreData(
                            CStock.c_champId + "=@1", stock.Id);
                    }
                    else
                    {
                        filtreRacine = new CFiltreDataImpossible();
                    }
                    CFiltreData filtre = new CFiltreData(
                        CTypeEquipement.c_champId + " in (" + strIds + ") ");
                    filtre = CFiltreData.GetAndFiltre(filtreRacine, filtre);
                    combo.Init(typeof(CEquipement),
                               "EquipementsContenus",
                               CEquipement.c_champIdEquipementContenant,
                               "Libelle|" + CEquipement.c_strCleFormuleGlobaleLibelleEquipement,
                               filtre,
                               filtreRacine);
                    combo.LockEdition = false;
                }
            }
        }
Exemplo n.º 11
0
        public void InsertStocksTest()
        {
            CStock stock = new CStock("GOOG");

            stock.Insert();

            CStock newStock = new CStock();

            newStock.LoadById(stock.Id);

            Assert.AreEqual(stock.Ticker, newStock.Ticker);
        }
Exemplo n.º 12
0
 public ActionResult Delete(Guid id, CStock collection)
 {
     try
     {
         // TODO: Add delete logic here
         collection.Delete();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 13
0
 public ActionResult Create(CStock collection)
 {
     try
     {
         // TODO: Add insert logic here
         collection.Insert();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public CFormEditionOptionsGeneralesCoordonnees()
 {
     InitializeComponent();
     m_contexteDonnee = new CContexteDonnee(CTimosApp.SessionClient.IdSession, true, false);
     m_site           = new CSite(m_contexteDonnee);
     m_site.CreateNewInCurrentContexte();
     m_site.OptionsControleCoordonneesPropre = COptionCoordonnéeGlobale.GetOptionType(CTimosApp.SessionClient.IdSession, typeof(CSite));
     m_equipement = new CEquipement(m_contexteDonnee);
     m_equipement.CreateNewInCurrentContexte();
     m_equipement.OptionsControleCoordonneesPropre = COptionCoordonnéeGlobale.GetOptionType(CTimosApp.SessionClient.IdSession, typeof(CEquipement));
     m_stock = new CStock(m_contexteDonnee);
     m_stock.CreateNewInCurrentContexte();
     m_stock.OptionsControleCoordonneesPropre = COptionCoordonnéeGlobale.GetOptionType(CTimosApp.SessionClient.IdSession, typeof(CStock));
 }
Exemplo n.º 15
0
        //==============================================================================
        int PartitionDesc(CStock[] array, int start, int end)
        {
            int marker = start;

            for (int i = start; i <= end; i++)
            {
                if (array[i].Price >= array[end].Price)
                {
                    CStock temp = array[marker]; // swap
                    array[marker] = array[i];
                    array[i]      = temp;
                    marker       += 1;
                }
            }
            return(marker - 1);
        }
Exemplo n.º 16
0
        public string GetItem(string funcPara)
        {
            //string pInput = string.Format("<InputValue UserID=\"{0}\" Session=\"{1}\" {2}/>", userId, session, inputvalue);
            string InputValue = CXmlPara.CreatePara(funcPara);

            CStock        stock = service.GetInventoryStock(InputValue);
            StringBuilder ret   = new StringBuilder();

            if (stock != null)
            {
                ret.Append("{");
                ret.AppendFormat("ID:'{0}',\n", stock.ID);
                ret.AppendFormat("Code:'{0}',\n", stock.Code);
                ret.AppendFormat("Name:'{0}',\n", stock.Name);
                ret.AppendFormat("ParentID:'{0}',\n", stock.ParentID);
                ret.AppendFormat("Description:'{0}'\n", stock.Description);
                ret.Append("}");
            }
            else
            {
                ret.Append("{}");
            }
            return(ret.ToString());
        }
Exemplo n.º 17
0
        public void UpdateVolumesNewStock(EnmDir dir)
        {
            decimal price  = 0;
            long    volume = 0;
            int     rowNum = 0;

            int i = 0;


            try
            {
                List <List <CStock> > stockList = null;// ModelMarket.OutpStockClass.StockList;



                for (i = 0; i < stockList[(sbyte)dir].Count; i++)
                {
                    CStock stk = stockList[(sbyte)dir][i];
                    //note if we  retrieve price =0 than all other elements are zeroes
                    //and nothing to process
                    if (stk.Price == 0)
                    {
                        //Find lowest and highest from curr stock
                        if (i > 0)
                        {
                            if (dir == EnmDir.Up)
                            {
                                _highestStockPrice = stockList[(sbyte)dir][i - 1].Price;
                            }
                            else if (dir == EnmDir.Down)
                            {
                                _lowestStockPrice = stockList[(sbyte)dir][i - 1].Price;
                            }
                        }
                        break;
                    }
                    price  = stk.Price;
                    volume = stk.Volume;
                    //Rownum for current items
                    rowNum = GetRownumByPrice(price);

                    ((CStockRecord)ListBoxStock.Items[rowNum]).Volume = volume;
                    if (volume != 0)
                    {
                        ((CStockRecord)ListBoxStock.Items[rowNum]).Dir = dir;
                    }

                    //for  all prices beetwen neighbours prices in stock model fill zeroes
                    //in stock  fill zeroes
                    //TO DO move to model or ViewModel

                    if (i > 0)
                    {
                        decimal prevPrice = stockList[(sbyte)dir][i - 1].Price;
                        if (price - prevPrice > _minStep)
                        {
                            int iFrom = GetRownumByPrice(price);
                            int iTo   = GetRownumByPrice(prevPrice);

                            for (int j = iFrom + 1; j < iTo; j++)
                            {
                                ((CStockRecord)ListBoxStock.Items[j]).Volume = 0;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                string st = "";
            }
        }
Exemplo n.º 18
0
        // GET: Stock/Create
        public ActionResult Create()
        {
            CStock c = new CStock();

            return(View(c));
        }
Exemplo n.º 19
0
    public TestProto()
    {
        Random rnd = new Random();

        //CStockClass sc = new CStockClass("Si-6.15");

        CDealsList sc = new CDealsList("Si-6.15");
        // sc.DealsList.Add(new CDealClass());



        List <CStock> lst = new List <CStock>();

        for (int i = 0; i < 100; i++)
        {
            //sc.StockListBids.Add(new CStock(rnd.Next(80000, 85000), rnd.Next(0, 1000)));
            // sc.StockListAsks.Add(new CStock(rnd.Next(80000, 85000), rnd.Next(0, 1000)));
            //StockList[1].Add(new CStockProto(rnd.Next(80000, 85000), rnd.Next(0, 1000)));


            sc.DealsList.Add(new CDealClass
            {
                Amount = 1,
                DtTm   = DateTime.Now,
                //Id = 12345,
                // Isin = "Si-6.15",
                Price = rnd.Next(80000, 85000)
            });

            lst.Add(new CStock(rnd.Next(80000, 85000), rnd.Next(0, 1000)));
        }

        CStock sp = new CStock(8000, 100);
        //MappedEntity me = new MappedEntity();
        //me.Id = 1;
        //me.Name = "2";


        Stopwatch sw = new System.Diagnostics.Stopwatch();

        Stopwatch sw1 = new System.Diagnostics.Stopwatch();
        Stopwatch sw2 = new System.Diagnostics.Stopwatch();
        Stopwatch sw3 = new System.Diagnostics.Stopwatch();


        sw1.Reset(); sw1.Start();
        sw2.Reset(); sw2.Start();
        sw3.Reset(); sw3.Start();



        // var entity = new CStockProto[] { new CStockProto { Id = 1, Name = "123" }, new MappedEntity { Id = 2, Name = "455" } };

        // Serialize/deserialize using protobuf-net
        byte[] serialized = null;


        const int cnt = 100;


        long [] ticks   = new long[cnt];
        long[]  ticksde = new long[cnt];
        long [] msec    = new long[cnt];
        long[]  msecde  = new long[cnt];

        for (int i = 0; i < cnt; i++)
        //  using (var ms = new MemoryStream())
        {
            sw.Reset(); sw.Start();
            var ms = new MemoryStream();
            Serializer.Serialize(ms, sc);
            serialized = ms.ToArray();

            // serialized = ms.GetBuffer();
            sw.Stop();

            sw1.Reset(); sw1.Start();
            //CStockClass t = Serializer.Deserialize<CStockClass>(new MemoryStream(serialized));

            CDealsList t = Serializer.Deserialize <CDealsList>(new MemoryStream(serialized));


            sw1.Stop();



            msec[i]    = sw.ElapsedMilliseconds;
            ticks[i]   = sw.ElapsedTicks;
            msecde[i]  = sw1.ElapsedMilliseconds;
            ticksde[i] = sw1.ElapsedTicks;
        }
        sw1.Stop();
        long ems = sw1.ElapsedMilliseconds;
        // var t = Serializer.Deserialize<MappedEntity>(new MemoryStream(serialized));
        //var t = Serializer.Deserialize<CStockClassProto>(new MemoryStream(serialized));

        //var t = Serializer.Deserialize<CStockProto>(ms);
    }
Exemplo n.º 20
0
 public void DeleteStockObj(CStock stock)
 {
     stock.Delete();
 }
Exemplo n.º 21
0
 public void InsertStockObj(CStock stock)
 {
     stock.Insert();
 }