Example #1
0
        /// <summary>
        /// Enable/Disable the ActionType field for a Service depending on the appointments related to that service.
        /// </summary>
        public virtual void EnableDisableActionType(PXCache cache, InventoryItem inventoryItemRow)
        {
            bool       enableActionType = true;
            FSxService fsxServiceRow    = PXCache <InventoryItem> .GetExtension <FSxService>(inventoryItemRow);

            if (cache.GetStatus(inventoryItemRow) != PXEntryStatus.Inserted)
            {
                int rowCount = PXSelect <FSAppointmentDet,
                                         Where <
                                             FSAppointmentDet.lineType, Equal <ListField_LineType_Pickup_Delivery.Pickup_Delivery>,
                                             And <FSAppointmentDet.pickupDeliveryServiceID, Equal <Required <FSAppointmentDet.pickupDeliveryServiceID> > > > >
                               .SelectSingleBound(cache.Graph, null, inventoryItemRow.InventoryID).Count;

                enableActionType = rowCount == 0;
            }

            PXUIFieldAttribute.SetEnabled <FSxService.actionType>(cache, inventoryItemRow, enableActionType);

            if (enableActionType == false)
            {
                cache.RaiseExceptionHandling <FSxService.actionType>(inventoryItemRow,
                                                                     null,
                                                                     new PXSetPropertyException(
                                                                         PXMessages.LocalizeFormatNoPrefix(TX.Warning.CANNOT_MODIFY_FIELD, "Appoinments", "Service"),
                                                                         PXErrorLevel.Warning));
            }
        }
 protected virtual void Page_PreInit(object sender, EventArgs e)
 {
     pageTitle.ScreenID               = PXSiteMap.IsPortal ? "SE.00.00.50" : "SE.00.00.40";
     pageTitle.ScreenTitle            = PXMessages.LocalizeNoPrefix(Messages.scrSearch);
     pageTitle.FavoriteAvailable      = false;
     pageTitle.CustomizationAvailable = false;
 }
Example #3
0
        protected virtual void _(Events.FieldSelecting <POOrderPrepayment.statusText> e)
        {
            if (Base.Document.Current == null || e.Row == null)
            {
                return;
            }

            var query =
                new PXSelectJoinGroupBy <POOrderPrepayment,
                                         InnerJoin <APRegister, On <APRegister.docType, Equal <POOrderPrepayment.aPDocType>, And <APRegister.refNbr, Equal <POOrderPrepayment.aPRefNbr> > > >,
                                         Where <POOrderPrepayment.orderType, Equal <Current <POOrder.orderType> >, And <POOrderPrepayment.orderNbr, Equal <Current <POOrder.orderNbr> > > >,
                                         Aggregate <Sum <POOrderPrepayment.curyAppliedAmt, Sum <APRegister.curyDocBal> > > >(Base);

            using (new PXFieldScope(query.View,
                                    typeof(POOrderPrepayment.orderType), typeof(POOrderPrepayment.orderNbr), typeof(POOrderPrepayment.aPDocType), typeof(POOrderPrepayment.aPRefNbr),
                                    typeof(APRegister.docType), typeof(APRegister.refNbr),
                                    typeof(POOrderPrepayment.curyAppliedAmt), typeof(APRegister.curyDocBal)))
            {
                var prepaymentTotal = (PXResult <POOrderPrepayment, APRegister>)query.SelectWindowed(0, 1);

                e.ReturnValue = PXMessages.LocalizeFormatNoPrefix(Messages.StatusTotalPrepayments,
                                                                  Base.FormatQty(((POOrderPrepayment)prepaymentTotal)?.CuryAppliedAmt ?? 0),
                                                                  Base.FormatQty(((APRegister)prepaymentTotal)?.CuryDocBal ?? 0));
            }
        }
