Files
Million/Million Buyer/SubForm/IndicatorLoad.cs
2022-09-24 18:50:51 +09:00

94 lines
2.7 KiB
C#

using DevExpress.XtraTreeList.Columns;
using Million;
using Million.DbManagement;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Million_Buyer.SubForm
{
public partial class IndicatorLoadForm : Form
{
public List<Dictionary<string, object>> datas = null;
int id = 0;
public Dictionary<string, object> selectData = null;
public IndicatorLoadForm()
{
InitializeComponent();
Init();
}
private void Init()
{
tl_Indicator.ClearNodes();
datas = DBConnection.QueryGetExcuter_RealTimeIndicator();
if (datas.Count > 0)
{
tl_Indicator.BeginUnboundLoad();
foreach (var item in datas)
{
tl_Indicator.AppendNode(new object[]
{
item["Id"],
item["Name"],
((DateTime)item["SavedDateTime"]).ToString("yyyy-MM-dd HH:mm:ss"),
item["BuyRegularExpression"],
item["SellRegularExpression"]
}, null);
}
tl_Indicator.EndUnboundLoad();
}
}
/// <summary>
/// cancel 버튼
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void bt_Cancel_Click(object sender, EventArgs e)
{
this.Close();
}
/// <summary>
/// ok 버튼
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void bt_Ok_Click(object sender, EventArgs e)
{
try
{
var data = tl_Indicator.Selection.First();
if (data != null)
{
var strId = data["Id"].ToString();
selectData = datas.FirstOrDefault(t => t["Id"].ToString() == strId);
this.DialogResult = DialogResult.OK;
}
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void bt_Delete_Click(object sender, EventArgs e)
{
var strId = tl_Indicator.Selection.First()["Id"].ToString();
DBConnection.QueryUpdateExcuter(CommonProperty.DbConnectionResultData,
"DELETE FROM [ResultData].[dbo].[RealTimeIndicator] WHERE Id = " + strId);
Init();
}
}
}