Hunter에서 Buyer 데이터 생성할 수 있는 기능 추가

This commit is contained in:
kyh
2022-09-24 13:47:13 +09:00
parent 52f1a30030
commit 4d433c8969
6 changed files with 171 additions and 20 deletions

View File

@@ -30,7 +30,6 @@
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.bt_Modify = new System.Windows.Forms.Button();
this.cb_Indicators = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.tb_CycleMoneyValue = new System.Windows.Forms.TextBox();
this.tb_CycleCount = new System.Windows.Forms.TextBox();
@@ -47,14 +46,15 @@
this.label4 = new System.Windows.Forms.Label();
this.bt_Start = new System.Windows.Forms.Button();
this.bt_Stop = new System.Windows.Forms.Button();
this.lb_IndiName = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.lb_IndiName);
this.groupBox1.Controls.Add(this.bt_Modify);
this.groupBox1.Controls.Add(this.cb_Indicators);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.tb_CycleMoneyValue);
this.groupBox1.Controls.Add(this.tb_CycleCount);
@@ -69,21 +69,13 @@
//
// bt_Modify
//
this.bt_Modify.Location = new System.Drawing.Point(279, 80);
this.bt_Modify.Location = new System.Drawing.Point(142, 83);
this.bt_Modify.Name = "bt_Modify";
this.bt_Modify.Size = new System.Drawing.Size(68, 23);
this.bt_Modify.TabIndex = 6;
this.bt_Modify.Text = "수정";
this.bt_Modify.Text = "선택";
this.bt_Modify.UseVisualStyleBackColor = true;
//
// cb_Indicators
//
this.cb_Indicators.FormattingEnabled = true;
this.cb_Indicators.Location = new System.Drawing.Point(142, 84);
this.cb_Indicators.Name = "cb_Indicators";
this.cb_Indicators.Size = new System.Drawing.Size(121, 20);
this.cb_Indicators.TabIndex = 5;
//
// label6
//
this.label6.AutoSize = true;
@@ -141,7 +133,6 @@
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "데이터 현황";
//
// lb_TotalMoneyValue
//
@@ -229,6 +220,14 @@
this.bt_Stop.Text = "Stop";
this.bt_Stop.UseVisualStyleBackColor = true;
//
// lb_IndiName
//
this.lb_IndiName.AutoSize = true;
this.lb_IndiName.Location = new System.Drawing.Point(216, 88);
this.lb_IndiName.Name = "lb_IndiName";
this.lb_IndiName.Size = new System.Drawing.Size(0, 12);
this.lb_IndiName.TabIndex = 7;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -240,7 +239,6 @@
this.Controls.Add(this.groupBox2);
this.Name = "MainForm";
this.Text = "Buyer";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
@@ -252,7 +250,6 @@
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox cb_Indicators;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox tb_CycleMoneyValue;
private System.Windows.Forms.TextBox tb_CycleCount;
@@ -270,6 +267,7 @@
private System.Windows.Forms.Label lb_TotalRate;
private System.Windows.Forms.Button bt_Start;
private System.Windows.Forms.Button bt_Stop;
private System.Windows.Forms.Label lb_IndiName;
}
}

View File