Example #4
0
                protected override string CreateEditPreventingReason(GetEditPreventingReasonArgs args,
                                                                     object firstPreventingEntity, string fieldName, string currentTableName, string foreignTableName)
                {
                    var planType = INPlanType.PK.Find(args.Graph, ((INItemPlan)firstPreventingEntity).PlanType);

                    return(PXMessages.LocalizeFormat(IN.Messages.DecimalBaseUnitCouldNotUnchecked, ((InventoryItem)args.Row).BaseUnit, planType.Descr));
                }
Example #5
0
        protected virtual bool AskProcess(List <Contact> list)
        {
            if (Operations.Current.CampaignID == null)
            {
                return(false);
            }
            CRCampaign campaign = PXSelect <CRCampaign,
                                            Where <CRCampaign.campaignID, Equal <Current <CampaignOperationParam.campaignID> > > >
                                  .Select(this);

            if (Operations.Current.Action == CampaignOperationParam.ActionList.Update)
            {
                return(PXView.AskExt(this, "UpdateMembers", null, (s, e) =>
                {
                    Operations.Current.Status = campaign != null ? campaign.DefaultMemberStatus : null;
                }) == WebDialogResult.OK && Operations.Current.Status != null);
            }

            if (Operations.Current.Action == CampaignOperationParam.ActionList.Remove)
            {
                return(Operations.Current.CampaignID != null &&
                       Operations.Ask(Messages.AskConfirmation,
                                      PXMessages.LocalizeFormatNoPrefix(Messages.ConfirmRemoving, list.Count),
                                      MessageButtons.YesNoCancel) == WebDialogResult.Yes);
            }

            return(PXView.AskExt(this, "AddMembers", null, (s, e) =>
            {
                Operations.Current.Status = campaign != null ? campaign.DefaultMemberStatus : null;
            }) == WebDialogResult.OK && Operations.Current.Status != null);
        }
        protected virtual void DRDeferredCode_RowDeleting(PXCache sender, PXRowDeletingEventArgs e)
        {
            var code = e.Row as DRDeferredCode;

            if (code == null)
            {
                return;
            }

            var inventory        = new PXSelect <InventoryItem, Where <InventoryItem.deferredCode, Equal <Current <DRDeferredCode.deferredCodeID> > > >(this).SelectSingle();
            var component        = new PXSelect <INComponent, Where <INComponent.deferredCode, Equal <Current <DRDeferredCode.deferredCodeID> > > >(this).SelectSingle();
            var unreleasedARTran = new PXSelect <AR.ARTran, Where <AR.ARTran.released, Equal <False>, And <AR.ARTran.deferredCode, Equal <Current <DRDeferredCode.deferredCodeID> > > > >(this).SelectSingle();
            var unreleasedAPTran = new PXSelect <AP.APTran, Where <AP.APTran.released, Equal <False>, And <AP.APTran.deferredCode, Equal <Current <DRDeferredCode.deferredCodeID> > > > >(this).SelectSingle();

            var checks = new List <Tuple <string, object> >
            {
                new Tuple <string, object>(IN.Messages.InventoryItem, inventory),
                new Tuple <string, object>(IN.Messages.Component, component),
                new Tuple <string, object>(AR.Messages.ARTran, unreleasedARTran),
                new Tuple <string, object>(AP.Messages.APTran, unreleasedAPTran)
            };

            foreach (var check in checks)
            {
                if (check.Item2 != null)
                {
                    throw new PXException(Messages.CodeInUseCantDelete, PXMessages.LocalizeNoPrefix(check.Item1));
                }
            }
        }
        /// <summary>
        /// Ask user for approval for creation of another reversal if reversing <see cref="TaxAdjustment"/> already exists.
        /// </summary>
        /// <param name="taxAdjToReverse">The tax adjustment to reverse.</param>
        /// <returns/>
        private bool AskUserApprovalIfReversingDocumentAlreadyExists(TaxAdjustment taxAdjToReverse)
        {
            TaxAdjustment reversingTaxAdj =
                PXSelect <TaxAdjustment,
                          Where <TaxAdjustment.docType, Equal <Required <TaxAdjustment.docType> >,
                                 And <TaxAdjustment.origRefNbr, Equal <Required <TaxAdjustment.origRefNbr> > > >,
                          OrderBy <
                              Desc <TaxAdjustment.createdDateTime> > >
                .SelectSingleBound(this, currents : null, pars : new[] { taxAdjToReverse.DocType, taxAdjToReverse.RefNbr });

            if (reversingTaxAdj == null)
            {
                return(true);
            }

            string docTypeDescr;

            TaxAdjustmentType.ListAttribute labelsListAttribute = new TaxAdjustmentType.ListAttribute();

            if (!labelsListAttribute.ValueLabelDic.TryGetValue(reversingTaxAdj.DocType, out docTypeDescr))
            {
                docTypeDescr = taxAdjToReverse.DocType;
                PXTrace.WriteWarning("Failed to retrieve tax adjustment type {0} description from {1} attribute.", reversingTaxAdj.DocType,
                                     nameof(TaxAdjustmentType.ListAttribute));
            }

            string localizedMsg = PXMessages.LocalizeFormatNoPrefix(AR.Messages.ReversingDocumentExists, docTypeDescr, reversingTaxAdj.RefNbr);

            return(Document.Ask(Messages.Reverse, localizedMsg, MessageButtons.YesNo).IsPositive());
        }
    private string GetListFilterName()
    {
        string listScreenID = PXList.Provider.GetListID(PXSiteMap.CurrentNode.ScreenID);

        if (listScreenID != null)         // check if you need to add the control at all
        {
            PXFilterTuple filters = PXList.Provider.GetListFilters(PXSiteMap.CurrentNode.ScreenID, PXList.Provider.GetListView(listScreenID));
            if (filters != null)
            {
                if (filters.FilterID != null)
                {
                    string dynamicFilterName = DynamicFilterManager.GetFilterName((long)filters.FilterID);
                    if (!String.IsNullOrEmpty(dynamicFilterName))
                    {
                        return(dynamicFilterName);
                    }
                    FilterHeader filter = FilterHeader.Definition.Get().FirstOrDefault(f => f.FilterID == filters.FilterID);
                    if (filter != null)
                    {
                        return(filter.FilterName);
                    }
                }
                else if (filters.FilterRows != null)
                {
                    return(PXMessages.LocalizeNoPrefix(Msg.GrdFilterApplied));
                }
            }
        }
        return(null);
    }
