protected virtual void FSWFStage_RowInserting(PXCache sender, PXRowInsertingEventArgs e)
        {
            FSWFStage fsWFStageRow = e.Row as FSWFStage;

            if (fsWFStageRow != null && Filter.Current != null)
            {
                IEnumerable list = items(NodeFilter.Current.ParentWFStageID);

                int maxSequence = 0;
                foreach (PXResult <FSWFStage> bqlResult in list)
                {
                    FSWFStage fsWFStageRow_Item = (FSWFStage)bqlResult;

                    if (fsWFStageRow_Item.SortOrder.Value > maxSequence)
                    {
                        maxSequence = fsWFStageRow_Item.SortOrder.Value;
                    }
                }

                fsWFStageRow.SortOrder       = maxSequence + 1;
                fsWFStageRow.ParentWFStageID = NodeFilter.Current.ParentWFStageID;
                fsWFStageRow.WFStageCD       = fsWFStageRow.WFStageCD.Trim();
                fsWFStageRow.WFID            = Filter.Current.WFID;

                string strErrMess = ValidateItemName(fsWFStageRow.WFStageCD, fsWFStageRow.ParentWFStageID);
                if (strErrMess != string.Empty)
                {
                    sender.RaiseExceptionHandling <FSWFStage.wFStageCD>(e.Row, fsWFStageRow.WFStageCD, new PXSetPropertyException(strErrMess, PXErrorLevel.Error));
                    e.Cancel = true;
                }
            }
        }
Exemplo n.º 2
0
        protected virtual void _(Events.RowUpdating <FSWFStage> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSWFStage fsWFStageRow_New = (FSWFStage)e.NewRow;
            FSWFStage fsWFStageRow_Old = (FSWFStage)e.Row;
            PXCache   cache            = e.Cache;

            if (fsWFStageRow_New.SortOrder != fsWFStageRow_Old.SortOrder && e.ExternalCall)
            {
                if (fsWFStageRow_Old.SortOrder < fsWFStageRow_New.SortOrder)
                {
                    UpdateSequence(cache, fsWFStageRow_New, fsWFStageRow_Old.SortOrder + 1, fsWFStageRow_New.SortOrder, -1);
                }
                else
                {
                    UpdateSequence(cache, fsWFStageRow_New, fsWFStageRow_New.SortOrder, fsWFStageRow_Old.SortOrder, +1);
                }

                this.Filter.View.RequestRefresh();
            }
        }
Exemplo n.º 3
0
        public virtual string ValidateItemName(string name, int?parentSSID)
        {
            FSWFStage fsWFStageRow = PXSelect <FSWFStage,
                                               Where <
                                                   FSWFStage.wFID, Equal <Current <WFStageFilter.wFID> >,
                                                   And <FSWFStage.wFStageCD, Equal <Required <FSWFStage.wFStageCD> >,
                                                        And <FSWFStage.parentWFStageID, Equal <Required <FSWFStage.parentWFStageID> > > > > >
                                     .Select(this, name, parentSSID);

            if (fsWFStageRow != null)
            {
                return(TX.Error.ID_ALREADY_USED_SAME_LEVEL);
            }

            FSWFStage fsWFStageRow_Parent = PXSelect <FSWFStage,
                                                      Where <
                                                          FSWFStage.wFID, Equal <Current <WFStageFilter.wFID> >,
                                                          And <FSWFStage.wFStageCD, Equal <Required <FSWFStage.wFStageCD> >,
                                                               And <FSWFStage.wFStageID, Equal <Required <FSWFStage.parentWFStageID> > > > > >
                                            .Select(this, name, parentSSID);

            if (fsWFStageRow_Parent != null)
            {
                return(TX.Error.ID_ALREADY_USED_PARENT);
            }

            return(string.Empty);
        }
