private void Button_Click(object sender, RoutedEventArgs e) { foreach (Member member in members) { member.AttendStatus = false; _context.Entry(member).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); } }
public void returner() { mahiber.EventFin = Convert.ToInt64(EventFin.Text); mahiber.FirstFin = Convert.ToInt64(FirstFin.Text); mahiber.SecondFin = Convert.ToInt64(SecondFin.Text); mahiber.LastFin = Convert.ToInt64(FinalFin.Text); mahiber.PaymentFin = Convert.ToInt64(PaymentFin.Text); mahiber.CreationDate = DateTime.Now.Date; _context.Abouts.Add(mahiber); _context.SaveChanges(); }
private void EditBtn_Click(object sender, RoutedEventArgs e) { try { Rule Selected = ((Rule)RulesGrid.SelectedItem); RuleName.Text = Selected.Name.ToString(); Description.Text = Selected.Description.ToString(); FirstFin.Text = Selected.FirstFin.ToString(); SecondFin.Text = Selected.SecondFin.ToString(); FinalFin.Text = Selected.LastFin.ToString(); _context.Entry(Selected).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); } catch (Exception) { } }
private void OkButton_Click(object sender, RoutedEventArgs e) { _context.Entry(Selected).State = System.Data.Entity.EntityState.Deleted; _context.SaveChanges(); SuccessMessage sm = new SuccessMessage(); sm.MessageText.Text = "Deleted Successfully"; this.Hide(); sm.Show(); }
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) { } }
private void Button_Click(object sender, RoutedEventArgs e) { if (Account.Password == PasswordBox.ToString()) { if (NewPass.ToString() == Confirm.ToString()) { Account.Password = NewPass.Password; _context.Entry(Account).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); SuccessMessage sm = new SuccessMessage(); sm.MessageText.Text = "Password Changed"; sm.Show(); } } }
private void Button_Click(object sender, RoutedEventArgs e) { if (AccountRole == 1) { admins.RoleId = Convert.ToInt64(RoleId.SelectedIndex); admins.Username = Username.Text.Trim(); admins.Password = PasswordBox.Password; _context.UserAccounts.Add(admins); _context.SaveChanges(); SuccessMessage Sm = new SuccessMessage(); Sm.MessageText.Text = "Admin Added Successfully"; Sm.Show(); } else { ErrorMessage Sm = new ErrorMessage(); Sm.MessageText.Text = "Access Denied"; Sm.Show(); } }
private void CreateRoleBtn_Click(object sender, RoutedEventArgs e) { role.Name = RoleName.Text.Trim(); role.Description = Description.Text.ToString(); role.EventPrivilage = role.PaymentPrivilage = role.SuperAdminPrivilage = role.MemberPrivilage = false; if (MemberPrivilage.IsChecked.GetValueOrDefault()) { role.MemberPrivilage = true; } if (EventPrivilage.IsChecked.GetValueOrDefault()) { role.EventPrivilage = true; } if (PaymentPrivilage.IsChecked.GetValueOrDefault()) { role.PaymentPrivilage = true; } role.RoleCreationDate = DateTime.Now.Date; _context.Roles.Add(role); _context.SaveChanges(); }
private void UpdateBtn_Click(object sender, RoutedEventArgs e) { member = ((Member)MemGrid.SelectedItem); try { member.FirstName = MemName.Text.Trim(); member.LastName = MemLastName.Text.Trim(); member.PhoneNumber = Convert.ToInt64(Phone.Text); member.Kebele = Convert.ToInt64(Kebele.Text); member.Woreda = Convert.ToInt64(Woreda.Text); if (MarriageStat.IsChecked.GetValueOrDefault()) { member.SpouseName = MemSpouseName.Text.Trim(); member.MariageStatus = true; } else { member.MariageStatus = false; } if (GenderBtn.IsChecked.GetValueOrDefault()) { member.Gender = "male"; } else { member.Gender = "female"; } SelectedSubcity = Subcity.SelectedIndex; if (SelectedSubcity == 0) { member.SubCity = "Arada"; } else if (SelectedSubcity == 1) { member.SubCity = "Akaki/Kality"; } else if (SelectedSubcity == 2) { member.SubCity = "Bole"; } else if (SelectedSubcity == 3) { member.SubCity = "Kolfe Keraniyo"; } else if (SelectedSubcity == 4) { member.SubCity = "Yeka"; } else if (SelectedSubcity == 5) { member.SubCity = "Gulele"; } else if (SelectedSubcity == 6) { member.SubCity = "Ledeta"; } else if (SelectedSubcity == 7) { member.SubCity = "Nefas Silk"; } else if (SelectedSubcity == 8) { member.SubCity = "Kirkos"; } else if (SelectedSubcity == 9) { member.SubCity = "Addis Ketema"; } member.Debit = 0; member.HouseNummber = HouseNum.Text.Trim(); _context.Entry(member).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); } catch (Exception) { } }