public async Task <IActionResult> Save([FromBody] DutyTypeViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } DutyType dutyType = null; if (model.Id == 0) { dutyType = new DutyType(); _appDbContext.DutyTypes.Add(dutyType); } else { dutyType = await _appDbContext.DutyTypes.SingleOrDefaultAsync(t => t.Id == model.Id); } if (dutyType == null) { return(BadRequest()); } dutyType.Name = model.Name; dutyType.TenantId = model.TenantId; dutyType.Color = model.Color; await _appDbContext.SaveChangesAsync(); return(new OkObjectResult(dutyType)); }
// RefreshListEvent 이벤트가 발생했 을 때 호출되는 메소드 private void RefreshListBox(DutyType dutyType) { // 내근은 SelectedIndex를 0, 외근은 SelectedIndex를 1로 설정하여 // 상단 ListBox의 선택값을 변경 시킨다. // 상단 ListBox의 값이 바뀜에 따라 OnSelected 이벤트 핸들러가 호출되어 // 자동으로 아래쪽 ListBox의 값은 변경된다. myListBox1.SelectedItem = null; myListBox1.SelectedIndex = (dutyType == DutyType.Inner) ? 0 : 1; }
//저장 버튼 클릭 private void Button_Click(object sender, RoutedEventArgs e) { if (rdoInner.IsChecked == false && rdoOutside.IsChecked == false) { MessageBox.Show("내근 또는 외근을 선택하세요.", "항목 선택"); return; } DutyType dutyType = (rdoInner.IsChecked == true) ? DutyType.Inner : DutyType.OutSide; MainWindow.duties.Add(new Duty(txtDutyName.Text, dutyType)); UpdateActor.DynamicInvoke(dutyType); MessageBox.Show("저장완료", "저장확인"); this.Close(); }
public async Task <ActionResult <Duty> > PostDuty(Duty duty) { User user = await _context.Users.FindAsync(duty.UserId); User assignedTo = await _context.Users.FindAsync(duty.AssignedToId); House house = await _context.Houses.FindAsync(duty.HouseId); DutyType dutyType = await _context.DutyTypes.FindAsync(duty.DutyTypeId); duty = new Duty { Label = duty.Label, AssignedTo = assignedTo, AssignedToId = duty.AssignedToId, DutyTypeId = duty.DutyTypeId, Type = dutyType, StartDate = duty.StartDate, EndDate = duty.EndDate, MarkAsDone = duty.MarkAsDone, Edited = duty.Edited, House = house, HouseId = duty.HouseId, Privilege = duty.Privilege, CreatedAt = duty.CreatedAt, OnProcess = duty.OnProcess, Repeat = duty.Repeat, IsStarred = duty.IsStarred, IsImportant = duty.IsImportant, PrimaryColor = duty.PrimaryColor, SecondaryColor = duty.SecondaryColor, DutyCreator = user, UserId = duty.UserId, Notes = duty.Notes }; _context.Duties.Add(duty); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDuty", new { id = duty.Id }, duty)); }
public Duty(string name, DutyType dutyType) { _name = name; _dutyType = dutyType; }
public DutyType1() { this.taxCategoryField = new TaxCategoryType(); this.dutyField = new DutyType(); }
public static void SeedDuties(RosterContext context) { var SafteyBoatDriver = new DutyType { Name = "Safety Boat Driver", ClubId = 1, Description = "Driving a safety boat for an event.", Instructions = "Provide adiquite safety coverage for the event." // Sb driver ,SB assistant, Race officer ,RO assistant }; var SafteyBoatAssistant = new DutyType { Name = "Safety Boat Assistant", ClubId = 1, Description = "Assisting the safety boat driver.", Instructions = "Help driver provide adiquite safety coverage for the event." }; var RaceOfficer = new DutyType { Name = "Race Officer", ClubId = 1, Description = "Help running a race by conducting start sequence and finish times.", Instructions = "Help organise launching of participants and making apropriate choices for shortened course etc based on circumstances. " }; var RaceOfficerassistant = new DutyType { Name = "Race Officer Assistant", ClubId = 1, Description = "Assisting thhe Race officer in running a race.", Instructions = "Assist the race officer with their duties to the best of your ability." }; var d1 = new Duty { Name = "test1", ClubId = 1, Description = "test SB driver", FromDate = DateTime.Now.AddDays(3), ToDate = DateTime.Now.AddDays(3.5), Starttime = "9:00AM", Endtime = "4:00PM" }; var d2 = new Duty { Name = "test2", ClubId = 1, Description = "test SB Assistant", FromDate = DateTime.Now.AddDays(3), ToDate = DateTime.Now.AddDays(3.5), Starttime = "9:00AM", Endtime = "4:00PM" }; var d3 = new Duty { Name = "test3", ClubId = 1, Description = "test Race Officer", FromDate = DateTime.Now.AddDays(5), ToDate = DateTime.Now.AddDays(5.5), Starttime = "9:00AM", Endtime = "4:00PM" }; var d4 = new Duty { Name = "test4", ClubId = 1, Description = "test RO Assistant", FromDate = DateTime.Now.AddDays(5), ToDate = DateTime.Now.AddDays(5.5), Starttime = "9:00AM", Endtime = "4:00PM" }; context.DutyTypes.Add(SafteyBoatDriver); context.DutyTypes.Add(SafteyBoatAssistant); context.DutyTypes.Add(RaceOfficer); context.DutyTypes.Add(RaceOfficerassistant); context.Duties.Add(d1); context.Duties.Add(d2); context.Duties.Add(d3); context.Duties.Add(d4); context.SaveChanges(); }
private void RefreshListBox(DutyType dutyType) { myListBox1.SelectedItem = null; myListBox1.SelectedIndex = (dutyType == DutyType.Inner) ? 0 : 1; }
public Duty(int timeslot, Employee employee, DutyType type) { Timeslot = timeslot; Employee = employee; Type = type; }