@@ -54,6 +54,9 @@ namespace Million
this.treeListColumn2 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
this.treeListColumn3 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.tb_BuyerIndicatorName = new System.Windows.Forms.TextBox();
this.bt_InsertBuyerIndicator = new DevExpress.XtraEditors.SimpleButton();
this.simpleButton_SaveTest = new DevExpress.XtraEditors.SimpleButton();
this.simpleButton_CalcurateData = new DevExpress.XtraEditors.SimpleButton();
this.simpleButton_ViewResultData = new DevExpress.XtraEditors.SimpleButton();
@@ -279,7 +282,6 @@ namespace Million
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "구매 조건 조합";
//
// treeList_BuySetupList
//
@@ -336,7 +338,7 @@ namespace Million
this.groupBox4.Size = new System.Drawing.Size(426, 217);
this.groupBox4.TabIndex = 0;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "판매 조건 조합";
this.groupBox4.Text = "판매 조건 조합";
//
// treeList_SellSetupList
//
@@ -388,6 +390,9 @@ namespace Million
//
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.label1);
this.groupBox6.Controls.Add(this.tb_BuyerIndicatorName);
this.groupBox6.Controls.Add(this.bt_InsertBuyerIndicator);
this.groupBox6.Controls.Add(this.simpleButton_SaveTest);
this.groupBox6.Controls.Add(this.simpleButton_CalcurateData);
this.groupBox6.Controls.Add(this.simpleButton_ViewResultData);
@@ -398,10 +403,35 @@ namespace Million
this.groupBox6.TabStop = false;
this.groupBox6.Text = "결과 보기";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(210, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 12);
this.label1.TabIndex = 5;
this.label1.Text = "Name :";
//
// tb_BuyerIndicatorName
//
this.tb_BuyerIndicatorName.Location = new System.Drawing.Point(263, 27);
this.tb_BuyerIndicatorName.Name = "tb_BuyerIndicatorName";
this.tb_BuyerIndicatorName.Size = new System.Drawing.Size(126, 21);
this.tb_BuyerIndicatorName.TabIndex = 4;
//
// bt_InsertBuyerIndicator
//
this.bt_InsertBuyerIndicator.Location = new System.Drawing.Point(395, 20);
this.bt_InsertBuyerIndicator.Name = "bt_InsertBuyerIndicator";
this.bt_InsertBuyerIndicator.Size = new System.Drawing.Size(118, 30);
this.bt_InsertBuyerIndicator.TabIndex = 3;
this.bt_InsertBuyerIndicator.Text = "Buyer 정규식에 추가";
this.bt_InsertBuyerIndicator.Click += new System.EventHandler(this.bt_InsertBuyerIndicator_Click);
//
// simpleButton_SaveTest
//
this.simpleButton_SaveTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.simpleButton_SaveTest.Location = new System.Drawing.Point(530, 20);
this.simpleButton_SaveTest.Location = new System.Drawing.Point(557, 20);
this.simpleButton_SaveTest.Name = "simpleButton_SaveTest";
this.simpleButton_SaveTest.Size = new System.Drawing.Size(97, 31);
this.simpleButton_SaveTest.TabIndex = 2;
@@ -553,6 +583,7 @@ namespace Million
this.groupBox4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.treeList_SellSetupList)).EndInit();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.groupBox7.ResumeLayout(false);
this.splitContainer_SetupPanel.Panel1.ResumeLayout(false);
this.splitContainer_SetupPanel.Panel2.ResumeLayout(false);
@@ -608,6 +639,9 @@ namespace Million
private System.Windows.Forms.GroupBox groupBox9;
private DevExpress.XtraEditors.SimpleButton simpleButton_SaveTest;
public DevExpress.XtraEditors.SimpleButton simpleButton_ViewResultData;
private DevExpress.XtraEditors.SimpleButton bt_InsertBuyerIndicator;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tb_BuyerIndicatorName;
}
}

View File

@@ -80,7 +80,8 @@ namespace Million
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateSavedAnalysisDataTableQuery());
Million.DbManagement.DBConnection.QueryUpdateExcuter
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateSavedResultDataTableQuery());
Million.DbManagement.DBConnection.QueryUpdateExcuter
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateRealTimeIndicatorTableQuery());
}
// 지표 콤보박스 클릭 시 이벤트
@@ -464,5 +465,20 @@ namespace Million
else
MessageBox.Show("데이터 저장 실패");
}
/// <summary>
/// Buyer 정규식에 추가
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void bt_InsertBuyerIndicator_Click(object sender, EventArgs e)
{
var name = tb_BuyerIndicatorName.Text;
if (DBConnection.QueryInsertExcuter_RealTimeIndicator(_saveResultData, name))
MessageBox.Show("데이터 저장 성공");
else
MessageBox.Show("데이터 저장 실패");
}
}
}

