Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions CodeInspection/HomeControllerPartial.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using On_Call_Assistant.DAL;
using On_Call_Assistant.Models;


namespace On_Call_Assistant.Controllers
{
public partial class HomeController : Controller
{
private OnCallContext db = new OnCallContext();
public ActionResult RotationData(string start, string end, int ID = -1)
{
if (start == null || end == null)
{
start = end = DateTime.Today.ToString("u");
}
List<CalendarObject> rotationList = getRotations(start, end);
if (ID != -1)
{
rotationList = rotationList.Where(rot => rot.id == ID).ToList();
}
return Json(rotationList, JsonRequestBehavior.AllowGet);
}
public ActionResult RotationsWithoutURL(string start, string end, int ID = -1)
{
if (start == null || end == null)
{
start = end = DateTime.Today.ToString("u");
}
List<CalendarObject> rotationList = getRotations(start, end);
if (ID != -1)
{
rotationList = rotationList.Where(rot => rot.id == ID).ToList();
}
foreach (var rot in rotationList)
{
rot.url = null;
}
return Json(rotationList, JsonRequestBehavior.AllowGet);

}

public ActionResult AbsenceData(string start, string end)
{
if (start == null || end == null)
{
start = end = DateTime.Today.ToString("u");
}
DateTime beginDate = DateTime.Parse(start);
DateTime endDate = DateTime.Parse(end);
IList<CalendarObject> absenceList = new List<CalendarObject>();
var absences = db.outOfOffice.Include(o => o.employeeOut);
var filteredAbsences = filterAbsences(absences, beginDate, endDate);
foreach (var absence in filteredAbsences)
{
absenceList.Add(new CalendarObject
{
title = absence.employeeOut.firstName + " " + absence.employeeOut.lastName,
start = absence.startDate.ToString("u"),
end = absence.startDate.AddDays(absence.numHours / 8).ToString("u"),
color = "yellow",
url = String.Format("OutOfOffices/Details/{0}", absence.ID),
allDay = "false"
});
}
return Json(absenceList, JsonRequestBehavior.AllowGet);
}
private System.Collections.Hashtable getApplicationColors()
{
System.Collections.Hashtable colors = new System.Collections.Hashtable();
colors.Add(3, "MediumSeaGreen");
colors.Add(5, "Goldenrod");
colors.Add(8, "Cyan");
return colors;
}
private List<OutOfOffice> filterAbsences(IQueryable<OutOfOffice> absences, DateTime begin, DateTime end)
{
List<OutOfOffice> results = new List<OutOfOffice>();
foreach (var abs in absences)
{
if ((abs.startDate >= begin && abs.startDate <= end) || (abs.startDate.AddDays(abs.numHours / 8) >= begin && abs.startDate.AddDays(abs.numHours / 8) <= end))
{
results.Add(abs);
}
}
return results;
}

private List<CalendarObject> getRotations(string start, string end)
{
DateTime beginDate = DateTime.Parse(start);
DateTime endDate = DateTime.Parse(end);
List<CalendarObject> rotationList = new List<CalendarObject>();
var onCallRotations = db.onCallRotations.Include(o => o.employee);
onCallRotations = onCallRotations.Where(rot => (rot.startDate >= beginDate && rot.startDate <= endDate) || (rot.endDate >= beginDate && rot.endDate <= endDate));
System.Collections.Hashtable applicationColors = getApplicationColors();

foreach (var rotation in onCallRotations)
{
CalendarObject temp = new CalendarObject();
temp.id = rotation.employee.Application;
temp.title = rotation.employee.firstName + " " + rotation.employee.lastName;
if (!rotation.isPrimary)
temp.title = temp.title + " as Secondary";
temp.start = rotation.startDate.ToString("u");
temp.end = rotation.endDate.AddDays(1).ToString("u");
temp.color = applicationColors[rotation.employee.Application].ToString();
temp.url = String.Format("OnCallRotations/Details/{0}", rotation.rotationID);
temp.allDay = "true";
rotationList.Add(temp);
}

return rotationList;
}

}

public class CalendarObject
{
public int id { get; set; }
public string title { get; set; }
public string start { get; set; }
public string end { get; set; }
public string color { get; set; }
public string url { get; set; }
public string allDay { get; set; }

}

}
107 changes: 107 additions & 0 deletions CodeInspection/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
@{
ViewBag.Title = "Home Page";
ViewBag.AppName = "On-Call Assistant";
}
@section styles {
<link href="~/Content/fullcalendar.css" rel="stylesheet" />
<link href="~/Content/fullcalendar.print.css" rel="stylesheet" media='print' />
}