Exemplo n.º 4
0
        public static void EnableDisableActionsByWorkflowStage(PXCache cache,
                                                               FSWFStage fsWFStageRow,
                                                               PXAction actionComplete,
                                                               PXAction actionCancel,
                                                               PXAction actionClose,
                                                               PXAction actionReopen)
        {
            if (fsWFStageRow == null)
            {
                return;
            }

            if (fsWFStageRow.AllowComplete == false)
            {
                actionComplete?.SetEnabled(fsWFStageRow.AllowComplete.Value);
            }

            if (fsWFStageRow.AllowCancel == false)
            {
                actionCancel?.SetEnabled(fsWFStageRow.AllowCancel.Value);
            }

            if (fsWFStageRow.AllowClose == false)
            {
                actionClose?.SetEnabled(fsWFStageRow.AllowClose.Value);
            }

            if (fsWFStageRow.AllowReopen == false)
            {
                actionReopen?.SetEnabled(fsWFStageRow.AllowReopen.Value);
            }

            cache.AllowDelete &= (bool)fsWFStageRow.AllowDelete;
        }
        protected virtual void FSWFStage_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
        {
            FSWFStage fsWFStageRow = e.Row as FSWFStage;

            if (fsWFStageRow != null && Filter.Current != null)
            {
                NodeFilter.Current.ParentWFStageID = fsWFStageRow.ParentWFStageID;
            }
        }
        protected virtual void FSWFStage_RowPersisted(PXCache sender, PXRowPersistedEventArgs e)
        {
            FSWFStage fsWFStageRow = (FSWFStage)e.Row;

            if (fsWFStageRow == fsWFStageRow_Current && e.TranStatus == PXTranStatus.Completed)
            {
                NodeFilter.Current.WFID      = fsWFStageRow.WFID;
                NodeFilter.Current.WFStageID = fsWFStageRow.WFStageID;
            }
        }
        protected virtual void FSWFStage_RowDeleted(PXCache cache, PXRowDeletedEventArgs e)
        {
            FSWFStage fsWFStageRow = e.Row as FSWFStage;

            if (fsWFStageRow == null || fsWFStageRow.WFStageID == null)
            {
                return;
            }

            deleteRecurring(fsWFStageRow);
        }
Exemplo n.º 8
0
        private static void EnableDisableActions(PXCache cache,
                                                 FSWFStage fsWFStageRow,
                                                 Dictionary <string, PXAction> headerActions)
        {
            PXAction completeAction, closeAction, cancelAction, reopenAction;

            headerActions.TryGetValue(typeof(FSWFStage.allowComplete).Name, out completeAction);
            headerActions.TryGetValue(typeof(FSWFStage.allowClose).Name, out closeAction);
            headerActions.TryGetValue(typeof(FSWFStage.allowCancel).Name, out cancelAction);
            headerActions.TryGetValue(typeof(FSWFStage.allowReopen).Name, out reopenAction);

            EnableDisableActionsByWorkflowStage(cache, fsWFStageRow, completeAction, cancelAction, closeAction, reopenAction);
        }
Exemplo n.º 9
0
 public virtual void UpdateSequence(PXCache sender, FSWFStage fsWFStageRow_Route, int?from, int?to, int step)
 {
     foreach (FSWFStage fsWFStageRow
              in PXSelect <FSWFStage,
                           Where <
                               FSWFStage.wFID, Equal <Required <FSWFStage.wFID> >,
                               And <FSWFStage.wFStageID, NotEqual <Required <FSWFStage.wFStageID> >,
                                    And <FSWFStage.sortOrder, Between <Required <FSWFStage.sortOrder>, Required <FSWFStage.sortOrder> > > > > >
              .Select(this, fsWFStageRow_Route.WFID, fsWFStageRow_Route.WFStageID, from, to))
     {
         fsWFStageRow.SortOrder += step;
     }
 }
Exemplo n.º 10
0
        protected virtual void _(Events.RowInserted <FSWFStage> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSWFStage fsWFStageRow = e.Row as FSWFStage;

            if (fsWFStageRow != null && Filter.Current != null)
            {
                NodeFilter.Current.ParentWFStageID = fsWFStageRow.ParentWFStageID;
            }
        }
