示例#1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            pnlContent.Controls.Clear();

            MantraHistory mantra = new MantraHistory();

            mantra.Item = cbxItem.SelectedItem.ToString();

            if (mantra.Item == "ALL")
            {
                mantra.Item = "";
            }

            Entities entities = (Entities)mantra.Collect();

            foreach (var m in entities.Cast <MantraHistory>())
            {
                var uc = new uc_MantraHistory();
                uc.BindItem(m);
                uc.Dock = DockStyle.Top;

                pnlContent.Controls.Add(uc);
            }

            if (entities.Count == 0)
            {
                var uc = new uc_MantraHistory();
                uc.BindItem(new MantraHistory());
                uc.Dock = DockStyle.Top;
                pnlContent.Controls.Add(uc);
            }
        }
示例#2
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                MantraHistory item = new MantraHistory();
                item.No = mantraItem.No;
                item.Delete();

                Parent.Controls.Remove(this);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#3
0
        private void btnReg_Click(object sender, EventArgs e)
        {
            try
            {
                MantraHistory item = new MantraHistory();
                item.No   = 0;
                item.Item = tbItem.Text;
                if (item.Item.Length == 0)
                {
                    return;
                }

                if (cbBuySell.SelectedIndex == 0)
                {
                    item.BuySell = "진입";
                }
                else if (cbBuySell.SelectedIndex == 1)
                {
                    item.BuySell = "청산";
                }

                if (cbPosition.SelectedIndex == 0)
                {
                    item.Position = "매수";
                }
                else if (cbPosition.SelectedIndex == 1)
                {
                    item.Position = "매도";
                }

                item.ContractPrice = tbPrice.Text;
                item.ContractTime  = tbTime.Text;
                item.Quantity      = Convert.ToInt16(tbQuantity.Text.Length == 0 ? "0" : tbQuantity.Text);

                if (cbIncomingType.SelectedIndex == 0)
                {
                    item.IncomingType = "수익";
                }
                else if (cbIncomingType.SelectedIndex == 1)
                {
                    item.IncomingType = "손실";
                }
                else if (cbIncomingType.SelectedIndex == 2)
                {
                    item.IncomingType = "본전";
                }

                item.Incoming = tbIncoming.Text;

                if (item.BuySell == "진입")
                {
                    item.BuyReason = tbReason.Text;
                }
                else if (item.BuySell == "청산")
                {
                    item.SellReason = tbReason.Text;
                }

                item.Create();

                MessageBox.Show("등록되었습니다.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#4
0
        public void BindItem(MantraHistory item)
        {
            try
            {
                mantraItem = item;

                tbItem.Text = item.Item;

                if (item.BuySell == "진입")
                {
                    cbBuySell.SelectedIndex = 0;
                }
                else if (item.BuySell == "청산")
                {
                    cbBuySell.SelectedIndex = 1;
                }

                if (item.Position == "매수")
                {
                    cbPosition.SelectedIndex = 0;
                }
                else if (item.Position == "매도")
                {
                    cbPosition.SelectedIndex = 1;
                }

                tbPrice.Text    = item.ContractPrice;
                tbTime.Text     = item.ContractTime;
                tbQuantity.Text = item.Quantity.ToString();

                if (item.IncomingType == "수익")
                {
                    cbIncomingType.SelectedIndex = 0;
                }
                else if (item.IncomingType == "손실")
                {
                    cbIncomingType.SelectedIndex = 1;
                }
                else if (item.IncomingType == "본전")
                {
                    cbIncomingType.SelectedIndex = 2;
                }

                tbIncoming.Text = item.Incoming;
                if (item.BuySell == "진입")
                {
                    tbReason.Text = item.BuyReason;
                }
                else if (item.BuySell == "청산")
                {
                    tbReason.Text = item.SellReason;
                }

                if (item.BuySell == "진입")
                {
                    this.ForeColor = Color.Gold;
                }
                else if (item.BuySell == "청산")
                {
                    if (item.IncomingType == "수익")
                    {
                        this.ForeColor = Color.Red;
                    }
                    else if (item.IncomingType == "손실")
                    {
                        this.ForeColor = Color.Blue;
                    }
                }
            }
            catch (Exception ex)
            { System.Diagnostics.Debug.WriteLine(ex.Message); }
        }