示例#1
0
        /// <summary>
        /// creates a new <see cref="DatabaseWorkflowService"/>
        /// </summary>
        /// <param name="database">access to database</param>
        /// <param name="archiveservice">access to data archives</param>
        public DatabaseWorkflowService(IEntityManager database, IArchiveService archiveservice)
        {
            this.database       = database;
            this.archiveservice = archiveservice;
            database.UpdateSchema <Workflow>();
            database.UpdateSchema <WorkflowNode>();
            database.UpdateSchema <WorkflowTransition>();

            insertworkflow = database.Insert <Workflow>().Columns(w => w.Revision, w => w.Name, w => w.Language)
                             .ReturnID()
                             .Prepare();
            updateworkflow = database.Update <Workflow>()
                             .Set(w => w.Revision == w.Revision + 1, w => w.Name == DBParameter.String, w => w.Language == DBParameter <ScriptLanguage?> .Value)
                             .Where(w => w.Id == DBParameter.Int64)
                             .Prepare();

            deletetransitions = database.Delete <WorkflowTransition>().Where(t => t.WorkflowId == DBParameter.Int64).Prepare();
            deletenodes       = database.Delete <WorkflowNode>().Where(n => n.WorkflowId == DBParameter.Int64).Prepare();
            deleteworkflow    = database.Delete <Workflow>().Where(w => w.Id == DBParameter.Int64).Prepare();

            loadworkflowbyid   = database.Load <Workflow>().Where(w => w.Id == DBParameter.Int64).Prepare();
            loadworkflowbyname = database.Load <Workflow>().Where(w => w.Name == DBParameter.String).Prepare();

            loadnodes        = database.Load <WorkflowNode>(n => n.Id, n => n.Name, n => n.Group, n => n.Type, n => n.Parameters, n => n.Variable).Where(n => n.WorkflowId == DBParameter.Int64).Prepare();
            loadtransitions  = database.Load <WorkflowTransition>(t => t.OriginId, t => t.TargetId, t => t.Condition, t => t.Type, t => t.Log).Where(t => t.WorkflowId == DBParameter.Int64).Prepare();
            insertnode       = database.Insert <WorkflowNode>().Columns(n => n.Id, n => n.WorkflowId, n => n.Name, n => n.Type, n => n.Parameters, n => n.Group, n => n.Variable).Prepare();
            inserttransition = database.Insert <WorkflowTransition>().Columns(t => t.WorkflowId, t => t.OriginId, t => t.TargetId, t => t.Condition, t => t.Type, t => t.Log).Prepare();
        }
示例#2
0
        public ActionResult DeleteConfirm(int id)
        {
            Member member = MemberManager.Find(x => x.Id == id);

            MemberManager.Delete(member);

            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirm(int id)
        {
            TEntity entity = manager.Find(x => x.Id == id);

            manager.Delete(entity);

            return(RedirectToAction(nameof(Index)));
        }
示例#4
0
 /// <summary>
 /// creates a new <see cref="DatabaseScriptService"/>
 /// </summary>
 /// <param name="database">access to database</param>
 /// <param name="archiveservice">access to object archive</param>
 public DatabaseScriptService(IEntityManager database, IArchiveService archiveservice)
 {
     this.database       = database;
     this.archiveservice = archiveservice;
     database.UpdateSchema <Script>();
     insertscript    = database.Insert <Script>().Columns(s => s.Revision, s => s.Name, s => s.Code, s => s.Language).ReturnID().Prepare();
     getscript       = database.Load <Script>().Where(s => s.Id == DBParameter.Int64).Prepare();
     getscriptbyname = database.Load <Script>().Where(s => s.Name == DBParameter.String).Prepare();
     deletescript    = database.Delete <Script>().Where(s => s.Id == DBParameter.Int64).Prepare();
 }
 /// <summary>
 /// creates a new <see cref="DatabaseScheduledTaskService"/>
 /// </summary>
 /// <param name="database"></param>
 public DatabaseScheduledTaskService(IEntityManager database)
 {
     this.database = database;
     database.UpdateSchema <ScheduledTask>();
     insert             = database.Insert <ScheduledTask>().Columns(t => t.Name, t => t.WorkableType, t => t.WorkableName, t => t.WorkableRevision, t => t.Target, t => t.Days, t => t.Interval).Prepare();
     delete             = database.Delete <ScheduledTask>().Where(t => t.Id == DBParameter.Int64).Prepare();
     loadbyid           = database.Load <ScheduledTask>().Where(t => t.Id == DBParameter.Int64).Prepare();
     updatescheduletime = database.Update <ScheduledTask>().Set(t => t.Target == DBParameter <DateTime?> .Value).Where(t => t.Id == DBParameter.Int64).Prepare();
     updateexecution    = database.Update <ScheduledTask>().Set(t => t.LastExecution == DBParameter <DateTime?> .Value, t => t.Target == DBParameter <DateTime?> .Value).Where(t => t.Id == DBParameter.Int64).Prepare();
 }
示例#6
0
        /// <summary>
        /// Manages the addition of database object
        /// to database(for now files as xml and json serve as database)
        /// </summary>
        /// <typeparam name="DataElementType">Type of element </typeparam>
        /// <param name="element">Database object that was added to diagram(business logic representation of it)</param>
        public void Delete <DataElementType>(DataElementType element)
        {
            var nameProperty = element.GetType().GetProperty("Name");

            if (!sltEntities.ContainsKey(nameProperty.GetValue(element).ToString()))
            {
                return;
            }
            IEntityManager em = sltEntities[nameProperty.GetValue(element).ToString()];

            SetFormatToDefault();
            em.Delete(element);
        }
示例#7
0
 public IActionResult Delete(int id)
 {
     _entityManager.Delete(id);
     return(RedirectToAction("List"));
 }
示例#8
0
        public virtual void Delete(int id)
        {
            var entity = Manager.Load(id);

            Manager.Delete(entity);
        }
示例#9
0
 public void Delete(T entity)
 {
     em.Delete(entity);
 }