コード例 #1
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            List <WorkingTime> workingTimes    = new List <WorkingTime>();
            WorkingLocation    workingLocation = (WorkingLocation)cmb_location.SelectedItem;

            if (lbx_employee.CheckedItems.Count == 0)
            {
                MessageBox.Show("Lütfen en az bir çalışan seçiniz.");
            }
            else
            {
                foreach (Employee employee in lbx_employee.CheckedItems)
                {
                    var startDate = monthCalendar1.SelectionRange.Start;
                    var endDate   = monthCalendar1.SelectionRange.End;
                    for (DateTime start = startDate; start <= endDate; start = start.AddDays(1.0))
                    {
                        WorkingTime workingTime = new WorkingTime
                        {
                            EmployeeID        = employee.ID,
                            WorkingDate       = start,
                            WorkingHours      = (int)txt_hour.Value,
                            WorkingLocationID = workingLocation.ID
                        };
                        workingTimes.Add(workingTime);
                    }
                }
            }
            string result = _workingTimeService.AddRange(workingTimes);

            MessageBox.Show(result);
        }
コード例 #2
0
ファイル: LocationForm.cs プロジェクト: fakarsu1/TallySheet
        private void btn_add_Click(object sender, EventArgs e)
        {
            var location = new WorkingLocation {
                Name = txt_name.Text
            };
            var result = _workingLocationService.Add(location);

            if (result >= 0)
            {
                MessageBox.Show("İşlem Başarılı.");
                FillLocations();
            }
            else
            {
                MessageBox.Show("İşlem Başarısız.");
            }
        }
コード例 #3
0
 public int Remove(WorkingLocation workingLocation)
 {
     _repository.Remove(workingLocation);
     return(_unitOfWork.SaveChanges());
 }
コード例 #4
0
 public int Add(WorkingLocation workingLocation)
 {
     _repository.Add(workingLocation);
     return(_unitOfWork.SaveChanges());
 }