protected virtual void _(Events.RowDeleting <ARInvoice> e)
        {
            if (e.Row != null && e.Row.ProjectID != null && e.Row.ProjectID != PM.ProjectDefaultAttribute.NonProject())
            {
                var selectReleased = new PXSelectJoin <PMBillingRecord,
                                                       InnerJoin <PMBillingRecordEx, On <PMBillingRecord.projectID, Equal <PMBillingRecordEx.projectID>,
                                                                                         And <PMBillingRecord.billingTag, Equal <PMBillingRecordEx.billingTag>,
                                                                                              And <PMBillingRecord.recordID, Less <PMBillingRecordEx.recordID>,
                                                                                                   And <PMBillingRecordEx.proformaRefNbr, IsNotNull> > > > >,
                                                       Where <PMBillingRecord.projectID, Equal <Required <PMBillingRecord.projectID> >,
                                                              And <PMBillingRecord.aRDocType, Equal <Required <PMBillingRecord.aRDocType> >,
                                                                   And <PMBillingRecord.aRRefNbr, Equal <Required <PMBillingRecord.aRRefNbr> > > > > >(Base);

                var resultset = selectReleased.Select(e.Row.ProjectID, e.Row.DocType, e.Row.RefNbr);
                if (resultset.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (PXResult <PMBillingRecord, PMBillingRecordEx> res in resultset)
                    {
                        PMBillingRecordEx item = (PMBillingRecordEx)res;
                        sb.AppendFormat("{0}-{1},", item.ARDocType, item.ARRefNbr);
                    }

                    string list = sb.ToString().TrimEnd(',');

                    throw new PXException(AR.Messages.ReleasedProforma, list);
                }
            }

            isARInvoiceDeleting = true;
        }
Example #2
0
 protected virtual void _(Events.RowDeleting <PMCostCode> e)
 {
     if (e.Row.IsDefault == true)
     {
         throw new PXException(Messages.CannotDeleteDefaultCostCode);
     }
 }
Example #3
0
        protected virtual void _(Events.RowDeleting <ComplianceAttribute> args)
        {
            var attributeId   = args.Row.AttributeId;
            var compliance    = new PXSelect <ComplianceDocument>(this);
            var attributeType = new PXSelect <ComplianceAttributeType,
                                              Where <ComplianceAttributeType.complianceAttributeTypeID,
                                                     Equal <Required <ComplianceAttributeType.complianceAttributeTypeID> > > >(this)
                                .SelectSingle(args.Row.Type);

            switch (attributeType.Type.Trim())
            {
            case ComplianceDocumentType.Status:
                compliance
                .WhereAnd <Where <ComplianceDocument.status, Equal <Required <ComplianceAttribute.attributeId> > > >();
                break;

            default:
                compliance
                .WhereAnd <Where <ComplianceDocument.documentTypeValue,
                                  Equal <Required <ComplianceAttribute.attributeId> > > >();
                break;
            }
            if (compliance.SelectSingle(attributeId) != null)
            {
                throw new PXException(ComplianceMessages.CannotDeleteAttributeMessage);
            }
        }
 protected void _(Events.RowDeleting <LumShipmentPlan> e)
 {
     if (e.Row.Confirmed == true)
     {
         throw new PXSetPropertyException <LumShipmentPlan.confirmed>(NotDeleteConfirmed, e.Row.ShipmentPlanID);
     }
 }
 protected virtual void _(Events.RowDeleting <PMCostCode> e)
 {
     if (e.Row.IsDefault == true)
     {
         throw new PXException("This is a system record and cannot be deleted.");
     }
 }
        protected virtual void _(Events.RowDeleting <CSAttributeGroup> eventArgs)
        {
            string templateIDs = string.Empty;

            var row = eventArgs.Row;

            if (row == null)
            {
                return;
            }

            var oldRow = CSAttributeGroup.PK.Find(Base, row.AttributeID, row.EntityClassID, row.EntityType);

            if (oldRow?.AttributeCategory == CSAttributeGroup.attributeCategory.Variant)
            {
                if (_hasTemplateWithChild.Value)
                {
                    throw new PXSetPropertyException <CSAttributeGroup.attributeCategory>(Messages.CantDeleteVariantAttributeForMatrixItem, row.AttributeID);
                }

                if (IsAttributeDefaultRowColumnAttribute(row, out templateIDs))
                {
                    throw new PXSetPropertyException <CSAttributeGroup.attributeCategory>(Messages.CantDeleteVariantAttributeForMatrixTemplate, row.AttributeID, templateIDs);
                }
            }
        }
