public ResultOperation Add(sysBpmsThread thread)
        {
            thread.Number          = this.CalculateSerlialNumber(this.UnitOfWork.Repository <IThreadRepository>().MaxNumber() + 1);
            thread.FormattedNumber = this.CalculateFormatNumber(thread.Number.Value, DateTime.Now.Date);
            ResultOperation resultOperation = new ThreadService(base.UnitOfWork).Add(thread);

            return(resultOperation);
        }
Esempio n. 2
0
        public void Delete(Guid ID)
        {
            sysBpmsThread sysBpmsThread1 = this.Context.sysBpmsThreads.FirstOrDefault(d => d.ID == ID);

            if (sysBpmsThread1 != null)
            {
                this.Context.sysBpmsThreads.Remove(sysBpmsThread1);
            }
        }
Esempio n. 3
0
        public sysBpmsThread GetInfo(Guid ID, string[] includes)
        {
            sysBpmsThread retVal = null;

            retVal = (from P in this.Context.sysBpmsThreads
                      where P.ID == ID
                      select P).Include(includes).AsNoTracking().FirstOrDefault();
            return(retVal);
        }
        public ResultOperation DoneThread(Guid threadID)
        {
            sysBpmsThread thread = this.GetInfo(threadID);

            thread.EndDate  = DateTime.Now;
            thread.StatusLU = (int)sysBpmsThread.Enum_StatusLU.Done;
            ResultOperation resultOperation = this.Update(thread);

            resultOperation.CurrentObject = thread;
            return(resultOperation);
        }
        public ResultOperation Add(sysBpmsThread thread)
        {
            ResultOperation resultOperation = new ResultOperation();

            if (resultOperation.IsSuccess)
            {
                this.UnitOfWork.Repository <IThreadRepository>().Add(thread);
                this.UnitOfWork.Save();
            }
            return(resultOperation);
        }
Esempio n. 6
0
        public void Update(sysBpmsThread thread)
        {
            //To fix 'Attaching an entity failed' error.
            var local = this.Context.Set <sysBpmsThread>().Local.FirstOrDefault(f => f.ID == thread.ID);

            if (local != null)
            {
                this.Context.Entry(local).State = EntityState.Detached;
                local = null;
            }
            this.Context.Entry(thread.Clone()).State = EntityState.Modified;
        }
        public ResultOperation Update(sysBpmsThread thread)
        {
            ResultOperation resultOperation = new ResultOperation();

            if (resultOperation.IsSuccess)
            {
                thread.GatewayStatusXml = thread.GatewayStatus.BuildXml();
                this.UnitOfWork.Repository <IThreadRepository>().Update(thread);
                this.UnitOfWork.Save();
            }
            return(resultOperation);
        }
Esempio n. 8
0
 public ThreadDTO(sysBpmsThread thread)
 {
     if (thread != null)
     {
         this.ID              = thread.ID;
         this.ProcessID       = thread.ProcessID;
         this.UserID          = thread.UserID;
         this.StartDate       = thread.StartDate;
         this.EndDate         = thread.EndDate;
         this.Number          = thread.Number;
         this.FormattedNumber = thread.FormattedNumber;
         this.StatusLU        = thread.StatusLU;
         this.User            = thread.UserID.HasValue ? (thread.User != null ? new UserDTO(thread.User) : new UserDTO(new UserService().GetInfo(this.UserID.Value))) : new UserDTO();
         this.Process         = new ProcessDTO(thread.Process);
     }
 }
        /// <param name="gatewayId">is gateway ID which is Guid</param>
        public ResultOperation AddGatewayStatusXml(sysBpmsThread thread, Guid gatewayId, Guid joinFromSequenceFlowID)
        {
            if (!thread.GatewayStatus.Any(c => c.GatewayID.ToGuidObj() == gatewayId))
            {
                thread.GatewayStatus.Add(new ThreadGatewayStatusXmlModel()
                {
                    GatewayID = gatewayId, List = new List <GatewayJoinSequencrXmlModel>()
                });
            }

            thread.GatewayStatus.FirstOrDefault(c => c.GatewayID == gatewayId).List.Add(new GatewayJoinSequencrXmlModel()
            {
                Done = true, SequenceFlowID = joinFromSequenceFlowID
            });

            return(this.Update(thread));
        }
Esempio n. 10
0
 public ThreadDetailDTO(sysBpmsThread thread, List <ThreadHistoryDTO> listThreadHistory)
 {
     if (thread != null)
     {
         this.ID                = thread.ID;
         this.ProcessID         = thread.ProcessID;
         this.UserID            = thread.UserID;
         this.StartDate         = thread.StartDate;
         this.EndDate           = thread.EndDate;
         this.Number            = thread.Number;
         this.FormattedNumber   = thread.FormattedNumber;
         this.StatusLU          = thread.StatusLU;
         this.User              = thread.UserID.HasValue ? (thread.User != null ? new UserDTO(thread.User) : new UserDTO(new UserService().GetInfo(this.UserID.Value))) : new UserDTO();
         this.Process           = new ProcessDTO(thread.Process);
         this.ListThreadHistory = listThreadHistory;
         this.ListOverviewForms = new List <EngineFormModel>();
     }
 }
Esempio n. 11
0
 public void Add(sysBpmsThread thread)
 {
     thread.ID = Guid.NewGuid();
     this.Context.sysBpmsThreads.Add(thread);
 }
 public ResultOperation ClearGatewayStatusXml(sysBpmsThread thread, Guid gatewayId)
 {
     thread.GatewayStatus.FirstOrDefault(c => c.GatewayID == gatewayId)?.List?.Clear();
     return(this.Update(thread));
 }