@section scripts {
<script src="~/Scripts/lib/jquery.min.js"></script>
<script src="~/Scripts/lib/moment.min.js"></script>
<script src="~/Scripts/fullcalendar.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
@*<script type="text/javascript" src="~/Scripts/lib/calendarEvents.js"></script>*@
<script type="text/javascript">
$(document).ready(function () {
$('#calendar').fullCalendar({
editable: false,
events: "/home/rotationdata/"@*for filtiring: /Home/RotationData?start=2015-03-01&end=2015-04-01&ID=5*@
});

$('#GenerateSchedule').click(function (event) {
event.preventDefault();
//probably could be refactored...
window.location.replace("/oncallrotations/generateSchedule");
});


@* Code for sorting rotations on the calendar by app starts here.
Grab each application and dynamically create a drop-down list item*@
@foreach(var app in ViewBag.applications)
{
@:$(".dropdown-menu").prepend('<li role="presentation"><a role="menuitem" tabindex="-1" href="#">' + '@app' + '</a></li>');
}
$(".dropdown-menu").prepend('<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Remove Filters</a></li>');

@*Set the onclick event for the the dropdown list items*@
$('.dropdown').on('click', 'ul li a', function () {
var selectedAppName = $(this).text();
if (selectedAppName == 'Remove Filters') {
$('#calendar').fullCalendar('removeEvents');
$('#calendar').fullCalendar('addEventSource', "/Home/RotationData/" + selectedAppID);
$('#calendar').fullCalendar('rerenderEvents');
}
else {
var selectedAppID = selectedAppName.slice(selectedAppName.indexOf("-") + 1, selectedAppName.length);
console.log(selectedAppID);
$('#calendar').fullCalendar('removeEvents');
$('#calendar').fullCalendar('addEventSource', "/Home/RotationData?ID=" + selectedAppID);
$('#calendar').fullCalendar('rerenderEvents');
}
});
});



</script>





}
<div class="jumbotron">
<h1>@ViewBag.AppName</h1>

<p class="lead">Manage your on-call rotations, employees and summaries.</p>
<button id="GenerateSchedule" class="btn btn-primary btn-lg" type="button" onclick='this.disabled = "disabled";'>Generate Schedule</button>
<a href="../Home/Printable">print &raquo;</a>
</div>
@*Containers for the dropdown list of Application names (for sorting rotations on the calendar by app)*@
<div class="container">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="menu1" data-toggle="dropdown">
Sort By App
<span class="caret"></span>
</button>
<ul id="dropDownList" class="dropdown-menu" role="menu" aria-labelledby="menu1"></ul>
</div>
</div>

<div class="row" style=" padding-top:20px">
<div class="col-md-9">
<div id="calendar"></div>
</div>


<div class="col-md-3">
<div class="row">
<h2>Employees</h2>
<p>Manage your employee data.</p>
<p><a class="btn btn-default" href="/employees">Go &raquo;</a></p>
<!-- <p><a href="/employees"><img src="~/Content/employeesButton.png"/></a></p>-->
</div>
<div class="row">
<h2>Manage On-Call Schedules</h2>
<p>View and edit the upcoming on-call rotations.</p>
<p><a class="btn btn-default" href="/oncallrotations">Go &raquo;</a></p>
</div>
<div class="row">
<h2>Manage Vacation</h2>
<p>Get a summary of upcoming vacation for employees and edit that time off as necessary.</p>
<p><a class="btn btn-default" href="/outofoffices">Go &raquo;</a></p>
</div>
</div>
</div>
27 changes: 25 additions & 2 deletions References.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Instructions: Look around for books, videos, articles, blogs, etc. for learning about the technologies needed for the project this semester. Add a section below that includes your name and the resources you recommend for learning about the different technologies we will be using this semester. If one of your recommendations is the same as someone else's, say what makes it a good reference. You should include at least one new reference that hasn't been mentioned yet.
Instructions: Look around for books, videos, articles, blogs, etc. for learning about the technologies needed for the project this semester. Add a section below that includes your name and the resources you recommend for learning about the different technologies we will be using this semester. If one of your recommendations is the same as someone else's, say what makes it a good reference. You should include at least one new reference that hasn't been mentioned yet.

=== Some Suggestions by Eddie Burris ========================

Expand Down Expand Up @@ -231,4 +231,27 @@ This reference details how to export data to an Excel spreadsheet using C#.
http://sourceforge.net/projects/itextsharp/

This is a .NET library for exporting data to a PDF file.
===================================================================
===================================================================
HEAD
====Suggestions by Colin Zeiler=====================================

Since the project for this semester must use the .NET framework, I thought it would be helpful to look at some
programming exercises that use C# in order to get used to the language. There is also a link to a programmer's
reference page.

https://msdn.microsoft.com/en-us/library/aa288436(v=vs.71).aspx

This project also requires compatibility with SQL Server 2012, so I figured a reference on how to access SQL databases in
Visual studio would also be helpful.

https://msdn.microsoft.com/en-us/library/wzabh8c4.aspx
=======

====Suggestions by Hang Nguyen=====================================

The following link is step-by-step tutorial on how to create a database on Microsoft Visual Studios:

http://www.theengineeringprojects.com/2013/01/creating-database-in-microsoft-visual.html

=== Suggestions by Brien Belko =========================I also think MVC: Pro ASP.NET MVC 5 is an excellent resource. The first half of the book gives you a step by step, chapter by chapter guide to building an application within ASP.NET MVC. The second half of the book really dives deep into the concepts deeply. You can find it on safari in the UMKC library databases.http://library.umkc.edu/Tangential to using ASP.NET, I have been using for reference C# 5.0 In A Nutshell: The Definitive Reference. This book has been incredibly helpful to me as I had never programmed in C# prior to this project. This also can be found on Safari in the UMKC library databases.http://library.umkc.edu/There is a free guide to Git published by Apress that will tell you everything you wanted to know, and much you wouldn’t, about Git. It explains the concepts of Git, comes in four different file formats and has a chapter completely dedicated to GitHub. That and the first few chapters should be enough to make you an expert (for the purpose of this class)http://git-scm.com/book/en/v2 ========================================================
4d79259b5974c188854914175946e61f3dae0c88
Expand Down
22 changes: 22 additions & 0 deletions Team 3 Presentation/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
Loading