@@ -22,149 +22,41 @@ public CreateCustomer()

}

/*private void cmdCancel_Click(object sender, EventArgs e)
public CustomerClass Customer { get; set; }

private void cmdCancel_Click(object sender, EventArgs e)
{
this.Close();
}

private void cmdAdd_Click(object sender, EventArgs e)
{
NewRepresentative form = new NewRepresentative();
NewRepresentative form = new NewRepresentative
{
Modifing = false,
Customer = Customer,
RepWindow = pnlReps
};
DialogResult result = form.ShowDialog();
if (result.Equals(DialogResult.OK))
{
string[] Entry = new string[] { form.RepName, form.Phone, form.Email };
AddRepresentative(Entry);
}
else
{
if (result.Equals(DialogResult.Retry))
{
string[] Entry = new string[] { form.RepName, form.Phone, form.Email };
AddRepresentative(Entry);
cmdAdd_Click(this, new EventArgs());
}
Customer = form.Customer;
}
}

public List<Representative> Representatives = new List<Representative> { };

private void cmdSave_Click(object sender, EventArgs e)
{
//Verify fields are complete and make sense.
List<string> ErrorItems = new List<string> { };
//Go through all the textboxes serching for an empty box.
// EXCEPTION: Address Line 2 is an optional field.
foreach (Control x in this.Controls)
{
if (x is TextBox)
{
if (x.Text == "")
{
if (x.Tag.ToString() != "Address Line 2")
{
ErrorItems.Add(x.Tag.ToString());
}
}
}
}
if (!rbCompany.Checked && !rbIndividual.Checked)
{
ErrorItems.Add("No category selected.");
}
//If the customer is a company, you need at least 1 point of reference.
if (rbCompany.Checked)
{
if (lbReps.Items.Count == 0)
{
ErrorItems.Add("Company Representatives");
}
}
//If errors were found, tell the user and stop creating a customer.
if (ErrorItems.Count > 0) {
string missingItems = "";
foreach (string Item in ErrorItems)
{
missingItems += Item + "\n\t";
}
MessageBox.Show("ERROR:\nThe following fields are missing values. Please enter the appropriate value.\n\t" + missingItems, "Missing Items");
return;
}
Debug.WriteLine("Fields valid. Moving on.");
//Complete a CustomerClass object for storage.
List<Job> EmptyJob = new List<Job> { };
List<Representative> EmptyList = new List<Representative> { };

CustomerClass Customer = new CustomerClass {
Name = txtName.Text,
Jobs = EmptyJob
};
if (rbCompany.Checked)
{
Customer.Representatives = Representatives;
Customer.Category = "Company";
}
else
{
Customer.Representatives = EmptyList;
Customer.Category = "Individual";
}
Customer.Address.AddressLine1 = txtAddress1.Text;
Customer.Address.AddressLine2 = txtAddress2.Text;
Customer.Address.City = txtCity.Text;
Customer.Address.State = txtState.Text;
Customer.Address.Zip = txtZip.Text;
Customer.Path = Properties.Settings.Default.WorkDir + PublicVariables.Seperator + Customer.Name;
bool Success = Functions.AddCustomer(Customer);
if (Success)
{
Functions.PopulateCustomers();
foreach (Control x in this.Controls)
{
if (x is TextBox)
{
x.Text = "";
}
}
lbReps.Items.Clear();
}
}
public void AddRepresentative(string[] Values)
{
int index = lbReps.Items.Add(Values[0]);
Representative Rep = new Representative
{
Name = Values[0],
Phone = Values[1],
Email = Values[2]
};
Representatives.Add(Rep);
}

private void CreateCustomer_Load(object sender, EventArgs e)
{
if (Properties.Settings.Default.WorkDir == "")
Customer = new CustomerClass
{
DialogResult Result = MessageBox.Show("You have not set the work directory yet. Would you like to set the directory now?", "WORK DIRECTORY NOT SET", MessageBoxButtons.YesNo);
if (Result.Equals(DialogResult.Yes))
{
Properties.Settings.Default.WorkDir = Microsoft.VisualBasic.Interaction.InputBox("Please enter the directory you want.", "Work Directroy", "");
Properties.Settings.Default.Save();
}
else
{
MessageBox.Show("ERROR:\nNo work directory was found. Exiting.");
this.Close();
return;
}
}
}*/
Representatives = new List<Representative> { }
};
}
}
}
@@ -0,0 +1,25 @@

// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.UserControls.MainMenu.RepresentativeForm.cmdModify_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.New.CreateCustomer.cmdSave_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.New.CreateCustomer.cmdAdd_Click(System.Object,System.EventArgs)")]

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.Common.NewRepresentative.cmdSaveClear_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.Common.NewRepresentative.cmdSaveExit_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.Legal.CreateEntry.cmdCancel_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.Legal.CreateEntry.cmdSave_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.MainWindow.customerToolStripMenuItem_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.MainWindow.exitToolStripMenuItem_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.MainWindow.newContractAgreementToolStripMenuItem_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.New.CreateCustomer.cmdCancel_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.New.CreateJob.cmdCancel_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.UserControls.MainMenu.JobForm.cmdModify_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.UserControls.MainMenu.JobForm.cmdNew_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.UserControls.MainMenu.JobForm.cmdNewContract_Click(System.Object,System.EventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:MDG.UserControls.Legal.FieldEntry.masterForm")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~M:MDG.Forms.Common.NewRepresentative.cmdCancel_Click(System.Object,System.EventArgs)")]

@@ -84,6 +84,7 @@
<Compile Include="Forms\New\CreateJob.Designer.cs">
<DependentUpon>CreateJob.cs</DependentUpon>
</Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Objects\Classes.cs" />
<Compile Include="Objects\Functions.cs" />
<Compile Include="Objects\PublicVariables.cs" />
@@ -20,6 +20,7 @@ public class Representative
public string Name { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
public string Title { get; set; }
}

public class BillableItem

Large diffs are not rendered by default.

@@ -9,14 +9,32 @@
using System.Windows.Forms;
using MDG.Objects;
using System.Threading;
using MDG.Forms.Common;

namespace MDG.UserControls.MainMenu
{
public partial class RepresentativeForm : UserControl
{
public CustomerClass Customer { get; set; }
public Representative Representative { get; set; }

public RepresentativeForm()
{
InitializeComponent();
}

private void cmdModify_Click(object sender, EventArgs e)
{
NewRepresentative representative = new NewRepresentative
{
Modifing = true,
Customer = Customer
};
representative.txtName.Text = Representative.Name;
representative.txtTitle.Text = Representative.Title;
representative.txtPhone.Text = Representative.Phone;
representative.TxtEmail.Text = Representative.Email;
representative.Show();
}
}
}