예제 #1
0
        /// <summary>
        /// Mencari index stock pada list
        /// </summary>
        /// <param name="variableCollection">list stock</param>
        /// <param name="name">nama stock</param>
        /// <returns>index</returns>
        public static int FindStockIndex(SeriesStocks stockCollection, string name)
        {
            stockToFind = new SeriesStock(name, "");
            System.Predicate<SeriesStock> search = findStockPredicate;

            return stockCollection.FindIndex(search);
        }
 public void SetData(SeriesStock stock, SeriesData data)
 {
     this.stockDataGrid.SetData(stock, data);
     this.stockGraph.SetData(stock, data);
     this.Text = stock.StockName;
     this.Name = "STOCK " + stock.StockName;
 }
 public void SetData(SeriesStock stock, SeriesData data)
 {
     this.stock = stock;
     this.data = data;
     this.stock.Changed += new ChangedEventHandler(stock_Changed);
     this.update();
 }
예제 #4
0
        /// <summary>
        /// Mencari index stock pada list
        /// </summary>
        /// <param name="variableCollection">list stock</param>
        /// <param name="name">nama stock</param>
        /// <returns>index</returns>
        public static int FindStockIndex(SeriesStocks stockCollection, string name)
        {
            stockToFind = new SeriesStock(name, "");
            System.Predicate <SeriesStock> search = findStockPredicate;

            return(stockCollection.FindIndex(search));
        }
        public void SetStock(SeriesStock stock)
        {
            this.stock = stock;
            this.txtName.Text = stock.StockName;
            this.txtDescription.Text = stock.StockDescription;

            this.openVariable = stock.Open;
            this.lstVariables.Items.Remove(stock.Open);
            this.txtOpen.Text = this.openVariable.VariableName;
            this.cmdOpen.Text = "<";

            this.highVariable = stock.High;
            this.lstVariables.Items.Remove(stock.High);
            this.txtHigh.Text = this.highVariable.VariableName;
            this.cmdHigh.Text = "<";

            this.lowVariable = stock.Low;
            this.lstVariables.Items.Remove(stock.Low);
            this.txtLow.Text = this.lowVariable.VariableName;
            this.cmdLow.Text = "<";

            this.closeVariable = stock.Close;
            this.lstVariables.Items.Remove(stock.Close);
            this.txtClose.Text = this.closeVariable.VariableName;
            this.cmdClose.Text = "<";

            this.volumeVariable = stock.Volume;
            this.lstVariables.Items.Remove(stock.Volume);
            this.txtVolume.Text = this.volumeVariable.VariableName;
            this.cmdVolume.Text = "<";
        }
예제 #6
0
        private void cmdImportStock_Click(object sender, EventArgs e)
        {
            if (this.data.Frequency == SeriesData.SeriesFrequency.Daily5 || this.data.Frequency == SeriesData.SeriesFrequency.Weekly || this.data.Frequency == SeriesData.SeriesFrequency.Monthly)
            {
                SeriesStocks stocks = this.data.SeriesStocks;
                SeriesVariables vars = this.data.SeriesVariables;
                zaitun.GUI.ImportSeriesStock ser = new zaitun.GUI.ImportSeriesStock(this.data);
                ser.ShowDialog();
                if (ser.DialogResult == DialogResult.OK)
                {
                    try
                    {
                        vars.Add(ser.OpenVariable);
                        vars.Add(ser.HighVariable);
                        vars.Add(ser.LowVariable);
                        vars.Add(ser.CloseVariable);
                        vars.Add(ser.VolumeVariable);
                        SeriesStock tmp = new SeriesStock(ser.StockName, ser.StockDescription, ser.OpenVariable, ser.CloseVariable, ser.HighVariable, ser.LowVariable, ser.VolumeVariable);
                        stocks.Add(tmp);

                        this.seriesDataList.Refresh();
                    }
                    catch (DuplicateVariableException)
                    {
                        MessageBox.Show("Variable already exist", "Duplicate Variable Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    catch (DuplicateStockException)
                    {
                        MessageBox.Show("Stock '" + ser.StockName + "' already exist", "Duplicate Stock Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                MessageBox.Show("Import stock variable only available on project with Daily5, Weekly, or Monthly frequency");
            }
        }
예제 #7
0
        /// <summary>
        /// Clone stock
        /// </summary>
        /// <returns>new stock which has same identity as the source</returns>
        public object Clone()
        {
            SeriesStock clone = new SeriesStock(this.StockName, this.StockDescription, this.Open, this.Close, this.High, this.Low, this.Volume);

            return(clone);
        }
예제 #8
0
        /// <summary>
        /// Clone stock
        /// </summary>
        /// <returns>new stock which has same identity as the source</returns>
        public object Clone()
        {
            SeriesStock clone = new SeriesStock(this.StockName, this.StockDescription, this.Open, this.Close, this.High, this.Low, this.Volume);

            return clone;
        }
예제 #9
0
 /// <summary>
 /// Predicate untuk pencarian stock
 /// </summary>
 /// <param name="search">stock yang akan dicari</param>
 /// <returns>apakah nama stock match</returns>
 private static bool findStockPredicate(SeriesStock search)
 {
     return search.StockName.Equals(stockToFind.StockName);
 }
 public void SetStock(SeriesStock stock)
 {
     this.Text = "Duplicate Stock : " + stock.StockName;
     this.lblName.Text = "New Stock Name";
 }
예제 #11
0
 /// <summary>
 /// Predicate untuk pencarian stock
 /// </summary>
 /// <param name="search">stock yang akan dicari</param>
 /// <returns>apakah nama stock match</returns>
 private static bool findStockPredicate(SeriesStock search)
 {
     return(search.StockName.Equals(stockToFind.StockName));
 }