From b790a7b6421c36a2a769492ef24327ef2023f719 Mon Sep 17 00:00:00 2001 From: Bobbie Hodgetts Date: Thu, 9 May 2024 16:42:32 +0100 Subject: [PATCH] wip --- bnhtrade.gui/Form1.Designer.cs | 149 ++++++++++++++++++ bnhtrade.gui/Form1.cs | 33 ++++ bnhtrade.gui/Form1.resx | 120 ++++++++++++++ bnhtrade.gui/Program.cs | 17 ++ bnhtrade.gui/bnhtrade.gui.csproj | 11 ++ bnhtrade.sln | 6 + .../Database/Purchase/PurchaseLineStatus.cs | 54 +++++++ .../Logic/Purchase/PurchaseLineStatus.cs | 16 ++ .../Model/Purchase/PurchaseLineStatus.cs | 18 +++ src/bnhtrade.Core/bnhtrade.Core.csproj | 3 + 10 files changed, 427 insertions(+) create mode 100644 bnhtrade.gui/Form1.Designer.cs create mode 100644 bnhtrade.gui/Form1.cs create mode 100644 bnhtrade.gui/Form1.resx create mode 100644 bnhtrade.gui/Program.cs create mode 100644 bnhtrade.gui/bnhtrade.gui.csproj create mode 100644 src/bnhtrade.Core/Data/Database/Purchase/PurchaseLineStatus.cs create mode 100644 src/bnhtrade.Core/Logic/Purchase/PurchaseLineStatus.cs create mode 100644 src/bnhtrade.Core/Model/Purchase/PurchaseLineStatus.cs diff --git a/bnhtrade.gui/Form1.Designer.cs b/bnhtrade.gui/Form1.Designer.cs new file mode 100644 index 0000000..843036f --- /dev/null +++ b/bnhtrade.gui/Form1.Designer.cs @@ -0,0 +1,149 @@ +namespace bnhtrade.gui +{ + partial class Form1 + { + /// + /// 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() + { + tabControl1 = new TabControl(); + tabPage1 = new TabPage(); + tabPage3 = new TabPage(); + comboBox1 = new ComboBox(); + dtTmOrderSearch = new DateTimePicker(); + label1 = new Label(); + txtbxOrderSearch = new TextBox(); + tabPage2 = new TabPage(); + tabControl1.SuspendLayout(); + tabPage3.SuspendLayout(); + SuspendLayout(); + // + // tabControl1 + // + tabControl1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + tabControl1.Controls.Add(tabPage1); + tabControl1.Controls.Add(tabPage3); + tabControl1.Controls.Add(tabPage2); + tabControl1.Location = new Point(12, 12); + tabControl1.Name = "tabControl1"; + tabControl1.SelectedIndex = 0; + tabControl1.Size = new Size(1010, 533); + tabControl1.TabIndex = 0; + tabControl1.SelectedIndexChanged += tabControl1_SelectedIndexChanged; + // + // tabPage1 + // + tabPage1.Location = new Point(4, 24); + tabPage1.Name = "tabPage1"; + tabPage1.Padding = new Padding(3); + tabPage1.Size = new Size(1002, 505); + tabPage1.TabIndex = 0; + tabPage1.Text = "Home"; + tabPage1.UseVisualStyleBackColor = true; + // + // tabPage3 + // + tabPage3.Controls.Add(comboBox1); + tabPage3.Controls.Add(dtTmOrderSearch); + tabPage3.Controls.Add(label1); + tabPage3.Controls.Add(txtbxOrderSearch); + tabPage3.Location = new Point(4, 24); + tabPage3.Name = "tabPage3"; + tabPage3.Padding = new Padding(3); + tabPage3.Size = new Size(1002, 505); + tabPage3.TabIndex = 2; + tabPage3.Text = "Receiving"; + tabPage3.UseVisualStyleBackColor = true; + tabPage3.Click += tabPage3_Click; + // + // comboBox1 + // + comboBox1.FormattingEnabled = true; + comboBox1.Location = new Point(580, 46); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(214, 23); + comboBox1.TabIndex = 3; + // + // dtTmOrderSearch + // + dtTmOrderSearch.Location = new Point(356, 46); + dtTmOrderSearch.Name = "dtTmOrderSearch"; + dtTmOrderSearch.Size = new Size(157, 23); + dtTmOrderSearch.TabIndex = 2; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(31, 28); + label1.Name = "label1"; + label1.Size = new Size(75, 15); + label1.TabIndex = 1; + label1.Text = "Order Search"; + // + // txtbxOrderSearch + // + txtbxOrderSearch.Location = new Point(31, 46); + txtbxOrderSearch.Name = "txtbxOrderSearch"; + txtbxOrderSearch.Size = new Size(268, 23); + txtbxOrderSearch.TabIndex = 0; + // + // tabPage2 + // + tabPage2.AccessibleName = ""; + tabPage2.Location = new Point(4, 24); + tabPage2.Name = "tabPage2"; + tabPage2.Padding = new Padding(3); + tabPage2.Size = new Size(1002, 505); + tabPage2.TabIndex = 1; + tabPage2.Text = "FBA Shipments"; + tabPage2.UseVisualStyleBackColor = true; + // + // Form1 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1034, 557); + Controls.Add(tabControl1); + Name = "Form1"; + Text = "Form1"; + Load += Form1_Load; + tabControl1.ResumeLayout(false); + tabPage3.ResumeLayout(false); + tabPage3.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private TabControl tabControl1; + private TabPage tabPage1; + private TabPage tabPage2; + private TabPage tabPage3; + private TextBox txtbxOrderSearch; + private Label label1; + private DateTimePicker dtTmOrderSearch; + private ComboBox comboBox1; + } +} diff --git a/bnhtrade.gui/Form1.cs b/bnhtrade.gui/Form1.cs new file mode 100644 index 0000000..61818d0 --- /dev/null +++ b/bnhtrade.gui/Form1.cs @@ -0,0 +1,33 @@ +namespace bnhtrade.gui +{ + public partial class Form1 : Form + { + + bool loadedTabIndex1 = false; + + public Form1() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + + } + + private void tabPage3_Click(object sender, EventArgs e) + { + + } + + private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) + { + int index = (sender as TabControl).SelectedIndex; + + if (index == 1) + { + + } + } + } +} diff --git a/bnhtrade.gui/Form1.resx b/bnhtrade.gui/Form1.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/bnhtrade.gui/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/bnhtrade.gui/Program.cs b/bnhtrade.gui/Program.cs new file mode 100644 index 0000000..51d9543 --- /dev/null +++ b/bnhtrade.gui/Program.cs @@ -0,0 +1,17 @@ +namespace bnhtrade.gui +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/bnhtrade.gui/bnhtrade.gui.csproj b/bnhtrade.gui/bnhtrade.gui.csproj new file mode 100644 index 0000000..663fdb8 --- /dev/null +++ b/bnhtrade.gui/bnhtrade.gui.csproj @@ -0,0 +1,11 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + \ No newline at end of file diff --git a/bnhtrade.sln b/bnhtrade.sln index 3031671..6a56ea9 100644 --- a/bnhtrade.sln +++ b/bnhtrade.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtrade.ComTypeLib", "src\ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{3D90C0F5-02E7-44E5-A89D-F5E217C6602F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bnhtrade.gui", "bnhtrade.gui\bnhtrade.gui.csproj", "{9FC75037-D13C-46F2-A3F4-5C13F0A8850E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -31,6 +33,10 @@ Global {C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {C3405E9D-B47A-4569-B6A3-BC9E7AA71EE5}.Release|Any CPU.Build.0 = Release|Any CPU + {9FC75037-D13C-46F2-A3F4-5C13F0A8850E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FC75037-D13C-46F2-A3F4-5C13F0A8850E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FC75037-D13C-46F2-A3F4-5C13F0A8850E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FC75037-D13C-46F2-A3F4-5C13F0A8850E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/bnhtrade.Core/Data/Database/Purchase/PurchaseLineStatus.cs b/src/bnhtrade.Core/Data/Database/Purchase/PurchaseLineStatus.cs new file mode 100644 index 0000000..b58618d --- /dev/null +++ b/src/bnhtrade.Core/Data/Database/Purchase/PurchaseLineStatus.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Data.Database.Purchase +{ + internal class PurchaseLineStatus : Connection + { + public List Read() + { + var returnList = new List(); + + using (SqlConnection conn = new SqlConnection(SqlConnectionString)) + { + conn.Open(); + + using (SqlCommand cmd = new SqlCommand(@" + SELECT [PurchaseLineStatusID] + ,[PurchaseLineStatus] + ,[ListSort] + ,[TimeStamp] + FROM [e2A].[dbo].[tblPurchaseLineStatus] + ORDER BY [ListSort] + ", conn)) + { + + using (SqlDataReader reader = cmd.ExecuteReader()) + { + if (!reader.HasRows) + { + // do something + } + else + { + while (reader.Read()) + { + int id = reader.GetInt32(0); + string name = reader.GetString(1); + int lineSort = reader.GetInt32(2); + + var returnItem = new Model.Purchase.PurchaseLineStatus(id, name,lineSort); + returnList.Add( returnItem ); + } + } + } + } + } + return returnList; + } + } +} diff --git a/src/bnhtrade.Core/Logic/Purchase/PurchaseLineStatus.cs b/src/bnhtrade.Core/Logic/Purchase/PurchaseLineStatus.cs new file mode 100644 index 0000000..4ddccc1 --- /dev/null +++ b/src/bnhtrade.Core/Logic/Purchase/PurchaseLineStatus.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Logic.Purchase +{ + public class PurchaseLineStatus + { + public List ReadAll() + { + return new Data.Database.Purchase.PurchaseLineStatus().Read(); + } + } +} diff --git a/src/bnhtrade.Core/Model/Purchase/PurchaseLineStatus.cs b/src/bnhtrade.Core/Model/Purchase/PurchaseLineStatus.cs new file mode 100644 index 0000000..f7bae9f --- /dev/null +++ b/src/bnhtrade.Core/Model/Purchase/PurchaseLineStatus.cs @@ -0,0 +1,18 @@ +namespace bnhtrade.Core.Model.Purchase +{ + public class PurchaseLineStatus + { + public PurchaseLineStatus(int statusId, string statusName, int listSort) + { + PurchaseLineStatusId = statusId; + PurchaseLineStatusName = statusName; + ListSort = listSort; + } + + public int PurchaseLineStatusId {get; private set;} + + public string PurchaseLineStatusName { get; private set;} + + public int ListSort { get; private set;} + } +} diff --git a/src/bnhtrade.Core/bnhtrade.Core.csproj b/src/bnhtrade.Core/bnhtrade.Core.csproj index 506a48a..7e43728 100644 --- a/src/bnhtrade.Core/bnhtrade.Core.csproj +++ b/src/bnhtrade.Core/bnhtrade.Core.csproj @@ -177,6 +177,7 @@ + @@ -236,6 +237,7 @@ + @@ -294,6 +296,7 @@ +