Exemplo n.º 11
0
        protected virtual void _(Events.RowPersisted <FSWFStage> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSWFStage fsWFStageRow = (FSWFStage)e.Row;

            if (fsWFStageRow == fsWFStageRow_Current && e.TranStatus == PXTranStatus.Completed)
            {
                NodeFilter.Current.WFID      = fsWFStageRow.WFID;
                NodeFilter.Current.WFStageID = fsWFStageRow.WFStageID;
            }
        }
Exemplo n.º 12
0
        public virtual void deleteRecurring(FSWFStage fsWFStageRow)
        {
            if (fsWFStageRow != null)
            {
                foreach (FSWFStage child in PXSelect <FSWFStage,
                                                      Where <
                                                          FSWFStage.wFID, Equal <Current <WFStageFilter.wFID> >,
                                                          And <FSWFStage.parentWFStageID, Equal <Required <FSWFStage.wFStageID> > > > >
                         .Select(this, fsWFStageRow.WFStageID))
                {
                    deleteRecurring(child);
                }

                Items.Cache.Delete(fsWFStageRow);
            }
        }
Exemplo n.º 13
0
        protected virtual void _(Events.RowDeleted <FSWFStage> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSWFStage fsWFStageRow = e.Row as FSWFStage;

            if (fsWFStageRow == null || fsWFStageRow.WFStageID == null)
            {
                return;
            }

            deleteRecurring(fsWFStageRow);
        }
        protected virtual void FSWFStage_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            FSWFStage fsWFStageRow = e.Row as FSWFStage;

            if (fsWFStageRow == null)
            {
                return;
            }

            if (e.Operation == PXDBOperation.Insert &&
                NodeFilter.Current.WFID == fsWFStageRow.WFID &&
                (NodeFilter.Current.ParentWFStageID == fsWFStageRow.WFStageID ||
                 NodeFilter.Current.ParentWFStageID == null))
            {
                fsWFStageRow_Current = fsWFStageRow;
            }
        }
        protected virtual void FSWFStage_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            FSWFStage fsWFStageRow_New = (FSWFStage)e.NewRow;
            FSWFStage fsWFStageRow_Old = (FSWFStage)e.Row;

            if (fsWFStageRow_New.SortOrder != fsWFStageRow_Old.SortOrder && e.ExternalCall)
            {
                if (fsWFStageRow_Old.SortOrder < fsWFStageRow_New.SortOrder)
                {
                    UpdateSequence(sender, fsWFStageRow_New, fsWFStageRow_Old.SortOrder + 1, fsWFStageRow_New.SortOrder, -1);
                }
                else
                {
                    UpdateSequence(sender, fsWFStageRow_New, fsWFStageRow_New.SortOrder, fsWFStageRow_Old.SortOrder, +1);
                }

                this.Filter.View.RequestRefresh();
            }
        }
Exemplo n.º 16
0
        public static void EnableDisableDocumentByWorkflowStage(FSWFStage fsWFStageRow,
                                                                List <PXCache> caches,
                                                                Dictionary <string, PXAction> headerActions,
                                                                List <PXAction> detailsActions,
                                                                List <PXView> views)
        {
            if (fsWFStageRow == null)
            {
                return;
            }

            bool   allowUpdate = fsWFStageRow.AllowModify.Value;
            string wfsFieldName;

            foreach (PXCache cache in caches)
            {
                EnableDisableActions(cache, fsWFStageRow, headerActions);
                wfsFieldName = cache.GetItemType().IsAssignableFrom(typeof(FSAppointment)) ? typeof(FSAppointment.wFStageID).Name : typeof(FSServiceOrder.wFStageID).Name;

                if (allowUpdate == false)
                {
                    foreach (Type field in cache.BqlFields)
                    {
                        if (!cache.BqlKeys.Contains(field) && field.Name != wfsFieldName)
                        {
                            PXUIFieldAttribute.SetEnabled(cache, cache.Current, field.Name, allowUpdate);
                        }
                    }
                }
            }

            foreach (PXAction action in detailsActions)
            {
                action.SetEnabled(allowUpdate && action.GetEnabled());
            }

            foreach (PXView view in views)
            {
                view.AllowInsert = allowUpdate;
                view.AllowUpdate = allowUpdate;
                view.AllowDelete = allowUpdate;
            }
        }
