Пример #1
0
        public PastEvent()
        {
            InitializeComponent();
            _context = new MahiberDbContext();
            past     = _context.MahiberEvents.FirstOrDefault();

            Check_view();
        }
Пример #2
0
        public UpcomingEvent()
        {
            InitializeComponent();
            _context = new MahiberDbContext();
            upcoming = _context.MahiberEvents.FirstOrDefault();

            Check_view();
        }
Пример #3
0
 private void DeleteBtn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         MahiberEvent       selected     = ((MahiberEvent)EventGrid.SelectedItem);
         DeleteConfirmation Confirmation = new DeleteConfirmation();
         Confirmation.assigner(selected);
         Confirmation.Show();
     }
     catch (Exception)
     {
     }
 }
Пример #4
0
 private void EventGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         MahiberEvent selected = ((MahiberEvent)EventGrid.SelectedItem);
         EventName.Text   = selected.Name;
         EventPlace.Text  = selected.Place;
         EventFin.Text    = selected.Fin.ToString();
         Description.Text = selected.Description;
         EventDate.Text   = selected.Date.Date.ToString();
         EventTime.Text   = selected.Time.ToShortTimeString();
     }
     catch (Exception msg)
     {
         Console.WriteLine(msg.Message);
     }
 }
Пример #5
0
        private void EditBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MahiberEvent selected = ((MahiberEvent)EventGrid.SelectedItem);
                selected.Name        = EventName.Text.Trim();
                selected.Date        = Convert.ToDateTime(EventDate.Text);
                selected.Time        = Convert.ToDateTime(EventTime.Text);
                selected.Place       = EventPlace.Text.Trim();
                selected.Description = Description.Text.Trim();
                selected.Fin         = Convert.ToDouble(EventFin.Text);

                _context.Entry(selected).State = System.Data.Entity.EntityState.Modified;
                _context.SaveChanges();
            }
            catch (Exception)
            {
            }
        }
Пример #6
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MahiberEvent mahiberEvent = new MahiberEvent();
                mahiberEvent.Name        = EventName.Text.Trim();
                mahiberEvent.Date        = Convert.ToDateTime(EventDate.Text);
                mahiberEvent.Place       = EventPlace.Text.Trim();
                mahiberEvent.Description = Description.Text.Trim();
                mahiberEvent.Time        = Convert.ToDateTime(EventTime.Text);
                mahiberEvent.Fin         = Convert.ToDouble(EventFin.Text);

                _context.MahiberEvents.Add(mahiberEvent);
                _context.SaveChanges();
            }
            catch (Exception)
            {
            }
        }
Пример #7
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            int checkBoxColum = 4;

            eve = ((MahiberEvent)EventGrid.SelectedItem);
            List <Member>     selectedMembers = new List <Member>();
            List <Attendance> pays            = new List <Attendance>();

            for (int i = 0; i < MemberDataGrid.Items.Count - 1; i++)
            {
                var       item = MemberDataGrid.Items[i];
                var       payStatusCheckbox = MemberDataGrid.Columns[checkBoxColum].GetCellContent(item) as CheckBox;
                var       stg      = MemberDataGrid.Columns[0].GetCellContent(item) as TextBlock;
                TextBlock Id_block = MemberDataGrid.Columns[0].GetCellContent(item) as TextBlock;
                long      Id       = Convert.ToInt64(Id_block.Text);
                if ((bool)payStatusCheckbox.IsChecked)
                {
                    Member member = _context.Members.FirstOrDefault(m => m.Id == Id);
                    member.AttendStatus = true;
                    Attendance.MemberId = member.Id;
                    Attendance.EventId  = eve.Id;
                    _context.Attendances.Add(Attendance);
                    _context.Entry(member).State = System.Data.Entity.EntityState.Modified;
                    _context.SaveChanges();
                }
            }
            foreach (Member member in members)
            {
                if (member.AttendStatus == false)
                {
                    member.Debit += eve.Fin;
                    _context.Entry(member).State = System.Data.Entity.EntityState.Modified;
                    _context.SaveChanges();
                }
            }
        }