private void button1_Click(object sender, EventArgs e) { var unitofwork = new UnitOfWork(); unitofwork.EmployeeAvailabilityRepository.Insert(GetFields(new EmployeeAvailabilityDay())); unitofwork.Save(); DialogResult = DialogResult.OK; }
private void button3_Click(object sender, EventArgs e) { if (dgvPresetNotes.SelectedRows.Count > 0) { var unitofwork = new UnitOfWork(); unitofwork.BookingClassificationRepository.Delete(accessLevels[dgvPresetNotes.SelectedRows[0].Index].Id); unitofwork.Save(); Rebind(); } }
private void button3_Click(object sender, EventArgs e) { if (dgvNAs.SelectedRows.Count > 0) { var unitofwork = new UnitOfWork(); unitofwork.EmployeeNARepository.Delete(EmployeeNAs[dgvNAs.SelectedRows[0].Index]); unitofwork.Save(); RebindEmployeeNAs(); } }
private void button3_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { var unitofwork = new UnitOfWork(); for (int i = 0; i < dataGridView1.SelectedRows.Count; i++) { unitofwork.SkillCategoryRepository.Delete(Categories[dataGridView1.SelectedRows[i].Index]); } unitofwork.Save(); Rebind(); } }
public static void Initialize() { var unitofwork = new UnitOfWork(); if (unitofwork.EmployeeRepository.Get().Count() == 0) { unitofwork.BookingClassificationRepository.Insert(new BookingClasification() { ClassificationName = "Class 1", DisplayOrder = 1 }); unitofwork.BookingClassificationRepository.Insert(new BookingClasification() { ClassificationName = "Class 2", DisplayOrder = 1 }); unitofwork.BookingClassificationRepository.Insert(new BookingClasification() { ClassificationName = "Class 3", DisplayOrder = 1 }); unitofwork.BookingClassificationRepository.Insert(new BookingClasification() { ClassificationName = "Class 4", DisplayOrder = 1 }); unitofwork.BookingClassificationRepository.Insert(new BookingClasification() { ClassificationName = "Class 5", DisplayOrder = 1 }); var added = unitofwork.AccessLevelRepository.Insert(new AccessLevel { Name = "Level 1", Level = 1 }); var newRestaurant = new Restaurant() { Capacity = 100, Name = "Rebellion", Location = "Sydney", RosteringStartDay = (int)DayOfWeek.Monday, RosteringWeekDuration = 1, RosteringWeekOffset = 0 }; var newemployee = new Employee() { Id = 111, FirstName = "Scott", LastName = "Becker", AccessLevel = added, Email = "*****@*****.**", PhoneNumber = "999999999" }; var availabilities = new List<EmployeeAvailabilityDay>(); availabilities.Add(new EmployeeAvailabilityDay() { DayOfWeek = (int)DayOfWeek.Monday, StartDate = new DateTime(2014, 1, 1), Notes = "Initial Availability", StartTime = new DateTime(2014, 10, 10, 16, 30, 0),DateAdded= DateTime.Now }); availabilities.Add(new EmployeeAvailabilityDay() { DayOfWeek = (int)DayOfWeek.Tuesday, StartDate = new DateTime(2014, 1, 1), Notes = "Initial Availability", StartTime = new DateTime(2014, 10, 10, 18, 30, 0), DateAdded = DateTime.Now }); availabilities.Add(new EmployeeAvailabilityDay() { DayOfWeek = (int)DayOfWeek.Wednesday, StartDate = new DateTime(2014, 1, 1), Notes = "Initial Availability", StartTime = new DateTime(2014, 10, 10, 12, 30, 0), DateAdded = DateTime.Now }); availabilities.Add(new EmployeeAvailabilityDay() { DayOfWeek = (int)DayOfWeek.Thursday, StartDate = new DateTime(2014, 1, 1), Notes = "Initial Availability", StartTime = new DateTime(2014, 10, 10, 15, 30, 0), DateAdded = DateTime.Now }); availabilities.Add(new EmployeeAvailabilityDay() { DayOfWeek = (int)DayOfWeek.Friday, StartDate = new DateTime(2014, 1, 1), Notes = "Initial Availability", StartTime = new DateTime(2014, 10, 10, 13, 30, 0), DateAdded = DateTime.Now }); availabilities.Add(new EmployeeAvailabilityDay() { DayOfWeek = (int)DayOfWeek.Saturday, StartDate = new DateTime(2014, 1, 1), Notes = "Initial Availability", StartTime = new DateTime(2014, 10, 10, 16, 30, 0), DateAdded = DateTime.Now }); availabilities.Add(new EmployeeAvailabilityDay() { DayOfWeek = (int)DayOfWeek.Sunday, StartDate = new DateTime(2014, 1, 1), Notes = "Initial Availability", StartTime = new DateTime(2014, 10, 10, 14, 30, 0), DateAdded = DateTime.Now }); newemployee.EmployeeAvailabilityDays = availabilities; newemployee.EmployeeNAs.Add(new EmployeeNA() { StartDate = DateTime.Now.AddDays(-7), EndDate = DateTime.Now.AddDays(-6), Notes = "Visiting Grandma", SubmittedBy = newemployee ,SubmittedDate=DateTime.Now}); newemployee.EmployeeNAs.Add(new EmployeeNA() { StartDate = DateTime.Now.AddDays(6), EndDate = DateTime.Now.AddDays(7), Notes = "Visiting Grandma Again", SubmittedBy = newemployee, SubmittedDate = DateTime.Now }); newemployee.EmployeeNAs.Add(new EmployeeNA() { StartDate = DateTime.Now.AddDays(9), EndDate = DateTime.Now.AddDays(10), Notes = "Visiting Grandma", SubmittedBy = newemployee, SubmittedDate = DateTime.Now }); newemployee.EmployeeAvailabilityHoursRequests.Add(new EmployeeAvailabilityHoursRequest() { StartDate = new DateTime(2014, 1, 1), RequestedMinimumHours = 8, RequestedMaximumHours = 30 }); unitofwork.AccessLevelRepository.Insert(new AccessLevel() { Name = "Level 2", Level = 2 }); unitofwork.AccessLevelRepository.Insert(new AccessLevel() { Name = "Level 3", Level = 3 }); unitofwork.AccessLevelRepository.Insert(new AccessLevel() { Name = "Level 4", Level = 4 }); unitofwork.EmployeeRepository.Insert(newemployee); unitofwork.PresetNoteRepository.Insert(new PresetNote() { Name = "Gluten Free", Severity = 5 }); unitofwork.PresetNoteRepository.Insert(new PresetNote() { Name = "Dairy Free", Severity = 5 }); unitofwork.PresetNoteRepository.Insert(new PresetNote() { Name = "Window Seat", Severity = 2 }); unitofwork.LockedOutDateRepository.Insert(new LockOutDate() { Name = "Locked Out Date 1", Reason = "Cause", StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(1), DateCreated = DateTime.Now, Restaurant = newRestaurant }); unitofwork.LockedOutDateRepository.Insert(new LockOutDate() { Name = "Locked Out Date 2", Reason = "Cause", StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(1), DateCreated = DateTime.Now, Restaurant = newRestaurant }); unitofwork.LockedOutDateRepository.Insert(new LockOutDate() { Name = "Locked Out Date 3", Reason = "Cause", StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(1), DateCreated = DateTime.Now, Restaurant = newRestaurant }); unitofwork.LockedOutDateRepository.Insert(new LockOutDate() { Name = "Locked Out Date 4", Reason = "Cause", StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(1), DateCreated = DateTime.Now, Restaurant = newRestaurant }); unitofwork.DateNoteRepository.Insert(new DateNote() { Note = "Note1", AppearOnAddingBooking = true, AppearOnRoster = true, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(1), Restaurant = newRestaurant, DateCreated = DateTime.Now }); unitofwork.DateNoteRepository.Insert(new DateNote() { Note = "Note2", AppearOnAddingBooking = false, AppearOnRoster = true, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(1), DateCreated = DateTime.Now, Restaurant = newRestaurant }); unitofwork.DateNoteRepository.Insert(new DateNote() { Note = "Note3", AppearOnAddingBooking = true, AppearOnRoster = false, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(1), DateCreated = DateTime.Now, Restaurant = newRestaurant }); unitofwork.ShiftCategoryRepository.Insert(new ShiftCategory() { CategoryName="Quiet Night" }); unitofwork.ShiftCategoryRepository.Insert(new ShiftCategory() { CategoryName="Busy Week Night" }); unitofwork.ShiftCategoryRepository.Insert(new ShiftCategory() { CategoryName="Saturday Night" }); unitofwork.ShiftCategoryRepository.Insert(new ShiftCategory() { CategoryName= "Banquets < 100" }); unitofwork.Save(); } }
private void button3_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { var unitofwork = new UnitOfWork(); for(int i=0; i<dataGridView1.SelectedRows.Count;i++) { var comm = commendations[dataGridView1.SelectedRows[i].Index]; unitofwork.EmployeeCommendationClassificationRepository.Delete( comm); } unitofwork.Save(); Rebind(); } }
private void button1_Click(object sender, EventArgs e) { var unitofwork = new UnitOfWork(); if (LockedDateID.HasValue) { unitofwork.LockedOutDateRepository.Update(GetFields(workinglockedDate)); } else { unitofwork.LockedOutDateRepository.Insert(GetFields(new LockOutDate())); } unitofwork.Save(); this.DialogResult = DialogResult.OK; }
private void button1_Click(object sender, EventArgs e) { var unitOfWork = new UnitOfWork(); if(RestaurantID== null) { unitOfWork.RestaurantRepository.Insert(new Restaurant() { Location = tbLocation.Text, Name = tbName.Text, Capacity = (int)tbCapacity.Value }); } else { Restaurant.Name = tbName.Text; Restaurant.Capacity = (int)tbCapacity.Value; Restaurant.Location = tbLocation.Text; unitOfWork.RestaurantRepository.Update(Restaurant); } unitOfWork.Save(); this.DialogResult = DialogResult.OK; }
private void button1_Click(object sender, EventArgs e) { var unitOfWork = new UnitOfWork(); for(int i = 0; i< checkedListBox1.Items.Count; i++) { var permission = checkedListBox1.Items[i].ToString(); if(WorkingLevel.Permissions.FirstOrDefault(x=> x.PermissionName== permission)==null) { WorkingLevel.Permissions.Add(new Permissions() { PermissionName = permission, PermissionValue= checkedListBox1.GetItemChecked(i) }); } else { WorkingLevel.Permissions.FirstOrDefault(x => x.PermissionName == permission).PermissionValue = checkedListBox1.GetItemChecked(i); } } unitOfWork.Save(); this.DialogResult = DialogResult.OK; }
private void button1_Click(object sender, EventArgs e) { var unitOfWork = new UnitOfWork(); //TODO: Validate Inputs if (currentCommendationId != null) { unitOfWork.EmployeeCommendationRepository.Update(GetFields(currentCommendation)); } else { currentCommendation = GetFields(new EmployeeCommendation()); currentCommendation.DateCreated = DateTime.Now; unitOfWork.EmployeeCommendationRepository.Insert(currentCommendation); } unitOfWork.Save(); this.DialogResult = DialogResult.OK; }
private void button1_Click(object sender, EventArgs e) { var unitOfWork = new UnitOfWork(); if (currentUser == null) { Employee newUser; newUser = GetFields(new Employee()); unitOfWork.EmployeeRepository.Insert(newUser); unitOfWork.Save(); DialogResult = DialogResult.OK; } else { currentUser = GetFields(currentUser); unitOfWork.EmployeeRepository.Update(currentUser); DialogResult = DialogResult.OK; } }
private void button1_Click(object sender, EventArgs e) { var unitOfWork = new UnitOfWork(); if (WorkingNote == null) { WorkingNote = new BookingClasification(); WorkingNote.ClassificationName = tbNote.Text; unitOfWork.BookingClassificationRepository.Insert(WorkingNote); } else { WorkingNote.ClassificationName = tbNote.Text; if(presetID!=null) unitOfWork.BookingClassificationRepository.Update(WorkingNote); } unitOfWork.Save(); DialogResult = DialogResult.OK; }
private void button1_Click(object sender, EventArgs e) { var unitOfWork = new UnitOfWork(); if (WorkingNote == null) { WorkingNote = new PresetNote(); WorkingNote.Name = tbNote.Text; WorkingNote.Severity = (int)nmudSeverity.Value; unitOfWork.PresetNoteRepository.Insert(WorkingNote); } else { WorkingNote.Name = tbNote.Text; WorkingNote.Severity = (int)nmudSeverity.Value; if(presetID!=null) unitOfWork.PresetNoteRepository.Update(WorkingNote); } unitOfWork.Save(); DialogResult = DialogResult.OK; }
private void button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text)) { var unitOfWork = new UnitOfWork(); if (AccessLevelId == null) { WorkingLevel = new AccessLevel() { Level = (int)numericUpDown1.Value, Name = textBox1.Text }; unitOfWork.AccessLevelRepository.Insert(WorkingLevel); } else { WorkingLevel.Name = textBox1.Text; WorkingLevel.Level = (int)numericUpDown1.Value; unitOfWork.AccessLevelRepository.Update(WorkingLevel); } unitOfWork.Save(); this.DialogResult = DialogResult.OK; } }
public Roster GetRosterForDate(DateTime d,string include="") { CultureInfo cul = CultureInfo.CurrentCulture; int weekOfYear = cul.Calendar.GetWeekOfYear(d, CalendarWeekRule.FirstDay, DayOfWeek.Monday); int year = d.Year; if (weekOfYear > 52) { weekOfYear = weekOfYear % 52; year += 1; } var unitofWork = new UnitOfWork(); var roster = unitofWork.RosterRepository.Get(x => x.WeekOfYear == weekOfYear && x.Year == year,includeProperties: include); if (roster.FirstOrDefault() != null) { return roster.FirstOrDefault(); } else { Roster r = new Roster() { WeekOfYear = weekOfYear, Year = year, Notes = "NOTES", Restaurant = new UnitOfWork().RestaurantRepository.Get().FirstOrDefault() }; var q = unitofWork.RosterRepository.Insert(r); unitofWork.Save(); return unitofWork.RosterRepository.Get(x => x.WeekOfYear == weekOfYear && x.Year == year, includeProperties:include).FirstOrDefault(); } }
private void btnSave_Click(object sender, EventArgs e) { Booking booking; var unitOfWork = new UnitOfWork(); if (currentBooking == null) { booking = GetFields(new Booking()); booking.Employee = user; booking.DateCreated = DateTime.Now; unitOfWork.BookingRepository.Insert(booking); unitOfWork.Save(); DialogResult = DialogResult.OK; } else { currentBooking = GetFields(currentBooking); currentBooking.BookingNotes.Add(new BookingNote() { EmployeeId= user.Id, Severity=0, Note="Modified By: " + user.FullName, DateAdded=DateTime.Now }); unitOfWork.BookingRepository.Update(currentBooking); DialogResult = DialogResult.OK; } }
private void button4_Click(object sender, EventArgs e) { /*TO DO: Permissions*/ if (dataGridView1.SelectedRows.Count > 0) { var unitOfWork = new UnitOfWork(); foreach (var row in dataGridView1.SelectedRows) { int workingIndex = dataGridView1.SelectedRows[0].Index; var booking = ListOfBookings[workingIndex]; if(booking.BookingConfirmations.Count==0) booking.BookingConfirmations.Add(new BookingConfirmation() { ConfirmationDate = DateTime.Today, EmployeeId = User.Id }); } unitOfWork.Save(); Rebind(); } }
private void button5_Click(object sender, EventArgs e) { /*TO DO: Permissions*/ if (dataGridView1.SelectedRows.Count > 0) { var unitOfWork = new UnitOfWork(); foreach (var row in dataGridView1.SelectedRows) { int workingIndex = dataGridView1.SelectedRows[0].Index; var booking = ListOfBookings[workingIndex]; if(booking.ArrivedDate==null) booking.ArrivedDate = DateTime.Now; } unitOfWork.Save(); Rebind(); } }
private void button1_Click(object sender, EventArgs e) { var unitofwork = new UnitOfWork(); workingClassification.Name = textBox1.Text; workingClassification.Weighting = (int)numericUpDown1.Value; workingClassification.AvailableOnUser = checkBox1.Checked; workingClassification.AvailableOnTeam = checkBox2.Checked; if(workingClassificationID!= null) { unitofwork.EmployeeCommendationClassificationRepository.Update(workingClassification); } else { unitofwork.EmployeeCommendationClassificationRepository.Insert(workingClassification); } unitofwork.Save(); this.DialogResult = DialogResult.OK; }
private void button2_Click(object sender, EventArgs e) { var unitofwork = new UnitOfWork(); if (WorkingShift == null) { unitofwork.ShiftRepository.Insert(GetFields(new Shift())); } else { unitofwork.ShiftRepository.Update(GetFields(WorkingShift)); } unitofwork.Save(); this.DialogResult = DialogResult.OK; }
private void button9_Click(object sender, EventArgs e) { var unitofwork = new UnitOfWork(); var workingobject = unitofwork.ShiftCategoryRepository.Get(x => x.Id == (int)cbPresetShifts.SelectedValue).FirstOrDefault(); workingobject.EmployeeShiftPresets = ShiftSlots.Select(x => ConvertShiftToShiftPreset(x)).ToList(); unitofwork.Save(); RebindShiftSlots(); }
private void button7_Click(object sender, EventArgs e) { var unitofwork = new UnitOfWork(); string value = ""; if (CommonControls.InputBox("Save as...", "New Category Name:", ref value) == DialogResult.OK) { var workingobject = new ShiftCategory() { CategoryName = value }; workingobject.EmployeeShiftPresets = ShiftSlots.Select(x => ConvertShiftToShiftPreset(x)).ToList(); unitofwork.ShiftCategoryRepository.Insert(workingobject); unitofwork.Save(); RebindPresets(); } }
private void button1_Click(object sender, EventArgs e) { var unitofwork = new UnitOfWork(); SkillCategory parent=null; if(parentSkillCategoryId!= null) parent= unitofwork.SkillCategoryRepository.Get(x => x.Id == parentSkillCategoryId).FirstOrDefault(); if (currentSkillCategoryId!=null) { unitofwork.SkillCategoryRepository.Update(GetFields(currentSkillCategory,parent)); } else { unitofwork.SkillCategoryRepository.Insert(GetFields(new SkillCategory(),parent)); } unitofwork.Save(); this.DialogResult = DialogResult.OK; }
private void button1_Click(object sender, EventArgs e) { var unitOfWork = new UnitOfWork(); if (NAID!= null) { unitOfWork.EmployeeNARepository.Update(GetFields(workingNA)); } else { unitOfWork.EmployeeNARepository.Insert(GetFields(new EmployeeNA())); } unitOfWork.Save(); this.DialogResult = DialogResult.OK; }