Skip to content

Instantly share code, notes, and snippets.

@bennettblack bennettblack/SalesSubs.cs Secret
Created Jul 1, 2019

Embed
What would you like to do?
Sales Submissions Code
namespace Sales_Submissions
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void submissionBox_TextChanged(object sender, EventArgs e)
{
//scrollbar on text change, not default<-(which can be done in properties sidebar)
submissionBox.ScrollBars = ScrollBars.Vertical;
}
//ADD LINE BUTTON
//-------------------------------------------------------------------------------------------------------------------//
private void button1_Click(object sender, EventArgs e)
{
if (checkBox1.Checked == true)//first line checkbox
{
switch (comboBox1.SelectedItem)
{
case "TEXAS":
this.submissionBox.Text = deaNumberBox.Text + "*" + reportingPeriodBox.Text + frequencyBox.Text + " " + " ";
submissionBox.Text += Environment.NewLine; //adds new line
checkBox1.Checked = false;
break;
default:
this.submissionBox.Text = deaNumberBox.Text + "*" + reportingPeriodBox.Text + frequencyBox.Text + " ";
submissionBox.Text += Environment.NewLine; //adds new line
checkBox1.Checked = false;
break;
}
}
if (checkBox1.Checked != true )
{
switch (comboBox1.SelectedItem)
{
case "OHIO": // GOOD
Ohio();
break;
case "NEW YORK": // GOOD
NewYork();
break;
case "TENNESSEE": // GOOD
Tennessee();
break;
case "FLORIDA": // GOOD
Florida();
break;
case "TEXAS": // GOOD
Texas();
break;
}
}
}
//EXPORT BUTTON
//-------------------------------------------------------------------------------------------------------------------//
private void button2_Click(object sender, EventArgs e)
{
//removes empty line at the end.
string[] str = submissionBox.Text.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
submissionBox.Invalidate();
submissionBox.Lines = str;
submissionBox.Update();
//save file stuff
//-------------------------------------------------------------------------------------------------------------------//
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Text File|*.txt";
//get NYC date format - this gets current date in mmddyyyy format
DateTime d1 = DateTime.Today;
string nySaveTime = d1.ToString("MMddyyyy", System.Globalization.CultureInfo.InvariantCulture);
//get florida date format
char[] shortDate = reportingPeriodBox.Text.ToCharArray(); //put box text into charArray
//save file determinant
switch (comboBox1.SelectedItem)
{
case "OHIO":
sfd.FileName = deaNumberBox.Text + "." + reportingPeriodBox.Text + ".arcos";
break;
case "NEW YORK":
sfd.FileName = deaNumberBox.Text + "." + nySaveTime;
break;
case "TENNESSEE":
sfd.FileName = deaNumberBox.Text + "." + reportingPeriodBox.Text;
break;
case "TEXAS":
sfd.FileName = deaNumberBox.Text + "." + reportingPeriodBox.Text;
break;
case "FLORIDA":
sfd.FileName = "P" + "00526" + shortDate[6] + shortDate[7] + shortDate[0] + shortDate[1] + "001";
break; // ^ T is for test. Use P for production
}
//more save file stuff
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string path = sfd.FileName;
StreamWriter sw = new StreamWriter(File.Create(path));
sw.Write(submissionBox.Text);
sw.Dispose();
}
}
//-------------------------------------------------------------------------------------------------------------------//
private void deaNumberBox_TextChanged(object sender, EventArgs e)
{
}
private void qtyBox_TextChanged(object sender, EventArgs e)
{
}
//state transaction record formats//
//-------------------------------------------------------------------------------------------------------------------//
public void Ohio()
{ //submission line
this.submissionBox.Text += deaNumberBox.Text + transactionCodeBox.Text + " " + ndcBox.Text + qtyBox.Text + " " + assocDeaBox.Text + " " + transDateBox.Text + " " + transIdentifier.Text + " ";
submissionBox.Text += Environment.NewLine; //adds new line
//+= allows for multiple entries
}
public void NewYork()
{ //submission line
this.submissionBox.Text += deaNumberBox.Text + transactionCodeBox.Text + ndcBox.Text + qtyBox.Text + unitBox.Text + assocDeaBox.Text + "000000000" + transDateBox.Text + "00000000"+ strengthBox.Text + transIdentifier.Text + " ";
submissionBox.Text += Environment.NewLine;
}
public void Tennessee()
{ //submission line
this.submissionBox.Text += deaNumberBox.Text + transactionCodeBox.Text + " " + ndcBox.Text + qtyBox.Text + " " + assocDeaBox.Text + " " + transDateBox.Text + " " + transIdentifier.Text + " ";
submissionBox.Text += Environment.NewLine; //adds new line
}
public void Florida()
{ //submission line
this.submissionBox.Text += deaNumberBox.Text + transactionCodeBox.Text + " " + ndcBox.Text + qtyBox.Text + unitBox.Text + assocDeaBox.Text + " " + transDateBox.Text + " " + transIdentifier.Text + " ";
submissionBox.Text += Environment.NewLine;
}
public void Texas()
{ //submission line
this.submissionBox.Text += deaNumberBox.Text + transactionCodeBox.Text + " " + ndcBox.Text + qtyBox.Text + unitBox.Text + assocDeaBox.Text + "000000000" + transDateBox.Text + "00000000" + strengthBox.Text + transIdentifier.Text;
submissionBox.Text += Environment.NewLine;
}
//-------------------------------------------------------------------------------------------------------------------//
//test checkbox
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked == true)
{
reportingPeriodBox.Text = "09171993";
assocDeaBox.Text = "FC2155201";
qtyBox.Text = "00001200";
transDateBox.Text = "06262018";
ndcBox.Text = "00395805543";
transIdentifier.Text = "0007003219";
strengthBox.Text = "1000";
unitBox.Text = "3";
}
else
{
reportingPeriodBox.Text = "";
assocDeaBox.Text = "";
qtyBox.Text = "";
transDateBox.Text = "";
ndcBox.Text = "";
transIdentifier.Text = "";
strengthBox.Text = "";
unitBox.Text = "";
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.