Skip to content

Commit

Permalink
Fixed Rob's input data.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregf21 committed Mar 25, 2019
1 parent f22449f commit 08f9c92
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ProductionServicesAnalyticsProgram/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 43 additions & 7 deletions ProductionServicesAnalyticsProgram/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ public Form1()


}

private void shortenArray(ref string[] dataArray)
{
dataArray[2] = dataArray[2] + " " + dataArray[3];
dataArray[3] = dataArray[4];
dataArray[4] = dataArray[5];
dataArray[5] = dataArray[6];
dataArray[6] = dataArray[7];
dataArray[7] = "";
}
private void submitButton_Click(object sender, EventArgs e)
{

Expand Down Expand Up @@ -113,7 +121,7 @@ private void submitButton_Click(object sender, EventArgs e)


int cMonth = startDate.Value.Month, cDay = startDate.Value.Day, cYear = startDate.Value.Year;
for (int dateCounter = (endDate.Value.Date - startDate.Value.Date).Days + 1; dateCounter > 0; dateCounter--)
for (int dateCounter = (endDate.Value.Date - startDate.Value.Date).Days+1; dateCounter > 0; dateCounter--)
{
driver.Url = "http://172.21.20.41/cepdotnet/CEPHome.aspx?day=" + cDay + "&month=" + cMonth + "&year=" + cYear;

Expand All @@ -132,7 +140,19 @@ private void submitButton_Click(object sender, EventArgs e)
//4: end time
//5: end time AM/PM
tempWorkerDataArray = tempElementArray[i].Split(' ');
if(tempWorkerDataArray.Length > 7)
{
shortenArray(ref tempWorkerDataArray);
}
tempStartTime = tempWorkerDataArray[3];
/* while (isDigit == false && tempStartTime != "MIDNIGHT" && tempStartTime != "NOON")
{
char time = tempStartTime[1];
StringBuilder sb = new StringBuilder(tempStartTime);
sb.Remove(0, 1);
tempStartTime = sb.ToString();
isDigit = char.IsDigit(tempStartTime[0]);
}*/
if (tempStartTime.Contains("MIDNIGHT") || tempStartTime.Contains("NOON"))
{
tempEndTime = tempWorkerDataArray[4];
Expand All @@ -150,6 +170,15 @@ private void submitButton_Click(object sender, EventArgs e)
tempEndTime += " " + tempWorkerDataArray[6];
}
}
/* else
{
tempStartTime += " " + tempWorkerDataArray[5];
tempEndTime = tempWorkerDataArray[6];
if (!(tempEndTime.Contains("MIDNIGHT") || tempEndTime.Contains("NOON")))
{
tempEndTime += " " + tempWorkerDataArray[7];
}
}*/
tempTime = findMinutes(tempStartTime, tempEndTime);

if (analysisTypeCheckBoxList.GetItemChecked(0))
Expand Down Expand Up @@ -206,7 +235,6 @@ private void submitButton_Click(object sender, EventArgs e)
private void updateButton_Click(object sender, EventArgs e)
{
chart1.Series[0].Points.Clear();
chart1.ChartAreas[0].AxisX.Minimum = startDate.Value.Day;
double[] dataArrayForSelectedWorker = null;
double total = 0;
grabDataFor(nameListBox.SelectedValue.ToString(), ref dataArrayForSelectedWorker);
Expand All @@ -215,7 +243,7 @@ private void updateButton_Click(object sender, EventArgs e)

/* (analysisTypeCheckBoxList.SelectedIndex == 0)
{*/
int counter = 0;
/*int counter = 0;
int i = startDate.Value.Day;
do
{
Expand All @@ -226,7 +254,16 @@ private void updateButton_Click(object sender, EventArgs e)
total += dataArrayForSelectedWorker[counter];
i++;
counter++;
} while (counter < dataArrayForSelectedWorker.Length);
} while (counter < dataArrayForSelectedWorker.Length);*/
for (int i = 0; i < dataArrayForSelectedWorker.Length; i++)
{
chart1.Series[0].Points.AddXY(i + 1, dataArrayForSelectedWorker[i]);
chart1.Series[0].Points[i].MarkerStyle = MarkerStyle.Circle;
chart1.Series[0].Points[i].MarkerSize = 10;
chart1.Series[0].Points[i].MarkerColor = Color.Blue;

total += dataArrayForSelectedWorker[i];
}
/*}
else if (analysisTypeCheckBoxList.SelectedIndex == 1)
{
Expand Down Expand Up @@ -258,7 +295,7 @@ private void updateButton_Click(object sender, EventArgs e)
private void Form1_Load(object sender, EventArgs e)
{
chart1.Series[0].ChartType = SeriesChartType.Line;
chart1.ChartAreas[0].AxisX.IsStartedFromZero = false;
chart1.ChartAreas[0].AxisX.IsStartedFromZero = true;
chart1.ChartAreas[0].AxisY.Title = "Hours";
chart1.Series[0].LegendText = "Hours Worked";
String[] lines;
Expand All @@ -275,7 +312,6 @@ private void Form1_Load(object sender, EventArgs e)
public int findMinutes(String startTime, String endTime)
{
int startHours = 0, startMinutes = 0, endHours = 0, endMinutes = 0;

if (startTime.Contains("NOON"))
{
startHours = 12;
Expand Down

0 comments on commit 08f9c92

Please sign in to comment.