New editwindow , before connection
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
@ -10,6 +11,7 @@ namespace StockInfoCore
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
public static IConfiguration Configuration;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
|
||||
@ -25,6 +25,12 @@
|
||||
<ProjectReference Include="..\StockDAL\StockDAL.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="frmEditStock.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Stocks.db">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
@ -31,6 +31,7 @@ namespace StockInfoCore
|
||||
|
||||
services.AddTransient<frmBackup>();
|
||||
services.AddTransient<frmRegisterStock>();
|
||||
services.AddTransient<frmEditStock>();
|
||||
services.AddTransient<frmMyStocks>();
|
||||
services.AddTransient<frmSelling>();
|
||||
services.AddTransient<frmPerson>();
|
||||
|
||||
Binary file not shown.
381
StockInfoCore/frmEditStock.Designer.cs
generated
Normal file
381
StockInfoCore/frmEditStock.Designer.cs
generated
Normal file
@ -0,0 +1,381 @@
|
||||
|
||||
namespace StockInfoCore
|
||||
{
|
||||
partial class frmEditStock
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.lblStockExtId = new System.Windows.Forms.Label();
|
||||
this.txtStockExtId = new System.Windows.Forms.TextBox();
|
||||
this.txtBuyPrice = new System.Windows.Forms.TextBox();
|
||||
this.lblBuyPrice = new System.Windows.Forms.Label();
|
||||
this.txtBuyDate = new System.Windows.Forms.TextBox();
|
||||
this.lblBuyDate = new System.Windows.Forms.Label();
|
||||
this.txtBoughtAmount = new System.Windows.Forms.TextBox();
|
||||
this.lblBoughtAmount = new System.Windows.Forms.Label();
|
||||
this.txtActValue = new System.Windows.Forms.TextBox();
|
||||
this.lblActValue = new System.Windows.Forms.Label();
|
||||
this.txtActDate = new System.Windows.Forms.TextBox();
|
||||
this.lblActDate = new System.Windows.Forms.Label();
|
||||
this.txtActAmount = new System.Windows.Forms.TextBox();
|
||||
this.lblRemaining = new System.Windows.Forms.Label();
|
||||
this.txtSoldPrice = new System.Windows.Forms.TextBox();
|
||||
this.lblSoldValue = new System.Windows.Forms.Label();
|
||||
this.txtSoldDate = new System.Windows.Forms.TextBox();
|
||||
this.lblSoldDate = new System.Windows.Forms.Label();
|
||||
this.txtComment = new System.Windows.Forms.TextBox();
|
||||
this.lblComment = new System.Windows.Forms.Label();
|
||||
this.btnSaveToDB = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.txtLatestSoldDate = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtLatestSoldPrice = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtStockName = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnClose
|
||||
//
|
||||
this.btnClose.Location = new System.Drawing.Point(437, 414);
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnClose.TabIndex = 1;
|
||||
this.btnClose.Text = "Close";
|
||||
this.btnClose.UseVisualStyleBackColor = true;
|
||||
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||
//
|
||||
// lblStockExtId
|
||||
//
|
||||
this.lblStockExtId.AutoSize = true;
|
||||
this.lblStockExtId.Location = new System.Drawing.Point(38, 44);
|
||||
this.lblStockExtId.Name = "lblStockExtId";
|
||||
this.lblStockExtId.Size = new System.Drawing.Size(62, 15);
|
||||
this.lblStockExtId.TabIndex = 2;
|
||||
this.lblStockExtId.Text = "StockExtId";
|
||||
//
|
||||
// txtStockExtId
|
||||
//
|
||||
this.txtStockExtId.Location = new System.Drawing.Point(153, 41);
|
||||
this.txtStockExtId.Name = "txtStockExtId";
|
||||
this.txtStockExtId.Size = new System.Drawing.Size(269, 23);
|
||||
this.txtStockExtId.TabIndex = 3;
|
||||
//
|
||||
// txtBuyPrice
|
||||
//
|
||||
this.txtBuyPrice.Location = new System.Drawing.Point(153, 104);
|
||||
this.txtBuyPrice.Name = "txtBuyPrice";
|
||||
this.txtBuyPrice.Size = new System.Drawing.Size(111, 23);
|
||||
this.txtBuyPrice.TabIndex = 5;
|
||||
//
|
||||
// lblBuyPrice
|
||||
//
|
||||
this.lblBuyPrice.AutoSize = true;
|
||||
this.lblBuyPrice.Location = new System.Drawing.Point(38, 107);
|
||||
this.lblBuyPrice.Name = "lblBuyPrice";
|
||||
this.lblBuyPrice.Size = new System.Drawing.Size(56, 15);
|
||||
this.lblBuyPrice.TabIndex = 4;
|
||||
this.lblBuyPrice.Text = "Buy price";
|
||||
//
|
||||
// txtBuyDate
|
||||
//
|
||||
this.txtBuyDate.Location = new System.Drawing.Point(153, 133);
|
||||
this.txtBuyDate.Name = "txtBuyDate";
|
||||
this.txtBuyDate.Size = new System.Drawing.Size(142, 23);
|
||||
this.txtBuyDate.TabIndex = 7;
|
||||
//
|
||||
// lblBuyDate
|
||||
//
|
||||
this.lblBuyDate.AutoSize = true;
|
||||
this.lblBuyDate.Location = new System.Drawing.Point(38, 136);
|
||||
this.lblBuyDate.Name = "lblBuyDate";
|
||||
this.lblBuyDate.Size = new System.Drawing.Size(73, 15);
|
||||
this.lblBuyDate.TabIndex = 6;
|
||||
this.lblBuyDate.Text = "Bought Date";
|
||||
//
|
||||
// txtBoughtAmount
|
||||
//
|
||||
this.txtBoughtAmount.Location = new System.Drawing.Point(153, 162);
|
||||
this.txtBoughtAmount.Name = "txtBoughtAmount";
|
||||
this.txtBoughtAmount.Size = new System.Drawing.Size(111, 23);
|
||||
this.txtBoughtAmount.TabIndex = 9;
|
||||
this.txtBoughtAmount.TextChanged += new System.EventHandler(this.txtBoughtAmount_TextChanged);
|
||||
//
|
||||
// lblBoughtAmount
|
||||
//
|
||||
this.lblBoughtAmount.AutoSize = true;
|
||||
this.lblBoughtAmount.Location = new System.Drawing.Point(38, 165);
|
||||
this.lblBoughtAmount.Name = "lblBoughtAmount";
|
||||
this.lblBoughtAmount.Size = new System.Drawing.Size(93, 15);
|
||||
this.lblBoughtAmount.TabIndex = 8;
|
||||
this.lblBoughtAmount.Text = "Bought Number";
|
||||
//
|
||||
// txtActValue
|
||||
//
|
||||
this.txtActValue.Location = new System.Drawing.Point(153, 191);
|
||||
this.txtActValue.Name = "txtActValue";
|
||||
this.txtActValue.Size = new System.Drawing.Size(111, 23);
|
||||
this.txtActValue.TabIndex = 11;
|
||||
//
|
||||
// lblActValue
|
||||
//
|
||||
this.lblActValue.AutoSize = true;
|
||||
this.lblActValue.Location = new System.Drawing.Point(38, 194);
|
||||
this.lblActValue.Name = "lblActValue";
|
||||
this.lblActValue.Size = new System.Drawing.Size(76, 15);
|
||||
this.lblActValue.TabIndex = 10;
|
||||
this.lblActValue.Text = "Current price";
|
||||
//
|
||||
// txtActDate
|
||||
//
|
||||
this.txtActDate.Location = new System.Drawing.Point(153, 220);
|
||||
this.txtActDate.Name = "txtActDate";
|
||||
this.txtActDate.Size = new System.Drawing.Size(142, 23);
|
||||
this.txtActDate.TabIndex = 13;
|
||||
//
|
||||
// lblActDate
|
||||
//
|
||||
this.lblActDate.AutoSize = true;
|
||||
this.lblActDate.Location = new System.Drawing.Point(38, 223);
|
||||
this.lblActDate.Name = "lblActDate";
|
||||
this.lblActDate.Size = new System.Drawing.Size(61, 15);
|
||||
this.lblActDate.TabIndex = 12;
|
||||
this.lblActDate.Text = "Value date";
|
||||
//
|
||||
// txtActAmount
|
||||
//
|
||||
this.txtActAmount.Location = new System.Drawing.Point(153, 249);
|
||||
this.txtActAmount.Name = "txtActAmount";
|
||||
this.txtActAmount.Size = new System.Drawing.Size(111, 23);
|
||||
this.txtActAmount.TabIndex = 15;
|
||||
//
|
||||
// lblRemaining
|
||||
//
|
||||
this.lblRemaining.AutoSize = true;
|
||||
this.lblRemaining.Location = new System.Drawing.Point(38, 252);
|
||||
this.lblRemaining.Name = "lblRemaining";
|
||||
this.lblRemaining.Size = new System.Drawing.Size(109, 15);
|
||||
this.lblRemaining.TabIndex = 14;
|
||||
this.lblRemaining.Text = "Remaining number";
|
||||
//
|
||||
// txtSoldPrice
|
||||
//
|
||||
this.txtSoldPrice.Location = new System.Drawing.Point(153, 278);
|
||||
this.txtSoldPrice.Name = "txtSoldPrice";
|
||||
this.txtSoldPrice.Size = new System.Drawing.Size(111, 23);
|
||||
this.txtSoldPrice.TabIndex = 17;
|
||||
//
|
||||
// lblSoldValue
|
||||
//
|
||||
this.lblSoldValue.AutoSize = true;
|
||||
this.lblSoldValue.Location = new System.Drawing.Point(38, 281);
|
||||
this.lblSoldValue.Name = "lblSoldValue";
|
||||
this.lblSoldValue.Size = new System.Drawing.Size(59, 15);
|
||||
this.lblSoldValue.TabIndex = 16;
|
||||
this.lblSoldValue.Text = "Sold price";
|
||||
//
|
||||
// txtSoldDate
|
||||
//
|
||||
this.txtSoldDate.Location = new System.Drawing.Point(153, 307);
|
||||
this.txtSoldDate.Name = "txtSoldDate";
|
||||
this.txtSoldDate.Size = new System.Drawing.Size(142, 23);
|
||||
this.txtSoldDate.TabIndex = 19;
|
||||
//
|
||||
// lblSoldDate
|
||||
//
|
||||
this.lblSoldDate.AutoSize = true;
|
||||
this.lblSoldDate.Location = new System.Drawing.Point(38, 310);
|
||||
this.lblSoldDate.Name = "lblSoldDate";
|
||||
this.lblSoldDate.Size = new System.Drawing.Size(57, 15);
|
||||
this.lblSoldDate.TabIndex = 18;
|
||||
this.lblSoldDate.Text = "Sold Date";
|
||||
//
|
||||
// txtComment
|
||||
//
|
||||
this.txtComment.Location = new System.Drawing.Point(153, 336);
|
||||
this.txtComment.Multiline = true;
|
||||
this.txtComment.Name = "txtComment";
|
||||
this.txtComment.Size = new System.Drawing.Size(269, 72);
|
||||
this.txtComment.TabIndex = 21;
|
||||
//
|
||||
// lblComment
|
||||
//
|
||||
this.lblComment.AutoSize = true;
|
||||
this.lblComment.Location = new System.Drawing.Point(39, 339);
|
||||
this.lblComment.Name = "lblComment";
|
||||
this.lblComment.Size = new System.Drawing.Size(61, 15);
|
||||
this.lblComment.TabIndex = 20;
|
||||
this.lblComment.Text = "Comment";
|
||||
//
|
||||
// btnSaveToDB
|
||||
//
|
||||
this.btnSaveToDB.Location = new System.Drawing.Point(347, 414);
|
||||
this.btnSaveToDB.Name = "btnSaveToDB";
|
||||
this.btnSaveToDB.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnSaveToDB.TabIndex = 25;
|
||||
this.btnSaveToDB.Text = "Save";
|
||||
this.btnSaveToDB.UseVisualStyleBackColor = true;
|
||||
this.btnSaveToDB.Click += new System.EventHandler(this.btnSaveToDB_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.txtLatestSoldDate);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.txtLatestSoldPrice);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(301, 81);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(255, 83);
|
||||
this.groupBox1.TabIndex = 26;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Latest Sold";
|
||||
//
|
||||
// txtLatestSoldDate
|
||||
//
|
||||
this.txtLatestSoldDate.Location = new System.Drawing.Point(127, 52);
|
||||
this.txtLatestSoldDate.Name = "txtLatestSoldDate";
|
||||
this.txtLatestSoldDate.ReadOnly = true;
|
||||
this.txtLatestSoldDate.Size = new System.Drawing.Size(111, 23);
|
||||
this.txtLatestSoldDate.TabIndex = 9;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 55);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(56, 15);
|
||||
this.label2.TabIndex = 8;
|
||||
this.label2.Text = "Sold date";
|
||||
//
|
||||
// txtLatestSoldPrice
|
||||
//
|
||||
this.txtLatestSoldPrice.Location = new System.Drawing.Point(127, 23);
|
||||
this.txtLatestSoldPrice.Name = "txtLatestSoldPrice";
|
||||
this.txtLatestSoldPrice.ReadOnly = true;
|
||||
this.txtLatestSoldPrice.Size = new System.Drawing.Size(111, 23);
|
||||
this.txtLatestSoldPrice.TabIndex = 7;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 26);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(59, 15);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "Sold price";
|
||||
//
|
||||
// txtStockName
|
||||
//
|
||||
this.txtStockName.Location = new System.Drawing.Point(153, 12);
|
||||
this.txtStockName.Name = "txtStockName";
|
||||
this.txtStockName.Size = new System.Drawing.Size(269, 23);
|
||||
this.txtStockName.TabIndex = 27;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(38, 15);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(46, 15);
|
||||
this.label3.TabIndex = 28;
|
||||
this.label3.Text = "StockId";
|
||||
//
|
||||
// frmEditStock
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(570, 452);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.txtStockName);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.btnSaveToDB);
|
||||
this.Controls.Add(this.txtComment);
|
||||
this.Controls.Add(this.lblComment);
|
||||
this.Controls.Add(this.txtSoldDate);
|
||||
this.Controls.Add(this.lblSoldDate);
|
||||
this.Controls.Add(this.txtSoldPrice);
|
||||
this.Controls.Add(this.lblSoldValue);
|
||||
this.Controls.Add(this.txtActAmount);
|
||||
this.Controls.Add(this.lblRemaining);
|
||||
this.Controls.Add(this.txtActDate);
|
||||
this.Controls.Add(this.lblActDate);
|
||||
this.Controls.Add(this.txtActValue);
|
||||
this.Controls.Add(this.lblActValue);
|
||||
this.Controls.Add(this.txtBoughtAmount);
|
||||
this.Controls.Add(this.lblBoughtAmount);
|
||||
this.Controls.Add(this.txtBuyDate);
|
||||
this.Controls.Add(this.lblBuyDate);
|
||||
this.Controls.Add(this.txtBuyPrice);
|
||||
this.Controls.Add(this.lblBuyPrice);
|
||||
this.Controls.Add(this.txtStockExtId);
|
||||
this.Controls.Add(this.lblStockExtId);
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.Name = "frmEditStock";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "frmRegisterStock";
|
||||
this.Shown += new System.EventHandler(this.frmRegisterStock_Shown);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Button btnClose;
|
||||
private System.Windows.Forms.Label lblStockExtId;
|
||||
private System.Windows.Forms.TextBox txtStockExtId;
|
||||
private System.Windows.Forms.TextBox txtBuyPrice;
|
||||
private System.Windows.Forms.Label lblBuyPrice;
|
||||
private System.Windows.Forms.TextBox txtBuyDate;
|
||||
private System.Windows.Forms.Label lblBuyDate;
|
||||
private System.Windows.Forms.TextBox txtBoughtAmount;
|
||||
private System.Windows.Forms.Label lblBoughtAmount;
|
||||
private System.Windows.Forms.TextBox txtActValue;
|
||||
private System.Windows.Forms.Label lblActValue;
|
||||
private System.Windows.Forms.TextBox txtActDate;
|
||||
private System.Windows.Forms.Label lblActDate;
|
||||
private System.Windows.Forms.TextBox txtActAmount;
|
||||
private System.Windows.Forms.Label lblRemaining;
|
||||
private System.Windows.Forms.TextBox txtSoldPrice;
|
||||
private System.Windows.Forms.Label lblSoldValue;
|
||||
private System.Windows.Forms.TextBox txtSoldDate;
|
||||
private System.Windows.Forms.Label lblSoldDate;
|
||||
private System.Windows.Forms.TextBox txtComment;
|
||||
private System.Windows.Forms.Label lblComment;
|
||||
private System.Windows.Forms.Button btnSaveToDB;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TextBox txtLatestSoldDate;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox txtLatestSoldPrice;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtStockName;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
||||
153
StockInfoCore/frmEditStock.cs
Normal file
153
StockInfoCore/frmEditStock.cs
Normal file
@ -0,0 +1,153 @@
|
||||
using DataDomain;
|
||||
using StockDAL.Interface;
|
||||
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 StockInfoCore
|
||||
{
|
||||
public partial class frmEditStock : Form
|
||||
{
|
||||
Color hdr = Color.Red;
|
||||
private readonly IStockRepository _stockRepository;
|
||||
public int CurrentStockMember { get; set; }
|
||||
|
||||
//public Dictionary<string, DiTraderStockRow> Stocks { get; set; }
|
||||
//public List<StockMember> RegisteredStocks { get; set; } = new List<StockMember>();
|
||||
|
||||
public frmEditStock(IStockRepository stockRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_stockRepository = stockRepository;
|
||||
}
|
||||
|
||||
//private void LoadStockCombo()
|
||||
//{
|
||||
// if (Stocks.Count() > 0)
|
||||
// {
|
||||
// foreach (var key in Stocks.Keys)
|
||||
// {
|
||||
// cmbStockChoser.Items.Add(key);
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void frmRegisterStock_Shown(object sender, EventArgs e)
|
||||
{
|
||||
LoadStockData();
|
||||
|
||||
//LoadStockCombo();
|
||||
}
|
||||
|
||||
private void LoadStockData()
|
||||
{
|
||||
var stockChosen = _stockRepository.GetStockMember(CurrentStockMember);
|
||||
txtStockExtId.Text = stockChosen.StockExtId;
|
||||
txtActValue.Text = stockChosen.ActValue.ToString();
|
||||
//txtActDate.Text = (DateTime.Today + stockChosen.ActDate.Value.TimeOfDay).ToString();
|
||||
var stockSold = _stockRepository.LatestSell(stockChosen.StockId.Trim());
|
||||
if (stockSold != null)
|
||||
{
|
||||
if (stockSold.LatestSoldDate != null)
|
||||
{
|
||||
txtLatestSoldDate.Text = stockSold.LatestSoldDate.Value.ToString();
|
||||
txtLatestSoldPrice.Text = stockSold.SoldStockPrice.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
txtLatestSoldDate.Text = string.Empty;
|
||||
txtLatestSoldPrice.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
txtLatestSoldDate.Text = string.Empty;
|
||||
txtLatestSoldPrice.Text = string.Empty;
|
||||
}
|
||||
|
||||
txtBuyPrice.Text = stockChosen.BuyValue.ToString(); // = decimal.Parse(string.IsNullOrEmpty(txtBuyPrice.Text) ? "0" : txtBuyPrice.Text);
|
||||
txtBoughtAmount.Text = stockChosen.PostAmount.ToString(); // = long.Parse(string.IsNullOrEmpty(txtBoughtAmount.Text) ? "0" : txtBoughtAmount.Text);
|
||||
txtActDate.Text = stockChosen.ActDate.ToString(); // = DateTime.Parse(txtActDate.Text);
|
||||
txtBuyDate.Text = stockChosen.BuyDate.ToString(); // = string.IsNullOrWhiteSpace(txtBuyDate.Text) ? DateTime.Today : DateTime.Parse(txtBuyDate.Text);
|
||||
txtActValue.Text = stockChosen.ActValue.ToString(); // = decimal.Parse(string.IsNullOrEmpty(txtActValue.Text) ? "0" : txtActValue.Text);
|
||||
txtActAmount.Text = stockChosen.ActAmount.ToString(); // = long.Parse(string.IsNullOrEmpty(txtActAmount.Text) ? "0" : txtActAmount.Text);
|
||||
txtSoldDate.Text = stockChosen.SoldDate.ToString(); // = null; //DateTime.MaxValue;
|
||||
txtSoldPrice.Text = stockChosen.SoldValue.ToString(); // = decimal.Parse("0");
|
||||
txtComment.Text = stockChosen.Comment;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void AddValidateData()
|
||||
{
|
||||
var currentStock = new StockMember();
|
||||
currentStock.StockId = txtStockName.Text.Trim();
|
||||
currentStock.StockExtId = txtStockExtId.Text;
|
||||
currentStock.BuyValue = decimal.Parse(string.IsNullOrEmpty(txtBuyPrice.Text) ? "0" : txtBuyPrice.Text);
|
||||
currentStock.PostAmount = long.Parse(string.IsNullOrEmpty(txtBoughtAmount.Text) ? "0" : txtBoughtAmount.Text);
|
||||
currentStock.ActDate = DateTime.Parse(txtActDate.Text);
|
||||
currentStock.BuyDate = string.IsNullOrWhiteSpace(txtBuyDate.Text) ? DateTime.Today : DateTime.Parse(txtBuyDate.Text);
|
||||
currentStock.ActValue = decimal.Parse(string.IsNullOrEmpty(txtActValue.Text) ? "0" : txtActValue.Text);
|
||||
currentStock.ActAmount = long.Parse(string.IsNullOrEmpty(txtActAmount.Text) ? "0" : txtActAmount.Text);
|
||||
currentStock.SoldDate = DateTime.Parse(txtSoldDate.Text);
|
||||
currentStock.SoldValue = decimal.Parse(txtSoldPrice.Text);
|
||||
currentStock.Comment = txtComment.Text;
|
||||
//RegisteredStocks.Add(currentStock);
|
||||
try
|
||||
{
|
||||
_stockRepository.SaveStockMember(currentStock);
|
||||
initiateRegWin();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Problems with update :{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void initiateRegWin()
|
||||
{
|
||||
txtStockExtId.Text = "";
|
||||
txtBuyPrice.Text = "";
|
||||
txtBuyDate.Text = "";
|
||||
txtBoughtAmount.Text = "";
|
||||
txtActValue.Text = "";
|
||||
txtActDate.Text = "";
|
||||
txtActAmount.Text = "";
|
||||
txtSoldPrice.Text = "";
|
||||
txtSoldDate.Text = "";
|
||||
txtComment.Text = "";
|
||||
}
|
||||
|
||||
private void btnSaveToDB_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddValidateData();
|
||||
}
|
||||
|
||||
private void txtBoughtAmount_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
txtActAmount.Text = txtBoughtAmount.Text;
|
||||
}
|
||||
|
||||
private void lwRegBuffer_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
|
||||
{
|
||||
using (Brush hBr = new SolidBrush(hdr))
|
||||
{
|
||||
e.Graphics.FillRectangle(hBr, e.Bounds);
|
||||
e.DrawText();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
StockInfoCore/frmEditStock.resx
Normal file
60
StockInfoCore/frmEditStock.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user