Example #7
0
        protected void _(Events.RowDeleting <POOrder> e)
        {
            var row = e.Row as POOrder;

            if (row == null)
            {
                return;
            }

            var        curPOOrder = (POOrder)Base.Caches[typeof(POOrder)].Current;
            POOrderExt pOOrderExt = curPOOrder.GetExtension <POOrderExt>();

            if ((bool)pOOrderExt.UsrICSOCreated)
            {
                var curUserName   = PXLogin.ExtractUsername(PXContext.PXIdentity.IdentityName);
                var curLMICVendor = PXSelect <LMICVendor, Where <LMICVendor.vendorid, Equal <Required <LMICVendor.vendorid> > > > .Select(Base, curPOOrder.VendorID).TopFirst;

                using (PXLoginScope pXLoginScope = new PXLoginScope($"{curUserName}@{curLMICVendor.LoginName}"))
                {
                    SOOrderEntry sOOrderEntry = PXGraph.CreateInstance <SOOrderEntry>();

                    // check the shipment base on this SO is created or not
                    var isShipmentCreated = PXSelect <SOOrderShipment, Where <SOOrderShipment.orderNbr, Equal <Required <SOOrderShipment.orderNbr> > > > .Select(sOOrderEntry, row.VendorRefNbr).Count() > 0 ? true : false;

                    if (isShipmentCreated)
                    {
                        throw new PXException("You cannot delete the PO because there is shipment created in IC SO.");
                    }
                }
            }
        }
        protected virtual void _(Events.RowDeleting <PMTask> args)
        {
            var projectTask = args.Row;

            if (projectTask != null)
            {
                var projectTaskUsageService = new ProjectTaskUsageInConstructionValidationService();
                projectTaskUsageService.ValidateProjectTask(projectTask);
            }
        }
 protected virtual void _(Events.RowDeleting <INSite> e)
 {
     if (e.Row != null)
     {
         e.Row.BuildingID = null;
         e.Cache.Update(e.Row);
         e.Cancel = true;
         Sites.View.RequestRefresh();
     }
 }
Example #10
0
        protected virtual void _(Events.RowDeleting <Account> e)
        {
            if (e.Row.AccountGroupID != null)
            {
                PMAccountGroup accountGroup = PXSelect <PMAccountGroup, Where <PMAccountGroup.groupID, Equal <Required <PMAccountGroup.groupID> > > > .Select(Base, e.Row.AccountGroupID);

                if (accountGroup != null)
                {
                    throw new PXException(Messages.CannotDeleteAccountMappedToAG, e.Row.AccountCD, accountGroup.GroupCD);
                }
            }
        }
        protected virtual void _(Events.RowDeleting <KNSIKCRelationship> e)
        {
            if (!(e.Row is KNSIKCRelationship row))
            {
                return;
            }

            if (RelatedConfigurableItems.Select().Any())
            {
                throw new PXException(KCMessages.RelatedConfigurableItemExistsException);
            }
        }
Example #12
0
        protected virtual void _(Events.RowDeleting <CSAttributeGroup> args)
        {
            var confirmationResult = ShowConfirmationDialog();

            if (confirmationResult == WebDialogResult.Cancel)
            {
                args.Cancel = true;
            }
            else
            {
                DeleteAttributeFromCompliance(args.Row.AttributeID);
            }
        }
Example #13
0
 protected virtual void _(Events.RowDeleting <RSSVWarranty> e)
 {
     if (e.Row.DefaultWarranty != true)
     {
         return;
     }
     if (e.ExternalCall && RepairPrices.Current != null &&
         RepairPrices.Cache.GetStatus(RepairPrices.Current) !=
         PXEntryStatus.Deleted)
     {
         throw new PXException(Messages.DefaultWarrantyCanNotBeDeleted);
     }
 }
Example #14
0
 protected virtual void _(Events.RowDeleting <PMTimeActivity> e)
 {
     if (e.Row.ApprovalStatus == CR.ActivityStatusListAttribute.Approved || e.Row.Released == true)
     {
         Items.View.Ask((PXMessages.LocalizeFormatNoPrefix(EP.Messages.ActivityIs, e.Cache.GetValueExt <PMTimeActivity.approvalStatus>(e.Row))), MessageButtons.OK);
         e.Cancel = true;
     }
     else if (e.Row.TimeCardCD != null)
     {
         Items.View.Ask(EP.Messages.ActivityAssignedToTimeCard, MessageButtons.OK);
         e.Cancel = true;
     }
 }
Example #15
0
        protected virtual void _(Events.RowDeleting <CRContactClass> e)
        {
            var row = e.Row;

            if (row == null)
            {
                return;
            }

            if (!CanDelete(row))
            {
                throw new PXException(Messages.RecordIsReferenced);
            }
        }
Example #16
0
        protected void _(Events.RowDeleting <SOOrder> e)
        {
            var row = e.Row as SOOrder;

            if (row == null)
            {
                return;
            }

            // check the ICPOCreated checkbox
            if (row.GetExtension <SOOrderExt>()?.UsrICPOCreated == true)
            {
                throw new PXException("You cannot delete this PO because ICPOCreated is clicked.");
            }
        }
