From: newton-cn Date: Wed, 24 Jul 2024 07:52:17 +0000 (+0900) Subject: 액상 위치정보 조회 및 수정 기능 만듬 X-Git-Url: https://git.insang.kr/gitweb/?a=commitdiff_plain;h=b34f248e58e29d81b4bc6ae64c212f41b9279ca1;p=newton-cn_pos.git 액상 위치정보 조회 및 수정 기능 만듬 --- diff --git a/.vs/newton-cn/v16/.suo b/.vs/newton-cn/v16/.suo index 135d3de..db11c3c 100644 Binary files a/.vs/newton-cn/v16/.suo and b/.vs/newton-cn/v16/.suo differ diff --git a/newton-cn/DBConnector.cs b/newton-cn/DBConnector.cs index b89ef73..95a26b4 100644 --- a/newton-cn/DBConnector.cs +++ b/newton-cn/DBConnector.cs @@ -15,7 +15,7 @@ namespace newton_cn List> result = new List>(); #if DEBUG - SqlConnection conn = new SqlConnection("Data Source=newton-cn.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;"); + SqlConnection conn = new SqlConnection("Data Source=newton-cn1.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;"); #else SqlConnection conn = new SqlConnection("Data Source=localhost; Initial Catalog=food; User ID=newton; Password=newton123!;"); #endif @@ -25,11 +25,13 @@ namespace newton_cn string sql = ""; sql += @" select - a1.pr_name, a2.kind_name, a1.pr_order, a2.kind_order, a1.pr_price1 + a1.pr_name, a2.kind_name, a1.pr_order, a2.kind_order, a1.pr_price1, isnull(a3.location, '') as pr_location, a1.pr_code from pr a1 join kind a2 on a1.kind_code = a2.kind_code + left join pr_location a3 + on a1.pr_code= a3.pr_code where pr_name like '%" + item + @"%' and kind_visible = 0 and pr_visible= 0"; @@ -46,6 +48,8 @@ namespace newton_cn dict["kind_name"] = rd["kind_name"].ToString(); dict["pr_order"] = rd["pr_order"].ToString(); dict["kind_order"] = rd["kind_order"].ToString(); + dict["pr_location"] = rd["pr_location"].ToString(); + dict["pr_code"] = rd["pr_code"].ToString(); result.Add(dict); } @@ -57,7 +61,7 @@ namespace newton_cn int result = 0; #if DEBUG - SqlConnection conn = new SqlConnection("Data Source=newton-cn1.duckdns.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;"); + SqlConnection conn = new SqlConnection("Data Source=newton-cn1.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;"); #else SqlConnection conn = new SqlConnection("Data Source=localhost; Initial Catalog=food; User ID=newton; Password=newton123!;"); #endif @@ -78,5 +82,30 @@ namespace newton_cn return result; } + + public int setLocation(string pr_code, string location) + { +#if DEBUG + SqlConnection conn = new SqlConnection("Data Source=newton-cn1.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;"); +#else + SqlConnection conn = new SqlConnection("Data Source=localhost; Initial Catalog=food; User ID=newton; Password=newton123!;"); +#endif + + conn.Open(); + + string sql = ""; + sql += @" + update pr_location set location='" + location + @"' where pr_code= '" + pr_code + @"' + IF @@ROWCOUNT=0 + insert into pr_location values('" + location + @"', '" + pr_code + @"'); + "; + + SqlCommand cmd_select = new SqlCommand(sql, conn); + + int result = cmd_select.ExecuteNonQuery(); + + return result; + + } } } diff --git a/newton-cn/Form2.Designer.cs b/newton-cn/Form2.Designer.cs index 4ba7477..942dc81 100644 --- a/newton-cn/Form2.Designer.cs +++ b/newton-cn/Form2.Designer.cs @@ -35,6 +35,7 @@ namespace newton_cn this.textBox1 = new System.Windows.Forms.TextBox(); this.listView1 = new System.Windows.Forms.ListView(); this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button3 @@ -100,12 +101,24 @@ namespace newton_cn this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // + // button1 + // + this.button1.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.button1.Location = new System.Drawing.Point(12, 396); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(130, 30); + this.button1.TabIndex = 5; + this.button1.Text = "상품위치설정"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // Form2 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.HighlightText; this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button1); this.Controls.Add(this.listView1); this.Controls.Add(this.label2); this.Controls.Add(this.label1); @@ -131,5 +144,6 @@ namespace newton_cn private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; } } \ No newline at end of file diff --git a/newton-cn/Form2.cs b/newton-cn/Form2.cs index 2f4790a..a1560c5 100644 --- a/newton-cn/Form2.cs +++ b/newton-cn/Form2.cs @@ -54,10 +54,12 @@ namespace newton_cn listView1.FullRowSelect = true; listView1.Columns.Add("소속메뉴", 200); - listView1.Columns.Add("액상이름", 400); - listView1.Columns.Add("가격", 200); + listView1.Columns.Add("액상이름", 370); + listView1.Columns.Add("가격", 110); + listView1.Columns.Add("위치", 100); listView1.Columns.Add("액상위치", 50); listView1.Columns.Add("메뉴위치", 50); + listView1.Columns.Add("prcode", 1); this.ActiveControl = textBox1; } @@ -86,8 +88,10 @@ namespace newton_cn list[i]["kind_name"], list[i]["pr_name"], list[i]["pr_price1"], + list[i]["pr_location"], list[i]["pr_order"], - list[i]["kind_order"] + list[i]["kind_order"], + list[i]["pr_code"] }; ListViewItem lvi = new ListViewItem(item); listView1.Items.Add(lvi); @@ -104,11 +108,11 @@ namespace newton_cn for (int i=0; i + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(79, 12); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(35, 21); + this.textBox1.TabIndex = 0; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(39, 46); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 3; + this.button1.Text = "취소"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(143, 46); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 2; + this.button2.Text = "적용"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(143, 12); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(45, 21); + this.textBox2.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(126, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(11, 12); + this.label1.TabIndex = 4; + this.label1.Text = "-"; + // + // Form4 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(258, 81); + this.ControlBox = false; + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Name = "Form4"; + this.Text = "위치설정"; + this.Load += new System.EventHandler(this.Form4_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/newton-cn/Form4.cs b/newton-cn/Form4.cs new file mode 100644 index 0000000..2e09696 --- /dev/null +++ b/newton-cn/Form4.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace newton_cn +{ + public partial class Form4 : Form + { + private string prcode= ""; + private string location = ""; + public Form4() + { + InitializeComponent(); + } + + public void setPr(string prcode, string location) + { + this.prcode = prcode; + this.location = location; + } + + private void Form4_Load(object sender, EventArgs e) + { + string[] location = this.location.Split('-'); + + if (location.Length != 1) + { + textBox1.Text = location[0]; + textBox2.Text = location[1]; + } + + + } + + private void button2_Click(object sender, EventArgs e) + { + if (String.Equals(this.prcode, "")) + { + MessageBox.Show(new Form { TopMost = true }, "오류발생 처음부터 다시 시도해주세요"); + Application.OpenForms["Form4"].Close(); + return; + } + DBConnector db = new DBConnector(); + string location1 = textBox1.Text; + string location2 = textBox2.Text; + + + int result = db.setLocation(this.prcode, location1 + "-" + location2); + if (result == 1) + { + MessageBox.Show(new Form { TopMost = true }, "적용완료"); + Application.OpenForms["Form4"].Close(); + Application.OpenForms["Form2"].Close(); + return; + } + else + { + MessageBox.Show(new Form { TopMost = true }, "오류발생 처음부터 다시 시도해주세요"); + Application.OpenForms["Form4"].Close(); + Application.OpenForms["Form2"].Close(); + return; + } + } + + private void button1_Click(object sender, EventArgs e) + { + Application.OpenForms["Form4"].Close(); + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/newton-cn/Form4.resx b/newton-cn/Form4.resx new file mode 100644 index 0000000..7080a7d --- /dev/null +++ b/newton-cn/Form4.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/newton-cn/bin/Debug/newton-cn.exe b/newton-cn/bin/Debug/newton-cn.exe index f671054..15ddb29 100644 Binary files a/newton-cn/bin/Debug/newton-cn.exe and b/newton-cn/bin/Debug/newton-cn.exe differ diff --git a/newton-cn/bin/Debug/newton-cn.pdb b/newton-cn/bin/Debug/newton-cn.pdb index 96d1f0d..9778ff9 100644 Binary files a/newton-cn/bin/Debug/newton-cn.pdb and b/newton-cn/bin/Debug/newton-cn.pdb differ diff --git a/newton-cn/bin/Release/newton-cn.exe b/newton-cn/bin/Release/newton-cn.exe index a065ce2..ffaa1d0 100644 Binary files a/newton-cn/bin/Release/newton-cn.exe and b/newton-cn/bin/Release/newton-cn.exe differ diff --git a/newton-cn/bin/Release/newton-cn.pdb b/newton-cn/bin/Release/newton-cn.pdb index b9a40bd..5591a79 100644 Binary files a/newton-cn/bin/Release/newton-cn.pdb and b/newton-cn/bin/Release/newton-cn.pdb differ diff --git a/newton-cn/bin/Release/newton-cn.zip b/newton-cn/bin/Release/newton-cn.zip deleted file mode 100644 index eefdfcd..0000000 Binary files a/newton-cn/bin/Release/newton-cn.zip and /dev/null differ diff --git a/newton-cn/newton-cn.csproj b/newton-cn/newton-cn.csproj index 4aeab16..e29a838 100644 --- a/newton-cn/newton-cn.csproj +++ b/newton-cn/newton-cn.csproj @@ -71,6 +71,12 @@ Form3.cs + + Form + + + Form4.cs + @@ -97,6 +103,9 @@ Form3.cs + + Form4.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 616654b..5b4ca53 100644 Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.csproj.CoreCompileInputs.cache b/newton-cn/obj/Debug/newton-cn.csproj.CoreCompileInputs.cache index 4407085..9557366 100644 --- a/newton-cn/obj/Debug/newton-cn.csproj.CoreCompileInputs.cache +++ b/newton-cn/obj/Debug/newton-cn.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -56ead392093dad3d616723a23a90b2613ebdf9c3 +a57cd293bb18147329b91cd138d49d97ab5de67e diff --git a/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt b/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt index 0f05a54..0beef51 100644 --- a/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt +++ b/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt @@ -32,3 +32,4 @@ z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.cs z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.csproj.CoreCompileInputs.cache z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.exe z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.pdb +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton_cn.Form4.resources diff --git a/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache b/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache index 424f052..82363a7 100644 Binary files a/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache and b/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.exe b/newton-cn/obj/Debug/newton-cn.exe index f671054..15ddb29 100644 Binary files a/newton-cn/obj/Debug/newton-cn.exe and b/newton-cn/obj/Debug/newton-cn.exe differ diff --git a/newton-cn/obj/Debug/newton-cn.pdb b/newton-cn/obj/Debug/newton-cn.pdb index 96d1f0d..9778ff9 100644 Binary files a/newton-cn/obj/Debug/newton-cn.pdb and b/newton-cn/obj/Debug/newton-cn.pdb differ diff --git a/newton-cn/obj/Debug/newton_cn.Form4.resources b/newton-cn/obj/Debug/newton_cn.Form4.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/newton-cn/obj/Debug/newton_cn.Form4.resources differ diff --git a/newton-cn/obj/Release/newton-cn.csproj.CoreCompileInputs.cache b/newton-cn/obj/Release/newton-cn.csproj.CoreCompileInputs.cache index 206340d..df3de98 100644 --- a/newton-cn/obj/Release/newton-cn.csproj.CoreCompileInputs.cache +++ b/newton-cn/obj/Release/newton-cn.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -a8f2a865f4323c7953761747d6204465cd75e02c +2fd756779f42ac4ce5b36cc48039c820d2627401 diff --git a/newton-cn/obj/Release/newton-cn.csproj.FileListAbsolute.txt b/newton-cn/obj/Release/newton-cn.csproj.FileListAbsolute.txt index 7eb5a4c..4241364 100644 --- a/newton-cn/obj/Release/newton-cn.csproj.FileListAbsolute.txt +++ b/newton-cn/obj/Release/newton-cn.csproj.FileListAbsolute.txt @@ -32,3 +32,4 @@ z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton-cn. z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton-cn.exe z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton-cn.pdb z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton_cn.Form3.resources +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton_cn.Form4.resources diff --git a/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache b/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache index 437bae1..9b2d0aa 100644 Binary files a/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache and b/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache differ diff --git a/newton-cn/obj/Release/newton-cn.exe b/newton-cn/obj/Release/newton-cn.exe index a065ce2..ffaa1d0 100644 Binary files a/newton-cn/obj/Release/newton-cn.exe and b/newton-cn/obj/Release/newton-cn.exe differ diff --git a/newton-cn/obj/Release/newton-cn.pdb b/newton-cn/obj/Release/newton-cn.pdb index b9a40bd..5591a79 100644 Binary files a/newton-cn/obj/Release/newton-cn.pdb and b/newton-cn/obj/Release/newton-cn.pdb differ diff --git a/newton-cn/obj/Release/newton_cn.Form4.resources b/newton-cn/obj/Release/newton_cn.Form4.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/newton-cn/obj/Release/newton_cn.Form4.resources differ