public bool remove(string c)
        {
            List <CaseHearingDate> list = db.CaseHearingDates.Where(x => x.CaseId == c).ToList();

            foreach (CaseHearingDate i in list)
            {
                db.CaseHearingDates.Remove(i);
            }
            return(db.SaveChanges() > 0);
        }
Beispiel #2
0
        public bool saveChangesToDB(Client x)
        {
            Client changeClient = db.Clients.FirstOrDefault(s => s.ClientId == x.ClientId);

            changeClient.ClientId      = x.ClientId;
            changeClient.ClientName    = x.ClientName;
            changeClient.ClientContact = x.ClientContact;
            changeClient.ClientFname   = x.ClientFname;
            changeClient.ClientAddress = x.ClientAddress;
            return(db.SaveChanges() > 0);
        }
Beispiel #3
0
        public bool deleteFromDB(UserAccount u)
        {
            MessageBoxResult result = 0;
            UserAccount      employee;

            employee = db.UserAccounts.Where(x => u.userId == x.userId).FirstOrDefault();
            db.UserAccounts.Remove(employee);
            try
            {
                return(db.SaveChanges() > 0);
            }
            catch (DbUpdateException e)
            {
                result = MessageBox.Show("You cannot delete this record because " +
                                         "Some Case records are associated this client ", "Information");
                return(false);
            }
        }
Beispiel #4
0
 public bool insertNewCase(Case c)
 {
     db.Cases.Add(c);
     return(db.SaveChanges() > 0);
 }
Beispiel #5
0
 public bool insertNewCourt(Court court)
 {
     db.Courts.Add(court);
     return(db.SaveChanges() > 0);
 }
Beispiel #6
0
 public void addNewRole(UserRole role)
 {
     db.UserRoles.Add(role);
     db.SaveChanges();
 }