Winforms MVP Passive ViewPopulating a Data Grid View in MVPConverting from binary to unarySupporting all...
How much character growth crosses the line into breaking the character
What is Cash Advance APR?
Python scanner for the first free port in a range
What does "Scientists rise up against statistical significance" mean? (Comment in Nature)
The probability of Bus A arriving before Bus B
How can "mimic phobia" be cured or prevented?
Rising and falling intonation
Explaining alternative travel routes when going to the USA
Does Doodling or Improvising on the Piano Have Any Benefits?
How to create ADT in Haskell?
Why is it that I can sometimes guess the next note?
Is there a RAID 0 Equivalent for RAM?
Why does the Sun have different day lengths, but not the gas giants?
On a tidally locked planet, would time be quantized?
Biological Blimps: Propulsion
Why a symmetric relation is defined: ∀x∀y( xRy⟹yRx) and not ∀x∀y (xRy⟺yRx)?
How could a planet have erratic days?
How do you make your own symbol when Detexify fails?
Is (0,1] a closed or open set?
Not using 's' for he/she/it
Why electric field inside a cavity of a non conducting not zero
If infinitesimal transformations commute why dont the generators of the Lorentz group commute?
A social experiment. What is the worst that can happen?
Temporarily disable WLAN internet access for children, but allow it for adults
Winforms MVP Passive View
Populating a Data Grid View in MVPConverting from binary to unarySupporting all closure options in WinForms MVC applicationModel-View-Presenter Winforms appC# Winforms MVP (avoiding circular dependencies)Handling an openFileDialog in the View of my MVP WinForms projectHandling a user control that needs to be put on my form in WinForms project using MVP patternPassive View implementation in c# MVPTicTacToe in MVP WinformsMVP Passive-View
$begingroup$
I am currently in the process of refactoring a monolithic Winforms MVP application to make it testable. I have decided to utilise the Winforms MVP Passive View pattern. After reading many blog posts including Mark Heath I wanted to ensure that my understanding is correct.
Any tips or guidance is greatly appreciated.
IView.cs
public interface IView
{
event EventHandler Load;
event EventHandler CloseClicked;
void CloseView();
}
IClientAView.cs
public interface IClientAImportView : IImportView, IView
{
int BatchRef { get;set; }
void SetGasTotal(int total);
void SetElectricTotal(int total);
void SetDualFuelTotal(int total);
}
IImportView.cs
public interface IImportView
{
string FilePath { get; set; }
event EventHandler BrowseClicked;
event EventHandler ReportsClicked;
event EventHandler ImportClicked;
event EventHandler TransferClicked;
void ShowFileDialog();
}
frmClientAImport.cs
public partial class frmClientAImport : frmTemplate, IClientAImportView
{
public frmClientAImport()
{
InitializeComponent();
}
public void ShowFileDialog()
{
ofdFile.ShowDialog();
FilePath = ofdFile.FileName;
}
public void CloseView()
{
Close();
}
public void SetGasTotal(int total)
{
lblGD.Text = total.ToString();
}
public void SetElectricTotal(int total)
{
lblED.Text = total.ToString();
}
public void SetDualFuelTotal(int total)
{
lblDFD.Text = total.ToString();
}
public int BatchRef
{
get { return int.Parse(txtBatchRef.Text); }
set { txtBatchRef.Text = value.ToString(); }
}
public string FilePath
{
get { return txtFilePath.Text; }
set { txtFilePath.Text = value; }
}
public event EventHandler BrowseClicked
{
add { btnBrowse.Click += value; }
remove { btnBrowse.Click -= value; }
}
public event EventHandler ImportClicked
{
add { btnImport.Click += value; }
remove { btnImport.Click -= value; }
}
public event EventHandler ReportsClicked
{
add { btnReports.Click += value; }
remove { btnReports.Click -= value; }
}
public event EventHandler TransferClicked
{
add { btnTransfer.Click += value; }
remove { btnTransfer.Click -= value; }
}
public event EventHandler CloseClicked
{
add { btnClose.Click += value; }
remove { btnClose.Click -= value; }
}
}
ClientARepository
public class ClientARepository : IClientARepository
{
private DataTable _excelImportTable;
public int GetBatchRef()
{
return SQLHelper.ExecuteScalarDapper<int>("SELECT MAX(BatchRef) + 1 FROM tblCase C WHERE ClientID IN (1234, 5678));
}
public void GetExcelContents(string filePath)
{
_excelImportTable = new DataTable().FromExcel(filePath, true);
}
public void TruncateImportTable()
{
SQLHelper.ExecuteNonQueryDapper("TRUNCATE TABLE tblUMImportClientA");
}
public void TransferFileToDatabase(int batchRef)
{
using (var cn = new SqlConnection(Settings.DBConnectionString))
{
cn.Open();
var dtBCP = new DataTable();
var sqlImportTable = new DataTable();
var adapter = new SqlDataAdapter("SELECT * FROM tblUMImportClientA", cn);
adapter.FillSchema(dtBCP, SchemaType.Source);
SetupImportTable(dtBCP);
using (var bc = new SqlBulkCopy(cn))
{
bc.DestinationTableName = "tblUMImportClientA";
bc.BatchSize = 500;
bc.WriteToServer(dtBCP);
}
SQLHelper.ExecuteNonQueryDapper("prcUMClientAImportProcess", new { BatchRef = batchRef }, CommandType.StoredProcedure );
adapter.Fill(sqlImportTable);
}
}
private void SetupImportTable(DataTable bcpTable)
{
foreach (DataColumn col in _excelImportTable.Columns)
col.ColumnName = bcpTable.Columns[col.Ordinal].ColumnName;
foreach (DataRow rawRow in _excelImportTable.Rows)
{
foreach (DataColumn rawCol in _excelImportTable.Columns)
{
if (rawRow[rawCol].ToString().Trim().Length == 0)
rawRow[rawCol] = DBNull.Value;
DateTime date;
if (rawRow[rawCol].ToString().Trim().Length > 4 && !rawRow[rawCol].ToString().Contains(".") && DateTime.TryParse(rawRow[rawCol].ToString().Trim(), out date))
rawRow[rawCol] = date;
if (bcpTable.Columns[rawCol.Ordinal].DataType == typeof(string) && !string.IsNullOrEmpty(rawRow[rawCol].ToString()) &&
rawRow[rawCol].ToString().Length > bcpTable.Columns[rawCol.Ordinal].MaxLength)
rawRow[rawCol] = rawRow[rawCol].ToString().Substring(0, bcpTable.Columns[rawCol.Ordinal].MaxLength);
}
_excelImportTable.AcceptChanges();
bcpTable.ImportRow(rawRow);
}
}
}
ClientAImportPresenter.cs
public class ClientAImportPresenter
{
private IClientAImportView _view;
private IClientARepository _repository;
private DataTable _importFile;
public ClientAImportPresenter(IClientAImportView view, IClientARepository repository)
{
_view = view;
_repository = repository;
AssignEventHandlers();
}
private void AssignEventHandlers()
{
_view.Load += OnLoad;
_view.CloseClicked += OnClose;
_view.BrowseClicked += OnBrowseClicked;
_view.ImportClicked += OnImportClicked;
}
private void OnLoad(object sender, EventArgs e)
{
_view.BatchRef = _repository.GetBatchRef();
}
private void OnBrowseClicked(object sender, EventArgs e)
{
_view.ShowFileDialog();
}
private void OnImportClicked(object sender, EventArgs e)
{
_repository.GetExcelContents(_view.FilePath);
_repository.TruncateImportTable();
_repository.TransferFileToDatabase(_view.BatchRef);
}
private void OnClose(object sender, EventArgs e)
{
_view.CloseView();
}
c# winforms mvp
$endgroup$
add a comment |
$begingroup$
I am currently in the process of refactoring a monolithic Winforms MVP application to make it testable. I have decided to utilise the Winforms MVP Passive View pattern. After reading many blog posts including Mark Heath I wanted to ensure that my understanding is correct.
Any tips or guidance is greatly appreciated.
IView.cs
public interface IView
{
event EventHandler Load;
event EventHandler CloseClicked;
void CloseView();
}
IClientAView.cs
public interface IClientAImportView : IImportView, IView
{
int BatchRef { get;set; }
void SetGasTotal(int total);
void SetElectricTotal(int total);
void SetDualFuelTotal(int total);
}
IImportView.cs
public interface IImportView
{
string FilePath { get; set; }
event EventHandler BrowseClicked;
event EventHandler ReportsClicked;
event EventHandler ImportClicked;
event EventHandler TransferClicked;
void ShowFileDialog();
}
frmClientAImport.cs
public partial class frmClientAImport : frmTemplate, IClientAImportView
{
public frmClientAImport()
{
InitializeComponent();
}
public void ShowFileDialog()
{
ofdFile.ShowDialog();
FilePath = ofdFile.FileName;
}
public void CloseView()
{
Close();
}
public void SetGasTotal(int total)
{
lblGD.Text = total.ToString();
}
public void SetElectricTotal(int total)
{
lblED.Text = total.ToString();
}
public void SetDualFuelTotal(int total)
{
lblDFD.Text = total.ToString();
}
public int BatchRef
{
get { return int.Parse(txtBatchRef.Text); }
set { txtBatchRef.Text = value.ToString(); }
}
public string FilePath
{
get { return txtFilePath.Text; }
set { txtFilePath.Text = value; }
}
public event EventHandler BrowseClicked
{
add { btnBrowse.Click += value; }
remove { btnBrowse.Click -= value; }
}
public event EventHandler ImportClicked
{
add { btnImport.Click += value; }
remove { btnImport.Click -= value; }
}
public event EventHandler ReportsClicked
{
add { btnReports.Click += value; }
remove { btnReports.Click -= value; }
}
public event EventHandler TransferClicked
{
add { btnTransfer.Click += value; }
remove { btnTransfer.Click -= value; }
}
public event EventHandler CloseClicked
{
add { btnClose.Click += value; }
remove { btnClose.Click -= value; }
}
}
ClientARepository
public class ClientARepository : IClientARepository
{
private DataTable _excelImportTable;
public int GetBatchRef()
{
return SQLHelper.ExecuteScalarDapper<int>("SELECT MAX(BatchRef) + 1 FROM tblCase C WHERE ClientID IN (1234, 5678));
}
public void GetExcelContents(string filePath)
{
_excelImportTable = new DataTable().FromExcel(filePath, true);
}
public void TruncateImportTable()
{
SQLHelper.ExecuteNonQueryDapper("TRUNCATE TABLE tblUMImportClientA");
}
public void TransferFileToDatabase(int batchRef)
{
using (var cn = new SqlConnection(Settings.DBConnectionString))
{
cn.Open();
var dtBCP = new DataTable();
var sqlImportTable = new DataTable();
var adapter = new SqlDataAdapter("SELECT * FROM tblUMImportClientA", cn);
adapter.FillSchema(dtBCP, SchemaType.Source);
SetupImportTable(dtBCP);
using (var bc = new SqlBulkCopy(cn))
{
bc.DestinationTableName = "tblUMImportClientA";
bc.BatchSize = 500;
bc.WriteToServer(dtBCP);
}
SQLHelper.ExecuteNonQueryDapper("prcUMClientAImportProcess", new { BatchRef = batchRef }, CommandType.StoredProcedure );
adapter.Fill(sqlImportTable);
}
}
private void SetupImportTable(DataTable bcpTable)
{
foreach (DataColumn col in _excelImportTable.Columns)
col.ColumnName = bcpTable.Columns[col.Ordinal].ColumnName;
foreach (DataRow rawRow in _excelImportTable.Rows)
{
foreach (DataColumn rawCol in _excelImportTable.Columns)
{
if (rawRow[rawCol].ToString().Trim().Length == 0)
rawRow[rawCol] = DBNull.Value;
DateTime date;
if (rawRow[rawCol].ToString().Trim().Length > 4 && !rawRow[rawCol].ToString().Contains(".") && DateTime.TryParse(rawRow[rawCol].ToString().Trim(), out date))
rawRow[rawCol] = date;
if (bcpTable.Columns[rawCol.Ordinal].DataType == typeof(string) && !string.IsNullOrEmpty(rawRow[rawCol].ToString()) &&
rawRow[rawCol].ToString().Length > bcpTable.Columns[rawCol.Ordinal].MaxLength)
rawRow[rawCol] = rawRow[rawCol].ToString().Substring(0, bcpTable.Columns[rawCol.Ordinal].MaxLength);
}
_excelImportTable.AcceptChanges();
bcpTable.ImportRow(rawRow);
}
}
}
ClientAImportPresenter.cs
public class ClientAImportPresenter
{
private IClientAImportView _view;
private IClientARepository _repository;
private DataTable _importFile;
public ClientAImportPresenter(IClientAImportView view, IClientARepository repository)
{
_view = view;
_repository = repository;
AssignEventHandlers();
}
private void AssignEventHandlers()
{
_view.Load += OnLoad;
_view.CloseClicked += OnClose;
_view.BrowseClicked += OnBrowseClicked;
_view.ImportClicked += OnImportClicked;
}
private void OnLoad(object sender, EventArgs e)
{
_view.BatchRef = _repository.GetBatchRef();
}
private void OnBrowseClicked(object sender, EventArgs e)
{
_view.ShowFileDialog();
}
private void OnImportClicked(object sender, EventArgs e)
{
_repository.GetExcelContents(_view.FilePath);
_repository.TruncateImportTable();
_repository.TransferFileToDatabase(_view.BatchRef);
}
private void OnClose(object sender, EventArgs e)
{
_view.CloseView();
}
c# winforms mvp
$endgroup$
$begingroup$
What’s the reasoning for the downvote? If people downvote without a comment how can we learn to ask better questions?
$endgroup$
– JammoD
Mar 16 at 16:35
add a comment |
$begingroup$
I am currently in the process of refactoring a monolithic Winforms MVP application to make it testable. I have decided to utilise the Winforms MVP Passive View pattern. After reading many blog posts including Mark Heath I wanted to ensure that my understanding is correct.
Any tips or guidance is greatly appreciated.
IView.cs
public interface IView
{
event EventHandler Load;
event EventHandler CloseClicked;
void CloseView();
}
IClientAView.cs
public interface IClientAImportView : IImportView, IView
{
int BatchRef { get;set; }
void SetGasTotal(int total);
void SetElectricTotal(int total);
void SetDualFuelTotal(int total);
}
IImportView.cs
public interface IImportView
{
string FilePath { get; set; }
event EventHandler BrowseClicked;
event EventHandler ReportsClicked;
event EventHandler ImportClicked;
event EventHandler TransferClicked;
void ShowFileDialog();
}
frmClientAImport.cs
public partial class frmClientAImport : frmTemplate, IClientAImportView
{
public frmClientAImport()
{
InitializeComponent();
}
public void ShowFileDialog()
{
ofdFile.ShowDialog();
FilePath = ofdFile.FileName;
}
public void CloseView()
{
Close();
}
public void SetGasTotal(int total)
{
lblGD.Text = total.ToString();
}
public void SetElectricTotal(int total)
{
lblED.Text = total.ToString();
}
public void SetDualFuelTotal(int total)
{
lblDFD.Text = total.ToString();
}
public int BatchRef
{
get { return int.Parse(txtBatchRef.Text); }
set { txtBatchRef.Text = value.ToString(); }
}
public string FilePath
{
get { return txtFilePath.Text; }
set { txtFilePath.Text = value; }
}
public event EventHandler BrowseClicked
{
add { btnBrowse.Click += value; }
remove { btnBrowse.Click -= value; }
}
public event EventHandler ImportClicked
{
add { btnImport.Click += value; }
remove { btnImport.Click -= value; }
}
public event EventHandler ReportsClicked
{
add { btnReports.Click += value; }
remove { btnReports.Click -= value; }
}
public event EventHandler TransferClicked
{
add { btnTransfer.Click += value; }
remove { btnTransfer.Click -= value; }
}
public event EventHandler CloseClicked
{
add { btnClose.Click += value; }
remove { btnClose.Click -= value; }
}
}
ClientARepository
public class ClientARepository : IClientARepository
{
private DataTable _excelImportTable;
public int GetBatchRef()
{
return SQLHelper.ExecuteScalarDapper<int>("SELECT MAX(BatchRef) + 1 FROM tblCase C WHERE ClientID IN (1234, 5678));
}
public void GetExcelContents(string filePath)
{
_excelImportTable = new DataTable().FromExcel(filePath, true);
}
public void TruncateImportTable()
{
SQLHelper.ExecuteNonQueryDapper("TRUNCATE TABLE tblUMImportClientA");
}
public void TransferFileToDatabase(int batchRef)
{
using (var cn = new SqlConnection(Settings.DBConnectionString))
{
cn.Open();
var dtBCP = new DataTable();
var sqlImportTable = new DataTable();
var adapter = new SqlDataAdapter("SELECT * FROM tblUMImportClientA", cn);
adapter.FillSchema(dtBCP, SchemaType.Source);
SetupImportTable(dtBCP);
using (var bc = new SqlBulkCopy(cn))
{
bc.DestinationTableName = "tblUMImportClientA";
bc.BatchSize = 500;
bc.WriteToServer(dtBCP);
}
SQLHelper.ExecuteNonQueryDapper("prcUMClientAImportProcess", new { BatchRef = batchRef }, CommandType.StoredProcedure );
adapter.Fill(sqlImportTable);
}
}
private void SetupImportTable(DataTable bcpTable)
{
foreach (DataColumn col in _excelImportTable.Columns)
col.ColumnName = bcpTable.Columns[col.Ordinal].ColumnName;
foreach (DataRow rawRow in _excelImportTable.Rows)
{
foreach (DataColumn rawCol in _excelImportTable.Columns)
{
if (rawRow[rawCol].ToString().Trim().Length == 0)
rawRow[rawCol] = DBNull.Value;
DateTime date;
if (rawRow[rawCol].ToString().Trim().Length > 4 && !rawRow[rawCol].ToString().Contains(".") && DateTime.TryParse(rawRow[rawCol].ToString().Trim(), out date))
rawRow[rawCol] = date;
if (bcpTable.Columns[rawCol.Ordinal].DataType == typeof(string) && !string.IsNullOrEmpty(rawRow[rawCol].ToString()) &&
rawRow[rawCol].ToString().Length > bcpTable.Columns[rawCol.Ordinal].MaxLength)
rawRow[rawCol] = rawRow[rawCol].ToString().Substring(0, bcpTable.Columns[rawCol.Ordinal].MaxLength);
}
_excelImportTable.AcceptChanges();
bcpTable.ImportRow(rawRow);
}
}
}
ClientAImportPresenter.cs
public class ClientAImportPresenter
{
private IClientAImportView _view;
private IClientARepository _repository;
private DataTable _importFile;
public ClientAImportPresenter(IClientAImportView view, IClientARepository repository)
{
_view = view;
_repository = repository;
AssignEventHandlers();
}
private void AssignEventHandlers()
{
_view.Load += OnLoad;
_view.CloseClicked += OnClose;
_view.BrowseClicked += OnBrowseClicked;
_view.ImportClicked += OnImportClicked;
}
private void OnLoad(object sender, EventArgs e)
{
_view.BatchRef = _repository.GetBatchRef();
}
private void OnBrowseClicked(object sender, EventArgs e)
{
_view.ShowFileDialog();
}
private void OnImportClicked(object sender, EventArgs e)
{
_repository.GetExcelContents(_view.FilePath);
_repository.TruncateImportTable();
_repository.TransferFileToDatabase(_view.BatchRef);
}
private void OnClose(object sender, EventArgs e)
{
_view.CloseView();
}
c# winforms mvp
$endgroup$
I am currently in the process of refactoring a monolithic Winforms MVP application to make it testable. I have decided to utilise the Winforms MVP Passive View pattern. After reading many blog posts including Mark Heath I wanted to ensure that my understanding is correct.
Any tips or guidance is greatly appreciated.
IView.cs
public interface IView
{
event EventHandler Load;
event EventHandler CloseClicked;
void CloseView();
}
IClientAView.cs
public interface IClientAImportView : IImportView, IView
{
int BatchRef { get;set; }
void SetGasTotal(int total);
void SetElectricTotal(int total);
void SetDualFuelTotal(int total);
}
IImportView.cs
public interface IImportView
{
string FilePath { get; set; }
event EventHandler BrowseClicked;
event EventHandler ReportsClicked;
event EventHandler ImportClicked;
event EventHandler TransferClicked;
void ShowFileDialog();
}
frmClientAImport.cs
public partial class frmClientAImport : frmTemplate, IClientAImportView
{
public frmClientAImport()
{
InitializeComponent();
}
public void ShowFileDialog()
{
ofdFile.ShowDialog();
FilePath = ofdFile.FileName;
}
public void CloseView()
{
Close();
}
public void SetGasTotal(int total)
{
lblGD.Text = total.ToString();
}
public void SetElectricTotal(int total)
{
lblED.Text = total.ToString();
}
public void SetDualFuelTotal(int total)
{
lblDFD.Text = total.ToString();
}
public int BatchRef
{
get { return int.Parse(txtBatchRef.Text); }
set { txtBatchRef.Text = value.ToString(); }
}
public string FilePath
{
get { return txtFilePath.Text; }
set { txtFilePath.Text = value; }
}
public event EventHandler BrowseClicked
{
add { btnBrowse.Click += value; }
remove { btnBrowse.Click -= value; }
}
public event EventHandler ImportClicked
{
add { btnImport.Click += value; }
remove { btnImport.Click -= value; }
}
public event EventHandler ReportsClicked
{
add { btnReports.Click += value; }
remove { btnReports.Click -= value; }
}
public event EventHandler TransferClicked
{
add { btnTransfer.Click += value; }
remove { btnTransfer.Click -= value; }
}
public event EventHandler CloseClicked
{
add { btnClose.Click += value; }
remove { btnClose.Click -= value; }
}
}
ClientARepository
public class ClientARepository : IClientARepository
{
private DataTable _excelImportTable;
public int GetBatchRef()
{
return SQLHelper.ExecuteScalarDapper<int>("SELECT MAX(BatchRef) + 1 FROM tblCase C WHERE ClientID IN (1234, 5678));
}
public void GetExcelContents(string filePath)
{
_excelImportTable = new DataTable().FromExcel(filePath, true);
}
public void TruncateImportTable()
{
SQLHelper.ExecuteNonQueryDapper("TRUNCATE TABLE tblUMImportClientA");
}
public void TransferFileToDatabase(int batchRef)
{
using (var cn = new SqlConnection(Settings.DBConnectionString))
{
cn.Open();
var dtBCP = new DataTable();
var sqlImportTable = new DataTable();
var adapter = new SqlDataAdapter("SELECT * FROM tblUMImportClientA", cn);
adapter.FillSchema(dtBCP, SchemaType.Source);
SetupImportTable(dtBCP);
using (var bc = new SqlBulkCopy(cn))
{
bc.DestinationTableName = "tblUMImportClientA";
bc.BatchSize = 500;
bc.WriteToServer(dtBCP);
}
SQLHelper.ExecuteNonQueryDapper("prcUMClientAImportProcess", new { BatchRef = batchRef }, CommandType.StoredProcedure );
adapter.Fill(sqlImportTable);
}
}
private void SetupImportTable(DataTable bcpTable)
{
foreach (DataColumn col in _excelImportTable.Columns)
col.ColumnName = bcpTable.Columns[col.Ordinal].ColumnName;
foreach (DataRow rawRow in _excelImportTable.Rows)
{
foreach (DataColumn rawCol in _excelImportTable.Columns)
{
if (rawRow[rawCol].ToString().Trim().Length == 0)
rawRow[rawCol] = DBNull.Value;
DateTime date;
if (rawRow[rawCol].ToString().Trim().Length > 4 && !rawRow[rawCol].ToString().Contains(".") && DateTime.TryParse(rawRow[rawCol].ToString().Trim(), out date))
rawRow[rawCol] = date;
if (bcpTable.Columns[rawCol.Ordinal].DataType == typeof(string) && !string.IsNullOrEmpty(rawRow[rawCol].ToString()) &&
rawRow[rawCol].ToString().Length > bcpTable.Columns[rawCol.Ordinal].MaxLength)
rawRow[rawCol] = rawRow[rawCol].ToString().Substring(0, bcpTable.Columns[rawCol.Ordinal].MaxLength);
}
_excelImportTable.AcceptChanges();
bcpTable.ImportRow(rawRow);
}
}
}
ClientAImportPresenter.cs
public class ClientAImportPresenter
{
private IClientAImportView _view;
private IClientARepository _repository;
private DataTable _importFile;
public ClientAImportPresenter(IClientAImportView view, IClientARepository repository)
{
_view = view;
_repository = repository;
AssignEventHandlers();
}
private void AssignEventHandlers()
{
_view.Load += OnLoad;
_view.CloseClicked += OnClose;
_view.BrowseClicked += OnBrowseClicked;
_view.ImportClicked += OnImportClicked;
}
private void OnLoad(object sender, EventArgs e)
{
_view.BatchRef = _repository.GetBatchRef();
}
private void OnBrowseClicked(object sender, EventArgs e)
{
_view.ShowFileDialog();
}
private void OnImportClicked(object sender, EventArgs e)
{
_repository.GetExcelContents(_view.FilePath);
_repository.TruncateImportTable();
_repository.TransferFileToDatabase(_view.BatchRef);
}
private void OnClose(object sender, EventArgs e)
{
_view.CloseView();
}
c# winforms mvp
c# winforms mvp
edited Mar 15 at 22:04
JammoD
asked Mar 15 at 20:56
JammoDJammoD
17318
17318
$begingroup$
What’s the reasoning for the downvote? If people downvote without a comment how can we learn to ask better questions?
$endgroup$
– JammoD
Mar 16 at 16:35
add a comment |
$begingroup$
What’s the reasoning for the downvote? If people downvote without a comment how can we learn to ask better questions?
$endgroup$
– JammoD
Mar 16 at 16:35
$begingroup$
What’s the reasoning for the downvote? If people downvote without a comment how can we learn to ask better questions?
$endgroup$
– JammoD
Mar 16 at 16:35
$begingroup$
What’s the reasoning for the downvote? If people downvote without a comment how can we learn to ask better questions?
$endgroup$
– JammoD
Mar 16 at 16:35
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f215532%2fwinforms-mvp-passive-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f215532%2fwinforms-mvp-passive-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
What’s the reasoning for the downvote? If people downvote without a comment how can we learn to ask better questions?
$endgroup$
– JammoD
Mar 16 at 16:35