Example #9
0
        public void SendMessage(object message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message), PXMessages.LocalizeNoPrefix(Messages.Message));
            }

            if (!(message is SMEmail))
            {
                string errorText = PXMessages.LocalizeFormatNoPrefixNLA(Messages.CanNotProcessMessage, message.GetType().Name,
                                                                        typeof(SMEmail).Name);
                throw new ArgumentException(errorText, PXMessages.LocalizeNoPrefix(Messages.Message));
            }

            SMEmail email = message as SMEmail;

            if (email.MailAccountID != null && PX.Objects.CS.Email.PXEmailSyncHelper.IsExchange(email.MailAccountID.Value))
            {
                CRSMEmail emailProjection =
                    PXSelect <CRSMEmail, Where <CRSMEmail.noteID, Equal <Required <SMEmail.refNoteID> > > > .Select(new PXGraph(), email.RefNoteID);

                CS.Email.PXEmailSyncHelper.SendMessage(emailProjection);
            }
            else
            {
                using (var processor = new MessageProcessor(email.MailAccountID))
                {
                    processor.Process(email);
                }
            }
        }
Example #10
0
    protected void Page_Init(object sender, EventArgs e)
    {
        string query = Request.QueryString["query"];

        WikiID                = Request.QueryString["wikiid"];
        WikiNumber            = Request.QueryString["wikinumber"];
        CategoryID            = Request.QueryString["categoryID"];
        ProductID             = Request.QueryString["productID"];
        OrderID               = Request.QueryString["orderID"];
        imgMessage            = PXFormView1.FindControl("imgMessage") as Image;
        lblMessage            = PXFormView1.FindControl("lblMessage") as Label;
        lblResults            = PXFormView1.FindControl("lblResults") as Label;
        txtSearch             = PXFormView1.FindControl("txtSearch") as PXTextEdit;
        chkSearchReplace      = PXFormView1.FindControl("chkSearchReplace") as PXCheckBox;
        txtReplace            = PXFormView1.FindControl("txtReplace") as PXTextEdit;
        SearchCaption         = PXFormView1.FindControl("SearchCaption") as PXDropDown;
        SearchCaptionCategory = PXFormView1.FindControl("SearchCaptionCategory") as PXDropDown;
        SearchCaptionProduct  = PXFormView1.FindControl("SearchCaptionProduct") as PXDropDown;
        OrderCaption          = PXFormView1.FindControl("OrderCaption") as PXDropDown;
        Go = PXFormView1.FindControl("btnSearch") as PXButton;

        mainContentTable = CreateMainTable();
        pager            = CreatePager(query);
        PXFormView1.TemplateContainer.Controls.Add(MainContentTable);
        SetEditBoxAttrributes();
        FullText = true;

        if (this.searchType == SearchType.Wiki)
        {
            this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipHelpSearch);
        }
        else if (this.searchType == SearchType.Files)
        {
            this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipFileSearch);
        }
        else if (this.searchType == SearchType.Entity)
        {
            this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipEntitySearch);
        }
        else if (this.searchType == SearchType.Notes)
        {
            this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipNoteSearch);
        }
        FormatSearchCaption();
        RegisterThisId();
        imgMessage.ImageUrl = ResolveUrl("~/App_Themes/Default/Images/Message/information.gif");

        if (query == null || string.IsNullOrEmpty(query.Trim()))
        {
            imgMessage.Visible = true;
            lblMessage.Visible = true;
            lblResults.Visible = false;
            lblMessage.Text    = PXMessages.LocalizeNoPrefix(Messages.SpecifySearchRequest);
            return;
        }

        imgMessage.Visible = false;
        lblMessage.Visible = false;
        lblResults.Visible = true;
    }