View File

@@ -134,6 +134,7 @@
<EmbeddedResource Include="HunterMainForm.resx">
<DependentUpon>HunterMainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@@ -214,7 +214,7 @@ namespace Million.DbManagement
conn.Close();
}
}
/// <summary>
/// Insert SavedResultData
/// </summary>
@@ -273,6 +273,60 @@ namespace Million.DbManagement
}
}
/// <summary>
/// insert RealTimeIndicator
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static bool QueryInsertExcuter_RealTimeIndicator(SavedResultData item, string name)
{
var baBinaryFormatter = new BinaryFormatter();
var sqlQuery = DbServiceFunctions.InsertRealTimeIndicatorQuery(item, name);
var strDBCon = CommonProperty.DbConnectionResultData;
SqlConnection conn = null;
SqlDataReader rdr = null;
try
{
using (conn = new SqlConnection(strDBCon))
{
using (var cmd = new SqlCommand(sqlQuery, conn))
{
var buySetupListStream = new MemoryStream();
baBinaryFormatter.Serialize(buySetupListStream, item.BuySetupList);
buySetupListStream.Position = 0;
var sellSetupListStream = new MemoryStream();
baBinaryFormatter.Serialize(sellSetupListStream, item.SellSetupList);
sellSetupListStream.Position = 0;
cmd.Parameters.Add("@BuySetupList", SqlDbType.VarBinary, (int)buySetupListStream.Length).Value = buySetupListStream.ToArray();
cmd.Parameters.Add("@SellSetupList", SqlDbType.VarBinary, (int)sellSetupListStream.Length).Value = sellSetupListStream.ToArray();
conn.Open();
using (rdr = cmd.ExecuteReader())
{
}
}
conn.Close();
}
return true;
}
catch (Exception e)
{
Console.WriteLine(" ============= exception ===============");
Console.WriteLine(e.Message);
if (rdr != null)
rdr.Close();
if (conn != null)
conn.Close();
return false;
}
}
/// <summary>
/// Insert SavedAnalysisData
/// </summary>

View File

@@ -61,7 +61,24 @@ namespace Million.DbManagement
Type nvarchar(50) NOT NULL,
SaveResultType nvarchar(50) NOT NULL,
Description nvarchar(MAX) NULL
)";
}
/// <summary>
/// Create SavedResultData Table
/// </summary>
/// <returns></returns>
public static string CreateRealTimeIndicatorTableQuery()
{
return @"if not exists (select * from sysobjects where name='RealTimeIndicator' and xtype='U')
create table " + "\"RealTimeIndicator\"" + @"(
Id int IDENTITY (1,1) NOT NULL,
Name nvarchar(50) NOT NULL,
SavedDateTime datetime NOT NULL,
BuySetupList varbinary(MAX) NULL,
SellSetupList varbinary(MAX) NULL,
BuyRegularExpression varchar(100) NOT NULL,
SellRegularExpression varchar(100) NOT NULL
)";
}
@@ -442,6 +459,37 @@ namespace Million.DbManagement
}
return flag;
}
/// <summary>
/// Get Real time Indicator query
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static string InsertRealTimeIndicatorQuery(SavedResultData item, string name)
{
var str = string.Format(@"INSERT INTO [ResultData].[dbo].[RealTimeIndicator]
(
[Name]
,[SavedDateTime]
,[BuySetupList]
,[SellSetupList]
,[BuyRegularExpression]
,[SellRegularExpression]
)VALUES(
'{0}',
'{1}',
@BuySetupList,
@SellSetupList,
'{2}',
'{3}'
);",
name,
item.SavedDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
item.BuyRegularExpression,
item.SellRegularExpression
);
return str;
}
/// <summary>
/// Get Insert SavedResultData Query