Exemple #1
0
    protected void edRefContactID_EditRecord(object sender, PX.Web.UI.PXNavigateEventArgs e)
    {
        LeadMaint leadMaint = this.ds.DataGraph as LeadMaint;

        var    selector = sender as PX.Web.UI.PXSelector;
        object value    = null;

        if (selector != null)
        {
            value = selector.Value;
        }

        try
        {
            var graph = PXGraph.CreateInstance <ContactMaint>();

            if (value != null)
            {
                Contact contact = PXSelect <Contact, Where <Contact.contactID, Equal <Required <CRLead.refContactID> > > > .SelectSingleBound(graph, null, value);

                graph.Contact.Current = contact;
            }

            PXRedirectHelper.TryRedirect(graph);
        }
        catch (PX.Data.PXRedirectRequiredException e1)
        {
            PX.Web.UI.PXBaseDataSource ds = this.ds as PX.Web.UI.PXBaseDataSource;
            PX.Web.UI.PXBaseDataSource.RedirectHelper helper = new PX.Web.UI.PXBaseDataSource.RedirectHelper(ds);
            helper.TryRedirect(e1);
        }
    }
Exemple #2
0
    protected void edProjectTaskID_EditRecord(object sender, PX.Web.UI.PXNavigateEventArgs e)
    {
        var campaignMaint = this.ds.DataGraph as CampaignMaint;

        if (campaignMaint != null)
        {
            var currentCampaign = this.ds.DataGraph.Views[this.ds.DataGraph.PrimaryView].Cache.Current as CRCampaign;
            if (currentCampaign.ProjectID.HasValue && !currentCampaign.ProjectTaskID.HasValue)
            {
                {
                    try
                    {
                        campaignMaint.addNewProjectTask.Press();
                    }
                    catch (PX.Data.PXRedirectRequiredException e1)
                    {
                        PX.Web.UI.PXBaseDataSource ds = this.ds as PX.Web.UI.PXBaseDataSource;
                        PX.Web.UI.PXBaseDataSource.RedirectHelper helper = new PX.Web.UI.PXBaseDataSource.RedirectHelper(ds);
                        helper.TryRedirect(e1);
                    }
                }
            }
        }
    }
Exemple #3
0
    protected void edContactID_EditRecord(object sender, PX.Web.UI.PXNavigateEventArgs e)
    {
        OpportunityMaint oppmaint = this.ds.DataGraph as OpportunityMaint;

        if (oppmaint != null)
        {
            CROpportunity currentopportunity = this.ds.DataGraph.Views[this.ds.DataGraph.PrimaryView].Cache.Current as CROpportunity;
            if (currentopportunity.ContactID == null && currentopportunity.BAccountID != null)
            {
                {
                    try
                    {
                        oppmaint.addNewContact.Press();
                    }
                    catch (PX.Data.PXRedirectRequiredException e1)
                    {
                        PX.Web.UI.PXBaseDataSource ds = this.ds as PX.Web.UI.PXBaseDataSource;
                        PX.Web.UI.PXBaseDataSource.RedirectHelper helper = new PX.Web.UI.PXBaseDataSource.RedirectHelper(ds);
                        helper.TryRedirect(e1);
                    }
                }
            }
        }
    }