Exemplo n.º 17
0
        public static void EnableDisableActionsByWorkflowStage(
            PXCache cache,
            FSWFStage fsWFStageRow,
            PXAction actionComplete,
            PXAction actionCancel,
            PXAction actionClose,
            PXAction actionReopen)
        {
            if (fsWFStageRow == null)
            {
                return;
            }

            if (fsWFStageRow == null)
            {
                return;
            }

            if (actionComplete != null && fsWFStageRow.AllowComplete == false)
            {
                actionComplete.SetEnabled(false);
            }

            if (actionCancel != null && fsWFStageRow.AllowCancel == false)
            {
                actionCancel.SetEnabled(false);
            }

            if (actionClose != null && fsWFStageRow.AllowClose == false)
            {
                actionClose.SetEnabled(false);
            }

            if (actionReopen != null && fsWFStageRow.AllowReopen == false)
            {
                actionReopen.SetEnabled(false);
            }

            cache.AllowUpdate &= (bool)fsWFStageRow.AllowModify;
            cache.AllowDelete &= (bool)fsWFStageRow.AllowDelete;
        }
Exemplo n.º 18
0
        protected virtual IEnumerable nodes([PXInt] int?parent)
        {
            List <FSWFStage> list = new List <FSWFStage>();

            if (!parent.HasValue)
            {
                FSWFStage fsWFStageRow = new FSWFStage();
                fsWFStageRow.WFStageID = RootNodeID;
                fsWFStageRow.WFID      = NodeFilter.Current.WFID;

                FSSrvOrdType fsSrvOrdTypeRow = PXSelect <FSSrvOrdType,
                                                         Where <
                                                             FSSrvOrdType.srvOrdTypeID, Equal <Required <FSSrvOrdType.srvOrdTypeID> > > >
                                               .Select(this, fsWFStageRow.WFID);

                if (fsSrvOrdTypeRow != null)
                {
                    fsWFStageRow.WFStageCD = fsSrvOrdTypeRow.SrvOrdType;
                    list.Add(fsWFStageRow);
                }
            }
            else
            {
                PXResultset <FSWFStage> bqlResultSet;

                bqlResultSet = PXSelect <FSWFStage,
                                         Where <
                                             FSWFStage.wFID, Equal <Current <SelectedNode.wFID> >,
                                             And <FSWFStage.parentWFStageID, Equal <Required <FSWFStage.parentWFStageID> > > > >
                               .Select(this, parent);

                foreach (FSWFStage fsWFStageRow in bqlResultSet)
                {
                    list.Add(fsWFStageRow);
                }
            }

            return(list);
        }
Exemplo n.º 19
0
        protected virtual void _(Events.RowPersisting <FSWFStage> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSWFStage fsWFStageRow = e.Row as FSWFStage;

            if (fsWFStageRow == null)
            {
                return;
            }

            if (e.Operation == PXDBOperation.Insert &&
                NodeFilter.Current.WFID == fsWFStageRow.WFID &&
                (NodeFilter.Current.ParentWFStageID == fsWFStageRow.WFStageID ||
                 NodeFilter.Current.ParentWFStageID == null))
            {
                fsWFStageRow_Current = fsWFStageRow;
            }
        }
 private static int Comparison(FSWFStage fsWFStageRow_X, FSWFStage fsWFStageRow_Y)
 {
     return(fsWFStageRow_X.SortOrder.Value.CompareTo(fsWFStageRow_Y.SortOrder.Value));
 }
Exemplo n.º 21
0
 public virtual int Comparison(FSWFStage fsWFStageRow_X, FSWFStage fsWFStageRow_Y)
 {
     return(fsWFStageRow_X.SortOrder.Value.CompareTo(fsWFStageRow_Y.SortOrder.Value));
 }