Example #11
0
    private void CreateProductMenu(PXGraph graph, PXDropDown dd)
    {
        PXListItem liall = new PXListItem(PXMessages.LocalizeNoPrefix(PX.SM.Messages.SearchProduct));

        dd.Items.Add(liall);
        foreach (PXResult result in PXSelect <SPWikiProduct> .Select(graph))
        {
            SPWikiProduct wc = result[typeof(SPWikiProduct)] as SPWikiProduct;
            PXListItem    li = new PXListItem(wc.Description, wc.ProductID);
            dd.Items.Add(li);
        }

        for (int i = 0; i < dd.Items.Count; i++)
        {
            if (ProductID == dd.Items[i].Value)
            {
                dd.SelectedIndex = i;
            }
        }

        string path = PXUrl.SiteUrlWithPath();

        path += path.EndsWith("/") ? "" : "/";
        var url = string.Format("{0}Search/{1}?query={2}&adv=1",
                                path, this.ResolveClientUrl("~/Search/WikiSP.aspx"), txtSearch.Value);

        url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + SearchCaptionProduct.Value + "&orderID=" + OrderID;
    }
 private static void CheckText(string subject, string fieldName)
 {
     if (string.IsNullOrEmpty(subject))
     {
         throw new PXSetPropertyException(PXMessages.LocalizeFormatNoPrefixNLA(Messages.IncorrectDataInField, fieldName));
     }
 }
 private static void CheckValue(object val, string fieldName)
 {
     if (val == null)
     {
         throw new PXSetPropertyException(PXMessages.LocalizeFormatNoPrefixNLA(Messages.IncorrectDataInField, fieldName));
     }
 }