Marked as 'AdvertsingProfitControl v 0.8.5' by its folder name. The 'Add Records' form has been finshed to at least include all the information the Advertising Profit Control sheet had.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
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 AdvertsingProfitControl
|
||||
{
|
||||
public partial class frmAdSpecialRegister : Form
|
||||
{
|
||||
public frmAdSpecialRegister()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
private void frmAdSpecialRegister_Load(object sender, EventArgs e)
|
||||
{
|
||||
var dbReader = new RetrieveFromDatabase();
|
||||
var groupNameCollection = dbReader.ReturnGroupNameList();
|
||||
|
||||
foreach (var groupName in groupNameCollection)
|
||||
{
|
||||
adSpecialKeyWordsListBox.Items.Add(groupName);
|
||||
}
|
||||
}
|
||||
|
||||
private void registerKeyWordButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var dbReader = new RetrieveFromDatabase();
|
||||
var tracker = new DatabaseTracker();
|
||||
var dbWriter = new DatabaseWriter(tracker.DatabaseConnectionString);
|
||||
int rowsEffected = 0;
|
||||
|
||||
if (enterNewKeyWordTextBox.Text == "") return;
|
||||
rowsEffected = dbWriter.RedundantlessInsertIntoGroupCategory(enterNewKeyWordTextBox.Text);
|
||||
|
||||
if (rowsEffected == 1)
|
||||
{
|
||||
var groupNameCollection = dbReader.ReturnGroupNameList();
|
||||
adSpecialKeyWordsListBox.Items.Clear();
|
||||
foreach (var groupName in groupNameCollection)
|
||||
{
|
||||
adSpecialKeyWordsListBox.Items.Add(groupName);
|
||||
}
|
||||
enterNewKeyWordTextBox.Text = "";
|
||||
enterNewKeyWordTextBox.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(
|
||||
"An error has occurred trying to write " + enterNewKeyWordTextBox.Text + " to the database.",
|
||||
"Unknown Write Error");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user