예제 #1
0
    protected void Page_PreInit(object sender, EventArgs e)
    {
        WizardArticleMaint graph = PXGraph.CreateInstance <WizardArticleMaint>();

        if (!String.IsNullOrEmpty(this.Request.QueryString["TaskID"]))
        {
            Guid   id   = Guid.Parse(this.Request.QueryString["TaskID"]);
            WZTask task = PXSelect <WZTask, Where <WZTask.taskID, Equal <Required <WZTask.taskID> > > > .Select(graph, id);

            if (task != null && !String.IsNullOrEmpty(task.Name))
            {
                WZScenario scenario = PXSelect <WZScenario, Where <WZScenario.scenarioID, Equal <Required <WZScenario.scenarioID> > > > .Select(graph, task.ScenarioID);

                if (scenario != null)
                {
                    this.Master.ScreenTitle = scenario.Name + " - ";
                }
                this.Master.ScreenTitle += task.Name;
                if ((bool)task.IsOptional)
                {
                    this.Master.ScreenTitle += " (Optional)";
                }
            }
        }
    }
예제 #2
0
    protected void grid_RowDataBound(object sender, PXGridRowEventArgs e)
    {
        WZTask task = (WZTask)e.Row.DataItem;

        if (task.Offset != null && task.Offset > 0)
        {
            e.Row.Cells["Name"].Style.CssClass = "PropOffset" + task.Offset;
        }
    }
예제 #3
0
        public IEnumerable requestValidation(PXAdapter adapter)
        {
            foreach (FeaturesSet feature in adapter.Get())
            {
                if (feature.Status == 3)
                {
                    bool?       customerDiscountsOld = PXAccess.FeatureInstalled <FeaturesSet.customerDiscounts>();
                    bool?       branchOld            = PXAccess.FeatureInstalled <FeaturesSet.branch>();
                    PXCache     cache  = new PXCache <FeaturesSet>(this);
                    FeaturesSet update = PXCache <FeaturesSet> .CreateCopy(feature);

                    update.Status = 0;
                    update        = this.Features.Update(update);
                    this.Features.Delete(feature);

                    if (update.Status != 1)
                    {
                        this.Features.Delete(new FeaturesSet()
                        {
                            Status = 1
                        });
                    }

                    this.Persist();
                    PXAccess.Version++;

                    var tasks = PXSelect <WZTask> .Select(this);

                    WZTaskEntry taskGraph = CreateInstance <WZTaskEntry>();
                    foreach (WZTask task in tasks)
                    {
                        bool disableTask = false;
                        bool enableTask  = false;
                        foreach (
                            WZTaskFeature taskFeature in
                            PXSelectReadonly <WZTaskFeature, Where <WZTaskFeature.taskID, Equal <Required <WZTask.taskID> > > > .Select(
                                this, task.TaskID))
                        {
                            bool featureInstalled = (bool?)cache.GetValue(update, taskFeature.Feature) == true;

                            if (!featureInstalled)
                            {
                                disableTask = true;
                                enableTask  = false;
                                break;
                            }

                            enableTask = true;
                        }

                        if (disableTask)
                        {
                            task.Status = WizardTaskStatusesAttribute._DISABLED;
                            taskGraph.TaskInfo.Update(task);
                            taskGraph.Save.Press();
                        }

                        if (enableTask && task.Status == WizardTaskStatusesAttribute._DISABLED)
                        {
                            bool       needToBeOpen = false;
                            WZScenario scenario     = PXSelect <WZScenario, Where <WZScenario.scenarioID, Equal <Required <WZTask.scenarioID> > > > .Select(this, task.ScenarioID);

                            if (scenario != null && scenario.Status == WizardScenarioStatusesAttribute._ACTIVE)
                            {
                                WZTask parentTask =
                                    PXSelect <WZTask, Where <WZTask.taskID, Equal <Required <WZTask.parentTaskID> > > > .Select(
                                        this, task.ParentTaskID);

                                if (parentTask != null && (parentTask.Status == WizardTaskStatusesAttribute._OPEN ||
                                                           parentTask.Status == WizardTaskStatusesAttribute._ACTIVE))
                                {
                                    needToBeOpen = true;
                                }

                                foreach (
                                    PXResult <WZTaskPredecessorRelation, WZTask> predecessorResult in
                                    PXSelectJoin <WZTaskPredecessorRelation,
                                                  InnerJoin
                                                  <WZTask,
                                                   On <WZTask.taskID, Equal <WZTaskPredecessorRelation.predecessorID> > >,
                                                  Where <WZTaskPredecessorRelation.taskID, Equal <Required <WZTask.taskID> > > > .
                                    Select(this, task.TaskID))
                                {
                                    WZTask predecessorTask = (WZTask)predecessorResult;
                                    if (predecessorTask != null)
                                    {
                                        if (predecessorTask.Status == WizardTaskStatusesAttribute._COMPLETED)
                                        {
                                            needToBeOpen = true;
                                        }
                                        else
                                        {
                                            needToBeOpen = false;
                                            break;
                                        }
                                    }
                                }
                            }
                            task.Status = needToBeOpen ? WizardTaskStatusesAttribute._OPEN : WizardTaskStatusesAttribute._PENDING;
                            taskGraph.TaskInfo.Update(task);
                            taskGraph.Save.Press();
                        }
                    }

                    if (customerDiscountsOld == true && update.CustomerDiscounts != true)
                    {
                        PXUpdate <Set <ARSetup.applyLineDiscountsIfCustomerPriceDefined, True>, ARSetup> .Update(this);

                        PXUpdate <Set <ARSetup.applyLineDiscountsIfCustomerClassPriceDefined, True>, ARSetup> .Update(this);

                        PXUpdate <Set <SOOrderType.recalculateDiscOnPartialShipment, False, Set <SOOrderType.postLineDiscSeparately, False> >, SOOrderType> .Update(this);
                    }

                    if (branchOld != update.Branch)
                    {
                        PXUpdate <Set <ListEntryPoint.isActive, Required <ListEntryPoint.isActive> >, ListEntryPoint,
                                  Where <ListEntryPoint.entryScreenID, Equal <Required <ListEntryPoint.entryScreenID> > > >
                        .Update(this, update.Branch == true, "CS101500");
                    }

                    yield return(update);
                }
                else
                {
                    yield return(feature);
                }
            }

            bool needRefresh = !(ActivationBehaviour.Current != null && ActivationBehaviour.Current.Refresh == false);

            PXDatabase.ResetSlots();
            PXPageCacheUtils.InvalidateCachedPages();
            this.Clear();
            if (needRefresh)
            {
                throw new PXRefreshException();
            }
        }