示例#1
0
        public override void Delete(long objectId)
        {
            using (IDAL dal = this.DAL)
            {
                dal.BeginTransaction();
                try
                {
                    // Get processInstanceNo of the sugggestion
                    var processInstance = dal.Read <OverStoreTask>(objectId).ProcessInstance;

                    // Delete via DAL
                    dal.Delete <OverStoreTask>(objectId);

                    // Kill process via ProcessOperations
                    if (processInstance != null)
                    {
                        ProcessOperations processOperations = new ProcessOperations(OTApplication.Context.User.Id);
                        processOperations.Cancel(processInstance.Value);
                    }

                    dal.CommitTransaction();
                }
                catch
                {
                    dal.RollbackTransaction();
                    throw;
                }
            }
        }
示例#2
0
        public override void Delete(long objectId)
        {
            using (IDAL dal = this.DAL)
            {
                dal.BeginTransaction();
                try
                {
                    ProductionOrder po = dal.Read <ProductionOrder>(objectId);

                    // Kill process via ProcessOperations
                    if (po.ProcessInstance != null)
                    {
                        ProcessOperations processOperations = new ProcessOperations(OTApplication.Context.User.Id);
                        if (processOperations.GetInstanceStatus(po.ProcessInstance.Value) != Overtech.Core.BPM.InstanceStatus.Canceled)
                        {
                            try
                            {
                                processOperations.Cancel(po.ProcessInstance.Value);
                            }
                            catch
                            {
                                throw;
                            }
                        }
                    }
                    dal.Delete <ProductionOrder>(objectId);
                    dal.CommitTransaction();
                }
                catch
                {
                    dal.RollbackTransaction();
                    throw;
                }
            }
        }
示例#3
0
        public override void Delete(long objectId)
        {
            using (IDAL dal = this.DAL)
            {
                dal.BeginTransaction();
                try
                {
                    // Get processInstanceNo of the sugggestion
                    var processInstance = dal.Read <TransferProduct>(objectId).ProcessInstance;

                    // Delete via DAL
                    TransferProduct tp = Read(objectId, dal);
                    foreach (TransferProductDetail td in tp.TransferDetails)
                    {
                        dal.Delete <TransferProductDetail>(td.TransferProductDetailId);
                    }
                    dal.Delete <TransferProduct>(objectId);

                    // Delete Mikro Records, if status is completed
                    if (tp.TransferStatus == 5)
                    {
                        IUniParameter prmTransferProduct = dal.CreateParameter("TransferProductId", objectId);
                        dal.ExecuteNonQuery("WHS_DEL_WAYBILLBYTRANSFERPRODUCTID_SP", prmTransferProduct);
                    }

                    // Kill process via ProcessOperations (other then already completed processes)
                    if (processInstance != null & tp.TransferStatus < 5)
                    {
                        ProcessOperations processOperations = new ProcessOperations(OTApplication.Context.User.Id);
                        processOperations.Cancel(processInstance.Value);
                    }

                    dal.CommitTransaction();
                }
                catch (Exception ex)
                {
                    dal.RollbackTransaction();
                    throw ex;
                }
            }
        }
示例#4
0
        public void DeleteNotificationUsers(IEnumerable <DataModels.Announcement.NotificationUser> notificationUsers, IDAL dal)
        {
            foreach (DataModels.Announcement.NotificationUser notUser in notificationUsers)
            {
                // Kill process via ProcessOperations
                if (notUser.ProcessInstance != null)
                {
                    ProcessOperations processOperations = new ProcessOperations(OTApplication.Context.User.Id);
                    if (processOperations.GetInstanceStatus(notUser.ProcessInstance.Value) != Overtech.Core.BPM.InstanceStatus.Canceled)
                    {
                        try
                        {
                            processOperations.Cancel(notUser.ProcessInstance.Value);
                        }
                        catch {}
                    }
                }

                // Delete NotificationUser
                IUniParameter prmNotification = dal.CreateParameter("Notification", notUser.Notification);
                IUniParameter prmUser         = dal.CreateParameter("User", notUser.User);
                dal.ExecuteNonQuery("ANN_DEL_NOTIFICATIONUSER_SP", prmNotification, prmUser);
            }
        }