Exemplo n.º 1
0
        private void Delete_Child_Click(object sender, RoutedEventArgs e)
        {
            DeleteChild delete_Child = new DeleteChild();

            delete_Child.ShowDialog();
            Close();
        }
        public ActionResult DeleteConfirmed(DeleteChild model)
        {
            model.Child = db.Children.Find(model.DeleteModelID);
            int    tipstaffRecordID = model.Child.tipstaffRecordID;
            string controller       = genericFunctions.TypeOfTipstaffRecord(tipstaffRecordID);

            db.Children.Remove(model.Child);
            db.SaveChanges();
            //get the Audit Event we just created
            string     recDeleted = model.DeleteModelID.ToString();
            AuditEvent AE         = db.AuditEvents.Where(a => a.auditEventDescription.AuditDescription == "Child deleted" && a.RecordChanged == recDeleted).OrderByDescending(a => a.EventDate).Take(1).Single();

            //add a deleted reason
            AE.DeletedReasonID = model.DeletedReasonID;
            //and save again
            db.SaveChanges();
            return(RedirectToAction("Details", controller, new { id = tipstaffRecordID }));
        }
        public ActionResult Delete(int id)
        {
            DeleteChild model = new DeleteChild(id);

            if (model.Child == null)
            {
                ErrorModel errModel = new ErrorModel(2);
                errModel.ErrorMessage  = string.Format("Child record: {0} has been deleted, please raise a help desk call if you think this has been deleted in error.", id);
                TempData["ErrorModel"] = errModel;
                return(RedirectToAction("IndexByModel", "Error", new { area = "", model = errModel ?? null }));
            }
            if (model.Child.childAbduction.caseStatus.sequence > 3)
            {
                TempData["UID"] = model.Child.childAbduction.UniqueRecordID;
                return(RedirectToAction("ClosedFile", "Error"));
            }

            return(View(model));
        }
Exemplo n.º 4
0
        public unsafe void DeleteChild(string name)
        {
            // 1) Find children TS.
            ulong childTS = 0;
            Block block   = journal.ReadService.Read(BlockType.NodeHeaderBlock, commonAddress);

            fixed(byte *p = block.Data)
            {
                NodeCommonHeader *header = (NodeCommonHeader *)p;

                childTS = header->ChildrenBTree;
            }

            // 2) Find child.
            BPlusTree   tree         = new BPlusTree(childTS);
            ObjectInfo  info         = tree.Find(journal.ReadService, (uint)name.GetHashCode());
            BlockStream stream       = BlockStream.FromBase(info.Address, journal.ReadService);
            ChildTag    tag          = Common.DeserializeFromArray(stream.Read(info.Size)) as ChildTag;
            ulong?      childAddress = tag.Find(name);

            // Execute operation
            Operations.DeleteChild deleteChild = new DeleteChild(childAddress.Value, childTS, name);
            journal.Execute(deleteChild);
        }