Example #17
0
        protected virtual void _(Events.RowDeleting <ARTran> e)
        {
            if (e.Row == null || SharedFunctions.isFSSetupSet(Base) == false)
            {
                return;
            }

            ARTran arTranRow = (ARTran)e.Row;

            if (e.ExternalCall == true)
            {
                if (IsLineCreatedFromAppSO(Base, Base.Document.Current, arTranRow, null) == true)
                {
                    throw new PXException(TX.Error.NO_DELETION_ALLOWED_DOCLINE_LINKED_TO_APP_SO);
                }
            }
        }
Example #18
0
        protected virtual void _(Events.RowDeleting <FSCustomerBillingSetup> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSCustomerBillingSetup fscustomerBillingSetupRow = (FSCustomerBillingSetup)e.Row;

            bool setDocumentToInactive = IsCBIDRelatedToPostedDocuments(fscustomerBillingSetupRow.CBID);

            if (setDocumentToInactive)
            {
                fscustomerBillingSetupRow.Active = false;
                e.Cache.SetStatus(fscustomerBillingSetupRow, PXEntryStatus.Updated);
            }
        }
        protected virtual void _(Events.RowDeleting <APTran> args)
        {
            var transaction = args.Row;
            var jointPayees = JointPayees.SelectMain().Where(jp => jp.BillLineNumber == transaction.LineNbr).ToList();

            if (jointPayees.Any() && Base.Document.Cache.Deleted.Empty_())
            {
                if (IsLineUnlinkConfirmed())
                {
                    UnlinkBillLine(jointPayees);
                }
                else
                {
                    args.Cancel = true;
                    Base.Transactions.View.RequestRefresh();
                }
            }
        }
Example #20
0
        /// <summary>
        /// Deletes answers related to the primary attribute group. Should be used on RowDeleting event.
        /// </summary>
        public void DeleteAnswersIfRequired <TPrimaryCache>(Events.RowDeleting <CSAttributeGroup> args)
            where TPrimaryCache : IBqlTable
        {
            var attributeGroup = args.Row;

            if (attributeGroup.IsActive == true)
            {
                throw new PXSetPropertyException(CrMessages.AttributeCannotDeleteActive);
            }
            if (IsDeleteConfirmed())
            {
                CSAttributeGroupList <IBqlTable, TPrimaryCache> .DeleteAttributesForGroup(graph, attributeGroup);
            }
            else
            {
                args.Cancel = true;
            }
        }
Example #21
0
        protected virtual void _(Events.RowDeleting <POAdjust> eventArgs)
        {
            if (eventArgs.Row == null)
            {
                return;
            }

            if (eventArgs.Row.Released == true && eventArgs.Row.ForceDelete != true)
            {
                throw new PXException(Messages.CanNotRemoveReferenceToReleasedPOOrder, eventArgs.Row.AdjdOrderNbr);
            }

            if (eventArgs.Row.IsRequest == true &&
                eventArgs.Row.AdjgDocType != APPaymentType.VoidCheck &&
                eventArgs.Row.ForceDelete != true)
            {
                throw new PXException(Messages.CanNotRemoveReferenceToPOOrderRelatedPrepayment, eventArgs.Row.AdjdOrderNbr, eventArgs.Row.AdjdRefNbr);
            }
        }
        public virtual void _(Events.RowDeleting <CSAttributeGroup> args)
        {
            var attributeGroup = args.Row;

            if (attributeGroup == null)
            {
                return;
            }
            if (attributeGroup.IsActive == true)
            {
                throw new PXSetPropertyException(CRMessages.AttributeCannotDeleteActive);
            }
            if (IsDeleteConfirmed())
            {
                DeleteAnswers(attributeGroup.AttributeID);
            }
            else
            {
                args.Cancel = true;
            }
        }
Example #23
0
 protected virtual void _(Events.RowDeleting <FSServiceTemplate> e)
 {
 }
Example #24
0
 protected virtual void _(Events.RowDeleting <EPTimeCard> e)
 {
 }
Example #25
0
 protected virtual void _(Events.RowDeleting <TimeCardMaint.EPTimecardDetail> e)
 {
 }
 protected virtual void _(Events.RowDeleting <CROpportunityProducts> e)
 {
 }
Example #27
0
 protected virtual void _(Events.RowDeleting <APInvoice> e)
 {
 }
Example #28
0
 protected virtual void _(Events.RowDeleting <APTran> e)
 {
 }
Example #29
0
 protected virtual void _(Events.RowDeleting <FSSetup> e)
 {
 }
Example #30
0
 protected virtual void _(Events.RowDeleting <SOInvoice> e)
 {
     PXLongOperation.StartOperation(this, null);
 }