Continued development
This commit is contained in:
parent
691a999bae
commit
1b4aa175ba
|
|
@ -0,0 +1,49 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using trakker.Models;
|
||||||
|
|
||||||
|
namespace trakker.Data
|
||||||
|
{
|
||||||
|
internal class LOVData(string connectionString) : DataAccess(connectionString)
|
||||||
|
{
|
||||||
|
public BindingList<LOV> Get(string source)
|
||||||
|
{
|
||||||
|
var results = new BindingList<LOV>();
|
||||||
|
|
||||||
|
string sql = $@"
|
||||||
|
SELECT
|
||||||
|
value,
|
||||||
|
display
|
||||||
|
FROM
|
||||||
|
lov
|
||||||
|
WHERE
|
||||||
|
source = $source
|
||||||
|
ORDER BY
|
||||||
|
sort ASC, display ASC
|
||||||
|
;
|
||||||
|
";
|
||||||
|
|
||||||
|
using var conn = OpenConnection();
|
||||||
|
using var cmd = conn.CreateCommand();
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
|
||||||
|
cmd.Parameters.AddWithValue("$source", source);
|
||||||
|
using var reader = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
var _var1 = reader.GetOrdinal("value");
|
||||||
|
var _var2 = reader.GetOrdinal("display");
|
||||||
|
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
results.Add(new LOV(reader.GetString(_var1), reader.GetString(_var2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,14 +33,16 @@ namespace trakker.Data
|
||||||
p.end_date,
|
p.end_date,
|
||||||
p.budget,
|
p.budget,
|
||||||
p.status,
|
p.status,
|
||||||
|
l.display AS status_name,
|
||||||
p.hourly_rate,
|
p.hourly_rate,
|
||||||
p.notes,
|
p.notes,
|
||||||
p.created_at,
|
p.created_at,
|
||||||
p.updated_at
|
p.updated_at
|
||||||
FROM projects p
|
FROM projects p
|
||||||
LEFT JOIN clients c ON p.client_id = c.client_id
|
LEFT JOIN clients c ON p.client_id = c.client_id
|
||||||
WHERE p.status = 'active'
|
JOIN (SELECT value, display FROM lov WHERE source = 'project.status') l ON p.status = l.value
|
||||||
AND {whereClause}
|
WHERE
|
||||||
|
{whereClause}
|
||||||
ORDER BY p.start_date DESC, p.name ASC;
|
ORDER BY p.start_date DESC, p.name ASC;
|
||||||
;
|
;
|
||||||
";
|
";
|
||||||
|
|
@ -65,11 +67,11 @@ namespace trakker.Data
|
||||||
var _var8 = reader.GetOrdinal("end_date");
|
var _var8 = reader.GetOrdinal("end_date");
|
||||||
var _var9 = reader.GetOrdinal("budget");
|
var _var9 = reader.GetOrdinal("budget");
|
||||||
var _var10 = reader.GetOrdinal("status");
|
var _var10 = reader.GetOrdinal("status");
|
||||||
var _var11 = reader.GetOrdinal("hourly_rate");
|
var _var11 = reader.GetOrdinal("status_name");
|
||||||
var _var12 = reader.GetOrdinal("notes");
|
var _var12 = reader.GetOrdinal("hourly_rate");
|
||||||
var _var13 = reader.GetOrdinal("created_at");
|
var _var13 = reader.GetOrdinal("notes");
|
||||||
var _var14 = reader.GetOrdinal("updated_at");
|
var _var14 = reader.GetOrdinal("created_at");
|
||||||
|
var _var15 = reader.GetOrdinal("updated_at");
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
results.Add(new Project
|
results.Add(new Project
|
||||||
|
|
@ -84,10 +86,11 @@ namespace trakker.Data
|
||||||
EndDate = reader.IsDBNull(_var8) ? null : reader.GetDateTime(_var8),
|
EndDate = reader.IsDBNull(_var8) ? null : reader.GetDateTime(_var8),
|
||||||
Budget = reader.GetDecimal(_var9),
|
Budget = reader.GetDecimal(_var9),
|
||||||
Status = reader.GetString(_var10),
|
Status = reader.GetString(_var10),
|
||||||
HourlyRate = reader.GetDecimal(_var11),
|
StatusName = reader.GetString(_var11),
|
||||||
Notes = reader.GetString(_var12),
|
HourlyRate = reader.GetDecimal(_var12),
|
||||||
CreatedAt = reader.GetDateTime(_var13),
|
Notes = reader.GetString(_var13),
|
||||||
UpdatedAt = reader.GetDateTime(_var14),
|
CreatedAt = reader.GetDateTime(_var14),
|
||||||
|
UpdatedAt = reader.GetDateTime(_var15),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
groupBoxNewClient.Size = new Size(1128, 665);
|
groupBoxNewClient.Size = new Size(1128, 665);
|
||||||
groupBoxNewClient.TabIndex = 0;
|
groupBoxNewClient.TabIndex = 0;
|
||||||
groupBoxNewClient.TabStop = false;
|
groupBoxNewClient.TabStop = false;
|
||||||
groupBoxNewClient.Text = "New Client";
|
groupBoxNewClient.Text = "Client";
|
||||||
//
|
//
|
||||||
// tableLayoutPanel1
|
// tableLayoutPanel1
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,14 @@ namespace trakker.Forms
|
||||||
/// visible input controls and configures dialog button behavior.
|
/// visible input controls and configures dialog button behavior.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client">The <see cref="Client"/> instance to edit. Must not be null.</param>
|
/// <param name="client">The <see cref="Client"/> instance to edit. Must not be null.</param>
|
||||||
public ClientForm(Client client)
|
/// <param name="states">The binding source for state values. Must not be null.</param>
|
||||||
|
public ClientForm(Client client, BindingSource states)
|
||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
Text = "Client Details";
|
||||||
|
|
||||||
// Bind model properties to controls so the UI reflects and updates the model.
|
// Bind model properties to controls so the UI reflects and updates the model.
|
||||||
bindingSource.DataSource = _client;
|
bindingSource.DataSource = _client;
|
||||||
textBoxName.DataBindings.Add("Text", bindingSource, "Name", true);
|
textBoxName.DataBindings.Add("Text", bindingSource, "Name", true);
|
||||||
|
|
@ -43,7 +46,10 @@ namespace trakker.Forms
|
||||||
maskedTextBox_Phone.DataBindings.Add("Text", bindingSource, "Phone", true);
|
maskedTextBox_Phone.DataBindings.Add("Text", bindingSource, "Phone", true);
|
||||||
textBoxAddressStreet.DataBindings.Add("Text", bindingSource, "AddressStreet", true);
|
textBoxAddressStreet.DataBindings.Add("Text", bindingSource, "AddressStreet", true);
|
||||||
textBoxAddressCity.DataBindings.Add("Text", bindingSource, "AddressCity", true);
|
textBoxAddressCity.DataBindings.Add("Text", bindingSource, "AddressCity", true);
|
||||||
comboBoxAddressState.DataBindings.Add("Text", bindingSource, "AddressState", true);
|
comboBoxAddressState.DataSource = states;
|
||||||
|
comboBoxAddressState.DisplayMember = "Display";
|
||||||
|
comboBoxAddressState.ValueMember = "Value";
|
||||||
|
comboBoxAddressState.DataBindings.Add("SelectedValue", bindingSource, "AddressState", true);
|
||||||
maskedTextBoxAddressPostal.DataBindings.Add("Text", bindingSource, "AddressPostal", true);
|
maskedTextBoxAddressPostal.DataBindings.Add("Text", bindingSource, "AddressPostal", true);
|
||||||
richTextBoxNotes.DataBindings.Add("Text", bindingSource, "Notes", true);
|
richTextBoxNotes.DataBindings.Add("Text", bindingSource, "Notes", true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,9 @@
|
||||||
MainForm_TabPage3 = new TabPage();
|
MainForm_TabPage3 = new TabPage();
|
||||||
tableLayoutPanelProjects1 = new TableLayoutPanel();
|
tableLayoutPanelProjects1 = new TableLayoutPanel();
|
||||||
dataGridViewProjects = new DataGridView();
|
dataGridViewProjects = new DataGridView();
|
||||||
|
tableLayoutPanelProjects2 = new TableLayoutPanel();
|
||||||
|
groupBoxProjectTasks = new GroupBox();
|
||||||
|
dataGridViewProjectTasks = new DataGridView();
|
||||||
MainForm_MenuStrip.SuspendLayout();
|
MainForm_MenuStrip.SuspendLayout();
|
||||||
tabControlMainForm.SuspendLayout();
|
tabControlMainForm.SuspendLayout();
|
||||||
MainForm_TabPage2.SuspendLayout();
|
MainForm_TabPage2.SuspendLayout();
|
||||||
|
|
@ -48,6 +51,9 @@
|
||||||
MainForm_TabPage3.SuspendLayout();
|
MainForm_TabPage3.SuspendLayout();
|
||||||
tableLayoutPanelProjects1.SuspendLayout();
|
tableLayoutPanelProjects1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewProjects).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridViewProjects).BeginInit();
|
||||||
|
tableLayoutPanelProjects2.SuspendLayout();
|
||||||
|
groupBoxProjectTasks.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewProjectTasks).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// MainForm_MenuStrip
|
// MainForm_MenuStrip
|
||||||
|
|
@ -111,7 +117,7 @@
|
||||||
MainForm_TabPage2.Location = new Point(8, 46);
|
MainForm_TabPage2.Location = new Point(8, 46);
|
||||||
MainForm_TabPage2.Name = "MainForm_TabPage2";
|
MainForm_TabPage2.Name = "MainForm_TabPage2";
|
||||||
MainForm_TabPage2.Padding = new Padding(3);
|
MainForm_TabPage2.Padding = new Padding(3);
|
||||||
MainForm_TabPage2.Size = new Size(1327, 889);
|
MainForm_TabPage2.Size = new Size(1862, 966);
|
||||||
MainForm_TabPage2.TabIndex = 1;
|
MainForm_TabPage2.TabIndex = 1;
|
||||||
MainForm_TabPage2.Text = "Tab 2";
|
MainForm_TabPage2.Text = "Tab 2";
|
||||||
MainForm_TabPage2.UseVisualStyleBackColor = true;
|
MainForm_TabPage2.UseVisualStyleBackColor = true;
|
||||||
|
|
@ -127,8 +133,8 @@
|
||||||
tableLayoutPanelClients1.RowCount = 3;
|
tableLayoutPanelClients1.RowCount = 3;
|
||||||
tableLayoutPanelClients1.RowStyles.Add(new RowStyle(SizeType.Absolute, 1F));
|
tableLayoutPanelClients1.RowStyles.Add(new RowStyle(SizeType.Absolute, 1F));
|
||||||
tableLayoutPanelClients1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
tableLayoutPanelClients1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||||
tableLayoutPanelClients1.RowStyles.Add(new RowStyle(SizeType.Absolute, 200F));
|
tableLayoutPanelClients1.RowStyles.Add(new RowStyle(SizeType.Percent, 0F));
|
||||||
tableLayoutPanelClients1.Size = new Size(1321, 883);
|
tableLayoutPanelClients1.Size = new Size(1856, 960);
|
||||||
tableLayoutPanelClients1.TabIndex = 0;
|
tableLayoutPanelClients1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// dataGridViewClients
|
// dataGridViewClients
|
||||||
|
|
@ -141,7 +147,7 @@
|
||||||
dataGridViewClients.Name = "dataGridViewClients";
|
dataGridViewClients.Name = "dataGridViewClients";
|
||||||
dataGridViewClients.ReadOnly = true;
|
dataGridViewClients.ReadOnly = true;
|
||||||
dataGridViewClients.RowHeadersWidth = 82;
|
dataGridViewClients.RowHeadersWidth = 82;
|
||||||
dataGridViewClients.Size = new Size(1315, 676);
|
dataGridViewClients.Size = new Size(1850, 953);
|
||||||
dataGridViewClients.TabIndex = 0;
|
dataGridViewClients.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// MainForm_TabPage3
|
// MainForm_TabPage3
|
||||||
|
|
@ -149,7 +155,7 @@
|
||||||
MainForm_TabPage3.Controls.Add(tableLayoutPanelProjects1);
|
MainForm_TabPage3.Controls.Add(tableLayoutPanelProjects1);
|
||||||
MainForm_TabPage3.Location = new Point(8, 46);
|
MainForm_TabPage3.Location = new Point(8, 46);
|
||||||
MainForm_TabPage3.Name = "MainForm_TabPage3";
|
MainForm_TabPage3.Name = "MainForm_TabPage3";
|
||||||
MainForm_TabPage3.Size = new Size(1327, 889);
|
MainForm_TabPage3.Size = new Size(1862, 966);
|
||||||
MainForm_TabPage3.TabIndex = 2;
|
MainForm_TabPage3.TabIndex = 2;
|
||||||
MainForm_TabPage3.Text = "Tab 3";
|
MainForm_TabPage3.Text = "Tab 3";
|
||||||
MainForm_TabPage3.UseVisualStyleBackColor = true;
|
MainForm_TabPage3.UseVisualStyleBackColor = true;
|
||||||
|
|
@ -159,14 +165,15 @@
|
||||||
tableLayoutPanelProjects1.ColumnCount = 1;
|
tableLayoutPanelProjects1.ColumnCount = 1;
|
||||||
tableLayoutPanelProjects1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
tableLayoutPanelProjects1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||||
tableLayoutPanelProjects1.Controls.Add(dataGridViewProjects, 0, 1);
|
tableLayoutPanelProjects1.Controls.Add(dataGridViewProjects, 0, 1);
|
||||||
|
tableLayoutPanelProjects1.Controls.Add(tableLayoutPanelProjects2, 0, 2);
|
||||||
tableLayoutPanelProjects1.Dock = DockStyle.Fill;
|
tableLayoutPanelProjects1.Dock = DockStyle.Fill;
|
||||||
tableLayoutPanelProjects1.Location = new Point(0, 0);
|
tableLayoutPanelProjects1.Location = new Point(0, 0);
|
||||||
tableLayoutPanelProjects1.Name = "tableLayoutPanelProjects1";
|
tableLayoutPanelProjects1.Name = "tableLayoutPanelProjects1";
|
||||||
tableLayoutPanelProjects1.RowCount = 3;
|
tableLayoutPanelProjects1.RowCount = 3;
|
||||||
tableLayoutPanelProjects1.RowStyles.Add(new RowStyle(SizeType.Absolute, 1F));
|
tableLayoutPanelProjects1.RowStyles.Add(new RowStyle(SizeType.Absolute, 1F));
|
||||||
tableLayoutPanelProjects1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
tableLayoutPanelProjects1.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||||
tableLayoutPanelProjects1.RowStyles.Add(new RowStyle(SizeType.Absolute, 200F));
|
tableLayoutPanelProjects1.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||||
tableLayoutPanelProjects1.Size = new Size(1327, 889);
|
tableLayoutPanelProjects1.Size = new Size(1862, 966);
|
||||||
tableLayoutPanelProjects1.TabIndex = 1;
|
tableLayoutPanelProjects1.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// dataGridViewProjects
|
// dataGridViewProjects
|
||||||
|
|
@ -179,9 +186,48 @@
|
||||||
dataGridViewProjects.Name = "dataGridViewProjects";
|
dataGridViewProjects.Name = "dataGridViewProjects";
|
||||||
dataGridViewProjects.ReadOnly = true;
|
dataGridViewProjects.ReadOnly = true;
|
||||||
dataGridViewProjects.RowHeadersWidth = 82;
|
dataGridViewProjects.RowHeadersWidth = 82;
|
||||||
dataGridViewProjects.Size = new Size(1321, 682);
|
dataGridViewProjects.Size = new Size(1856, 476);
|
||||||
dataGridViewProjects.TabIndex = 0;
|
dataGridViewProjects.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// tableLayoutPanelProjects2
|
||||||
|
//
|
||||||
|
tableLayoutPanelProjects2.ColumnCount = 3;
|
||||||
|
tableLayoutPanelProjects2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 0F));
|
||||||
|
tableLayoutPanelProjects2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||||
|
tableLayoutPanelProjects2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 0F));
|
||||||
|
tableLayoutPanelProjects2.Controls.Add(groupBoxProjectTasks, 1, 0);
|
||||||
|
tableLayoutPanelProjects2.Dock = DockStyle.Fill;
|
||||||
|
tableLayoutPanelProjects2.Location = new Point(3, 486);
|
||||||
|
tableLayoutPanelProjects2.Name = "tableLayoutPanelProjects2";
|
||||||
|
tableLayoutPanelProjects2.RowCount = 1;
|
||||||
|
tableLayoutPanelProjects2.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||||
|
tableLayoutPanelProjects2.Size = new Size(1856, 477);
|
||||||
|
tableLayoutPanelProjects2.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// groupBoxProjectTasks
|
||||||
|
//
|
||||||
|
groupBoxProjectTasks.Controls.Add(dataGridViewProjectTasks);
|
||||||
|
groupBoxProjectTasks.Dock = DockStyle.Fill;
|
||||||
|
groupBoxProjectTasks.Location = new Point(3, 3);
|
||||||
|
groupBoxProjectTasks.Name = "groupBoxProjectTasks";
|
||||||
|
groupBoxProjectTasks.Size = new Size(1850, 471);
|
||||||
|
groupBoxProjectTasks.TabIndex = 0;
|
||||||
|
groupBoxProjectTasks.TabStop = false;
|
||||||
|
groupBoxProjectTasks.Text = "Tasks";
|
||||||
|
//
|
||||||
|
// dataGridViewProjectTasks
|
||||||
|
//
|
||||||
|
dataGridViewProjectTasks.AllowUserToAddRows = false;
|
||||||
|
dataGridViewProjectTasks.AllowUserToDeleteRows = false;
|
||||||
|
dataGridViewProjectTasks.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewProjectTasks.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewProjectTasks.Location = new Point(3, 35);
|
||||||
|
dataGridViewProjectTasks.Name = "dataGridViewProjectTasks";
|
||||||
|
dataGridViewProjectTasks.ReadOnly = true;
|
||||||
|
dataGridViewProjectTasks.RowHeadersWidth = 82;
|
||||||
|
dataGridViewProjectTasks.Size = new Size(1844, 433);
|
||||||
|
dataGridViewProjectTasks.TabIndex = 0;
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
|
@ -202,6 +248,9 @@
|
||||||
MainForm_TabPage3.ResumeLayout(false);
|
MainForm_TabPage3.ResumeLayout(false);
|
||||||
tableLayoutPanelProjects1.ResumeLayout(false);
|
tableLayoutPanelProjects1.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewProjects).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridViewProjects).EndInit();
|
||||||
|
tableLayoutPanelProjects2.ResumeLayout(false);
|
||||||
|
groupBoxProjectTasks.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewProjectTasks).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
@ -220,5 +269,8 @@
|
||||||
private TabPage MainForm_TabPage3;
|
private TabPage MainForm_TabPage3;
|
||||||
private TableLayoutPanel tableLayoutPanelProjects1;
|
private TableLayoutPanel tableLayoutPanelProjects1;
|
||||||
private DataGridView dataGridViewProjects;
|
private DataGridView dataGridViewProjects;
|
||||||
|
private TableLayoutPanel tableLayoutPanelProjects2;
|
||||||
|
private GroupBox groupBoxProjectTasks;
|
||||||
|
private DataGridView dataGridViewProjectTasks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ namespace trakker
|
||||||
var selectedClient = dataGridViewClients.SelectedRows[0].DataBoundItem as Client;
|
var selectedClient = dataGridViewClients.SelectedRows[0].DataBoundItem as Client;
|
||||||
if (selectedClient != null)
|
if (selectedClient != null)
|
||||||
{
|
{
|
||||||
var dialog = new ClientForm(selectedClient);
|
var dialog = new ClientForm(selectedClient, _ctrl.GetLOV("state"));
|
||||||
if (dialog.ShowDialog(this) == DialogResult.OK)
|
if (dialog.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
Client client = dialog.Client;
|
Client client = dialog.Client;
|
||||||
|
|
@ -236,7 +236,7 @@ namespace trakker
|
||||||
var textColumn = new DataGridViewTextBoxColumn
|
var textColumn = new DataGridViewTextBoxColumn
|
||||||
{
|
{
|
||||||
AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
|
AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
|
||||||
DataPropertyName = "Status",
|
DataPropertyName = "StatusName",
|
||||||
Name = "Status",
|
Name = "Status",
|
||||||
Visible = true,
|
Visible = true,
|
||||||
};
|
};
|
||||||
|
|
@ -250,7 +250,7 @@ namespace trakker
|
||||||
var selectedProject = dataGridViewProjects.SelectedRows[0].DataBoundItem as Project;
|
var selectedProject = dataGridViewProjects.SelectedRows[0].DataBoundItem as Project;
|
||||||
if (selectedProject != null)
|
if (selectedProject != null)
|
||||||
{
|
{
|
||||||
var dialog = new ProjectForm(selectedProject, _ctrl.GetClients());
|
var dialog = new ProjectForm(selectedProject, _ctrl.GetClients(), _ctrl.GetLOV("project.status"));
|
||||||
if (dialog.ShowDialog(this) == DialogResult.OK)
|
if (dialog.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
Project project = dialog.Project;
|
Project project = dialog.Project;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
groupBoxNewClient.Size = new Size(1144, 660);
|
groupBoxNewClient.Size = new Size(1144, 660);
|
||||||
groupBoxNewClient.TabIndex = 1;
|
groupBoxNewClient.TabIndex = 1;
|
||||||
groupBoxNewClient.TabStop = false;
|
groupBoxNewClient.TabStop = false;
|
||||||
groupBoxNewClient.Text = "New Client";
|
groupBoxNewClient.Text = "Project";
|
||||||
//
|
//
|
||||||
// tableLayoutPanel1
|
// tableLayoutPanel1
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,15 @@ namespace trakker.Forms
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="project">The <see cref="Project"/> instance to edit. Must not be null.</param>
|
/// <param name="project">The <see cref="Project"/> instance to edit. Must not be null.</param>
|
||||||
/// <param name="clients">The list of <see cref="Client"/> instances to select from. Must not be null.</param>
|
/// <param name="clients">The list of <see cref="Client"/> instances to select from. Must not be null.</param>
|
||||||
public ProjectForm(Project project, BindingList<Client> clients)
|
/// <param name="status">The binding source for status values. Must not be null.</param>
|
||||||
|
public ProjectForm(Project project, BindingList<Client> clients, BindingSource status)
|
||||||
{
|
{
|
||||||
_project = project;
|
_project = project;
|
||||||
_clients = clients;
|
_clients = clients;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
Text = "Project Details";
|
||||||
|
|
||||||
comboBoxClient.DataSource = _clients;
|
comboBoxClient.DataSource = _clients;
|
||||||
comboBoxClient.DisplayMember = "Name";
|
comboBoxClient.DisplayMember = "Name";
|
||||||
comboBoxClient.ValueMember = "ClientId";
|
comboBoxClient.ValueMember = "ClientId";
|
||||||
|
|
@ -58,7 +61,10 @@ namespace trakker.Forms
|
||||||
dateTimePickerEndDate.DataBindings.Add("Value", bindingSource, "EndDate", true);
|
dateTimePickerEndDate.DataBindings.Add("Value", bindingSource, "EndDate", true);
|
||||||
textBoxHourlyRate.DataBindings.Add("Text", bindingSource, "HourlyRate", true);
|
textBoxHourlyRate.DataBindings.Add("Text", bindingSource, "HourlyRate", true);
|
||||||
textBoxBudget.DataBindings.Add("Text", bindingSource, "Budget", true);
|
textBoxBudget.DataBindings.Add("Text", bindingSource, "Budget", true);
|
||||||
comboBoxStatus.DataBindings.Add("ValueMember", bindingSource, "Status", true);
|
comboBoxStatus.DataSource = status;
|
||||||
|
comboBoxStatus.DisplayMember = "Display";
|
||||||
|
comboBoxStatus.ValueMember = "Value";
|
||||||
|
comboBoxStatus.DataBindings.Add("SelectedValue", bindingSource, "Status", true);
|
||||||
richTextBoxNotes.DataBindings.Add("Text", bindingSource, "Notes", true);
|
richTextBoxNotes.DataBindings.Add("Text", bindingSource, "Notes", true);
|
||||||
|
|
||||||
// Configure dialog buttons and window behavior.
|
// Configure dialog buttons and window behavior.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
namespace trakker.Models
|
||||||
|
{
|
||||||
|
internal class LOV
|
||||||
|
{
|
||||||
|
public LOV(string value, string display)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
Display = display;
|
||||||
|
}
|
||||||
|
public string Value { get; set; }
|
||||||
|
public string Display { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,8 @@ namespace trakker.Models
|
||||||
|
|
||||||
public string Status { get; set; } = string.Empty;
|
public string Status { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string StatusName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public decimal? HourlyRate { get; set; }
|
public decimal? HourlyRate { get; set; }
|
||||||
|
|
||||||
public string? Notes { get; set; } = string.Empty;
|
public string? Notes { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,11 @@ namespace trakker.Services
|
||||||
LoadProjects();
|
LoadProjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BindingSource GetLOV(string source)
|
||||||
|
{
|
||||||
|
var dbo = new Data.LOVData(_connectionString);
|
||||||
|
return new BindingSource { DataSource = dbo.Get(source) };
|
||||||
|
}
|
||||||
public BindingList<Client> GetClients()
|
public BindingList<Client> GetClients()
|
||||||
{
|
{
|
||||||
var dbo = new Data.ClientData(_connectionString);
|
var dbo = new Data.ClientData(_connectionString);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue