Add show dialog panel to action "Action Email Invoice / Memo" - acumatica

I have customized the "Action Email Invoice / Memo" action on the Invoices and Memos AR301000 screen.
enter image description here
Each time you click on that action, a panel will appear to load an xml file.
enter image description here
After pressing the "CARGAR" button the panel should close, however it continues to open again and again and I don't know the reason for this.
enter image description here
public PXAction<ARInvoice> notification;
[PXUIField(DisplayName = "Notifications", Visible = false)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntryF)]
protected virtual IEnumerable Notification(PXAdapter adapter,
[PXString]
string notificationCD)
{
cargarXML();
foreach (ARInvoice doc in adapter.Get())
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add("DocType", doc.DocType);
parameters.Add("RefNbr", doc.RefNbr);
ARContact ar = Base.Billing_Contact.Select(this, doc.BillContactID);
if (String.IsNullOrEmpty(ar.Email))
{
var param = new List<PXSPParameter>();
PXSPParameter p1 = new PXSPInParameter("#CompanyID", PXDbType.Int, PX.Data.Update.PXInstanceHelper.CurrentCompany);
PXSPParameter p2 = new PXSPInParameter("#CustomerID", PXDbType.Int, ar.CustomerID);
PXSPParameter p3 = new PXSPInParameter("#CustomerContactID ", PXDbType.Int, ar.CustomerContactID);
PXSPParameter p4 = new PXSPInParameter("#BillContactID ", PXDbType.Int, doc.BillContactID);
param.Add(p1);
param.Add(p2);
param.Add(p3);
param.Add(p4);
var proc = PXDatabase.Execute("XSPUpadeEmailVacio", param.ToArray());
}
using (var ts = new PXTransactionScope())
{
Base.Activity.SendNotification(ARNotificationSource.Customer, notificationCD, doc.BranchID, parameters);
Base.Save.Press();
ts.Complete();
}
List<Guid> _attachments = new List<Guid>();
foreach (NoteDoc noteDoc in PXSelect<NoteDoc, Where<NoteDoc.noteID, Equal<Required<NoteDoc.noteID>>>>.Select(Base, doc.NoteID))
{
_attachments.Add((Guid)noteDoc.FileID);
}
foreach (CRActivity item in PXSelect<CRActivity, Where<CRActivity.refNoteID, In<Required<CRActivity.refNoteID>>>>.Select(Base, doc.NoteID))
{
if (item != null)
{
foreach (Guid item2 in _attachments)
{
var pars = new List<PXSPParameter>();
PXSPParameter p1 = new PXSPInParameter("#CompanyID", PXDbType.Int, PX.Data.Update.PXInstanceHelper.CurrentCompany);
PXSPParameter p2 = new PXSPInParameter("#FileID", PXDbType.UniqueIdentifier, item2);
PXSPParameter p3 = new PXSPInParameter("#NoteID", PXDbType.UniqueIdentifier, item.NoteID);
pars.Add(p1);
pars.Add(p2);
pars.Add(p3);
var proc = PXDatabase.Execute("XSPInsertarNoteDoc", pars.ToArray());
}
var par = new List<PXSPParameter>();
PXSPParameter p01 = new PXSPInParameter("#CompanyID", PXDbType.Int, PX.Data.Update.PXInstanceHelper.CurrentCompany);
PXSPParameter p02 = new PXSPInParameter("#NoteID", PXDbType.UniqueIdentifier, item.NoteID);
par.Add(p01);
par.Add(p02);
var proce = PXDatabase.Execute("XSPModificarEmail", par.ToArray());
}
}
yield return doc;
}
}
public virtual void cargarXML()
{
if (Base.Document.AskExt() == WebDialogResult.OK)
{
PX.SM.FileInfo fileInfo = PX.Common.PXContext.SessionTyped<PXSessionStatePXData>().FileInfo["CargaSessionKey"];
string result = System.Text.Encoding.UTF8.GetString(fileInfo.BinData);
ARInvoice ari = Base.Document.Current;
xtFECodHashEntry graph2 = PXGraph.CreateInstance<xtFECodHashEntry>();
var pchExt = ari.GetExtension<ARRegisterExt>();
string Valor = "";
XmlDocument xm = new XmlDocument();
xm.LoadXml(result);
XmlNodeList elemList = xm.GetElementsByTagName("ds:DigestValue");
for (int i = 0; i < elemList.Count; i++)
{
Valor = (elemList[i].InnerXml);
break;
}
PXLongOperation.StartOperation(Base, delegate ()
{
xtFECodHash dac = new xtFECodHash();
dac.RefNbr = ari.RefNbr;
dac.DocType = ari.DocType;
dac.Nrocomprobante = ari.InvoiceNbr;
dac.Hash = Valor;
dac.Tipo = pchExt.UsrTDocSunat;
graph2.xtFECodHashs.Insert(dac);
graph2.Actions.PressSave();
//Base.Document.Cache.Persist(PXDBOperation.Insert);
});
//Base.Actions.PressSave();
//}
}
}

I would first check your SmartPanel buttons. Here is an example of an "Update" Button that triggers an action and closes:
<px:PXButton ID="btnOKGasCost" runat="server" DialogResult="OK" Text="Update">
<AutoCallBack Target="formUpdateGasCost" Command="Save" />
</px:PXButton>
The target form is the FormView formUpdateGasCost that it is contained in.
The smartpanel has the defined tags of enabling the callback as fields change, the main filter/DAC object bound to it, as well as calling the AcceptButtonID
<px:PXSmartPanel ID="pnlUpdateGasCost" runat="server" Caption="Update Gas Cost"
CaptionVisible="true" DesignView="Hidden" LoadOnDemand="true" Key="UpdateGasCostFilter" CreateOnDemand="false" AutoCallBack-Enabled="true"
AutoCallBack-Target="formUpdateGasCost" AutoCallBack-Command="Refresh" CallBackMode-CommitChanges="True" CallBackMode-PostData="Page"
AcceptButtonID="btnOKGasCost">
I see that you are using the AskExt method on your function. If the above changes do not work, I would try moving the bound DAC to a Filter, and calling AskExt from the filter. For example, mine is set as:
public PXFilter<UpdateGasCostFilter> UpdateGasCostFilter;
public PXAction<CYGas> UpdateGasCost;
[PXUIField(DisplayName = "Update Gas Cost", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXButton]
public virtual IEnumerable updateGasCost(PXAdapter adapter)
{
var Result = UpdateGasCostFilter.AskExt(true);
if(Result == WebDialogResult.OK)
{
// perform the update actions
}
return adapter.Get();
}
I hope this helps.

Related

Error While creating Sales Order from Sales Quote (CR304500)

I have created a Action called "CREATE SO" in Sales Quote(CR304500) screen to create Sales Order. I have created a ComboBox udf "Sales Order Type" to select "Doc Type" of the Sales Order to be created.
When I am selecting DocType as "SO", its giving error "Unit
Conversion is missing". (see pic)
When I am selecting any other DocType it gives an error "RevisionID
cannot be empty".(see pic)
"SO" is the default Order Type in SO Preferences. I am unable to track the error using debugger. Please suggest. Thanks. Following is my code.
#region Create Sales Order
public PXAction<CRQuote> createSalesOrder;
[PXUIField(DisplayName = "Create SO", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
[PXProcessButton(CommitChanges = true)]
public IEnumerable CreateSalesOrder(PXAdapter adapter)
{
QuoteMaint graphObject = PXGraph.CreateInstance<QuoteMaint>();
foreach (CRQuote quote in adapter.Get())
{
//Create resultset for Quote Details
PXResultset<CROpportunityProducts> PXSetLine = PXSelect<CROpportunityProducts,
Where<CROpportunityProducts.quoteID,
Equal<Required<CROpportunityProducts.quoteID>>>>.Select(this.Base, quote.QuoteID);
List<CROpportunityProducts> QuoteList = new List<CROpportunityProducts>();
foreach (CROpportunityProducts line in PXSetLine)
{
QuoteList.Add(line);
}
bool var_orderCreated = false;
bool erroroccured = false;
string ErrMsg = "";
SOOrderEntry orderGraphObjet = PXGraph.CreateInstance<SOOrderEntry>();
SOOrder orderHeaderObject = new SOOrder();
QuoteMaint currGRPH = PXGraph.CreateInstance<QuoteMaint>();
CRQuoteExt _quoteExt = PXCache<CRQuote>.GetExtension<CRQuoteExt>(quote);
var Extension = this.Base.GetExtension<QuoteMaint_Extension>();
orderHeaderObject = orderGraphObjet.CurrentDocument.Insert(orderHeaderObject);
BAccount customer = PXSelect<BAccount, Where<BAccount.bAccountID, Equal<Current<CRQuote.bAccountID>>>>.Select(this.Base, quote.BAccountID);
if (customer.Type == "CU")
{
orderHeaderObject.CustomerID = quote.BAccountID;
orderHeaderObject.CustomerLocationID = quote.LocationID;
}
else
{
throw new PXException("Business Account not converted to Customer yet");
}
if (quote.CuryProductsAmount != 0)
{
orderHeaderObject.CuryOrderTotal = quote.CuryProductsAmount;
}
else
{
throw new PXException("Total cannot be 0");
}
orderHeaderObject.CuryOrderTotal = quote.CuryProductsAmount;
orderHeaderObject.CuryTaxTotal = quote.CuryTaxTotal;
orderHeaderObject.OrderDesc = quote.Subject;
orderHeaderObject.OrderType = _quoteExt.UsrOrderNbr;
orderGraphObjet.Document.Update(orderHeaderObject);
orderGraphObjet.CurrentDocument.Current = orderHeaderObject;
orderGraphObjet.Actions.PressSave();
orderHeaderObject = orderGraphObjet.CurrentDocument.Current;
foreach (CROpportunityProducts tran in QuoteList)
{
SOLine transline = new SOLine();
orderGraphObjet.Transactions.Insert(transline);
transline.OrderNbr = orderHeaderObject.OrderNbr;
transline.BranchID = orderHeaderObject.BranchID;
transline.InventoryID = tran.InventoryID;
transline.TranDesc = tran.Descr;
transline.UOM = tran.UOM;
transline.OrderQty = tran.Quantity;
transline.SiteID = tran.SiteID;
transline.CuryUnitPrice = tran.CuryUnitPrice;
transline.CuryExtPrice = tran.CuryExtPrice;
transline.CuryLineAmt = tran.CuryAmount;
CROpportunityProductsExt xOppProductExt = PXCache<CROpportunityProducts>.GetExtension<CROpportunityProductsExt>(tran);
SOLineExt _soLext = PXCache<SOLine>.GetExtension<SOLineExt>(transline);
_soLext.UsrXSeqID = xOppProductExt.UsrXSequenceID;
_soLext.UsrXGroupID = xOppProductExt.UsrXGroupID;
_soLext.UsrInternalRemk = xOppProductExt.UsrInternalRemk;
orderGraphObjet.Transactions.Update(transline);
}
orderGraphObjet.Actions.PressSave(); //This is the line where both the error is showing
if (orderGraphObjet != null && orderHeaderObject != null)
{
orderGraphObjet.Document.Current = orderHeaderObject;
throw new PXRedirectRequiredException(orderGraphObjet, "Document") { Mode = PXBaseRedirectException.WindowMode.NewWindow };
}
yield return quote;
}
}
############## DAC FIELD #####################
[PXDBString(50)]
[PXUIField(DisplayName = "Sales Order Type")]
[PXDefault()]
[PXStringList(new string[] { "SO", "SP", "SS" }, new string[] { "SO - Sales Order", "SP - Sales Of Project", "SS - Sales Of Service" })]
public virtual string UsrOrderNbr { get; set; }
public abstract class usrOrderNbr : PX.Data.BQL.BqlString.Field<usrOrderNbr> { }
I would suggest that when you insert your new objects into the cache, that you insert an object with it's key elements already entered. For instance, I would add CustomerID and CustomerLocationID to orderHeaderObject and then Insert it into the Document cache. When you do that, the Acumatica validation will fire and all the defaults will be set in your document before you try and edit them. Same goes for your line level object, I think that's the reason you're getting both errors. Also, I notice you trying to set the value for a few calculated fields. If possible I would try and leave these to calculate as designed.

Unable to open SO screen SO301000 using Action from Quote screen CR304500

I have created a Action called CREATE SO in Sales Quote screen to create Sales order.
I am unable to open the sales order screen using this action. though the sales order is getting created
but the SO screen is not opening while creating the SO. I am not sure where i am making mistake in my code. Please suggest. Thanks.
#region Create Sales Order
public PXAction<CRQuote> createSalesOrder;
[PXUIField(DisplayName = "Create SO", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
[PXProcessButton(CommitChanges = true)]
public IEnumerable CreateSalesOrder(PXAdapter adapter)
{
QuoteMaint graphObject = PXGraph.CreateInstance<QuoteMaint>();
foreach (CRQuote quote in adapter.Get())
{
//Create resultset for Quote Details
PXResultset<CROpportunityProducts> PXSetLine = PXSelect<CROpportunityProducts,
Where<CROpportunityProducts.quoteID,
Equal<Required<CROpportunityProducts.quoteID>>>>.Select(this.Base, quote.QuoteID);
List<CROpportunityProducts> QuoteList = new List<CROpportunityProducts>();
foreach (CROpportunityProducts line in PXSetLine)
{
QuoteList.Add(line);
}
PXLongOperation.StartOperation(this, () => CreateSalesOrderMethod(quote, QuoteList));
yield return quote;
}
}
//Private Method for Create Sales Order
public virtual void CreateSalesOrderMethod(CRQuote quote, List<CROpportunityProducts> QuoteList)
{
//Base.Save.Press();
bool var_orderCreated = false;
bool erroroccured = false;
string ErrMsg = "";
SOOrderEntry orderGraphObjet = PXGraph.CreateInstance<SOOrderEntry>();
SOOrder orderHeaderObject = new SOOrder();
QuoteMaint currGRPH = PXGraph.CreateInstance<QuoteMaint>();
BAccount customer = PXSelect<BAccount, Where<BAccount.bAccountID, Equal<Current<CRQuote.bAccountID>>>>.Select(this.Base, quote.BAccountID);
if (customer.Type == "CU")
{
orderHeaderObject.CustomerID = quote.BAccountID;
}
else
{
throw new PXException("Business Account not converted to Customer yet"); // THIS ERROR IS ALSO NOT SHOWING WHILE ENCOUNTERING.
}
orderHeaderObject.CuryOrderTotal = quote.CuryProductsAmount;
orderHeaderObject.CuryTaxTotal = quote.CuryTaxTotal;
orderHeaderObject.OrderDesc = quote.Subject;
orderHeaderObject = orderGraphObjet.CurrentDocument.Insert(orderHeaderObject);
orderGraphObjet.CurrentDocument.Current = orderHeaderObject;
orderGraphObjet.Actions.PressSave();
orderHeaderObject = orderGraphObjet.CurrentDocument.Current;
foreach (CROpportunityProducts tran in QuoteList)
{
SOLine transline = new SOLine(); //EMPTY DAC OBJECT
transline.OrderNbr = orderHeaderObject.OrderNbr;
transline.BranchID = orderHeaderObject.BranchID;
transline.InventoryID = tran.InventoryID;
transline.TranDesc = tran.Descr;
transline.UOM = tran.UOM;
transline.OrderQty = tran.Quantity;
transline.SiteID = tran.SiteID;
transline.CuryUnitPrice = tran.CuryUnitPrice;
transline.CuryExtPrice = tran.CuryExtPrice;
orderGraphObjet.Transactions.Insert(transline); //INSERT DAC INTO DATAVIEW
CROpportunityProductsExt xOppProductExt = PXCache<CROpportunityProducts>.GetExtension<CROpportunityProductsExt>(tran);
SOLineExt _soLext = PXCache<SOLine>.GetExtension<SOLineExt>(transline); // GET DAC ENTENSION
_soLext.UsrXSeqID = xOppProductExt.UsrXSequenceID;
_soLext.UsrXGroupID = xOppProductExt.UsrXGroupID;
_soLext.UsrInternalRemk = xOppProductExt.UsrInternalRemk; // ASSIGN CUSTOM FIELDS
orderGraphObjet.Transactions.Update(transline); // UPDATE DAC OBJECT IN DATAVIEW
}
orderGraphObjet.Actions.PressSave();
var_orderCreated = true;
//if (orderGraphObjet != null && orderHeaderObject != null)
if (var_orderCreated)
{
orderGraphObjet.Document.Current = orderHeaderObject; // HERE I AM GETTING THE OrderType as well as OrderNbr to open the Document.
throw new PXRedirectRequiredException(orderGraphObjet, "Document") { Mode = PXBaseRedirectException.WindowMode.NewWindow };
}
}
#endregion
}
}
The issue is that the redirection is in the PXLongOperation. A PXLongOperation starts a separate thread that is not related with the UI. In order to solve this you can use the PXCustomInfo structure to talk back with the UI thread after the long operation finishes and thus be able to redirect to the so screen.
// PXCustomInfoDefinition
public sealed class SORedirectionCustomInfo: IPXCustomInfo
{
private PXGraph _OrderGraph;
public SORedirectionCustomInfo(PXGraph orderGraph)
{
_OrderGraph = orderGraph;
}
public void Complete(PXLongRunStatus status, PXGraph graph)
{
if (status == PXLongRunStatus.Completed && graph is <YourQuoteGraphType>)
{
throw new PXRedirectRequiredException(orderGraphObjet, "Document") { Mode = PXBaseRedirectException.WindowMode.NewWindow };
}
}
}
// Long Operation Method
public virtual void CreateSalesOrderMethod(CRQuote quote, List<CROpportunityProducts> QuoteList)
{
// Your code to create SO....
if (var_orderCreated)
{
PXLongOperation.SetCustomInfo(new SORedirectionCustomInfo(orderGraphObjet));
}
}
This should be able to redirect successfully once the long operation is completed and the order is created.

Shipment Confirmation and Update IN through code is not working

I have a requirement to create shipment document, shipment confirmation and update In on a Sales order Transfer document.
The following code is used for shipment confirmation
public string CreateShipment()
{
bool flag = false;
string _retval = string.Empty;
using (IEnumerator<PXResult<SOOrderShipment>> enumerator = Base.shipmentlist.Select(Array.Empty<object>()).GetEnumerator())
{
if (enumerator.MoveNext())
{
SOOrderShipment current = enumerator.Current;
flag = true;
}
}
if (flag)
{
string Mess = "Error: Shipment already created.";
throw new PXException(Mess);
}
SOShipmentEntry sOShipmentEntry = PXGraph.CreateInstance<SOShipmentEntry>();
//SOOrderEntry sOOrderEntry = PXGraph.CreateInstance<SOOrderEntry>();
//sOOrderEntry.Caches.Clear();
SOOrder sOOrder = Base.Document.Current;
int? nullable = new int?(0);
int? customerLocationID = new int?(0);
if (sOOrder != null)
{
nullable = sOOrder.CustomerID;
customerLocationID = sOOrder.CustomerLocationID;
}
int? siteID = new int?(0);
//SOShipmentEntry sOShipmentEntry1 = PXGraph.CreateInstance<SOShipmentEntry>();
SOShipment destinationDocument = sOShipmentEntry.Document.Insert();
destinationDocument.ShipmentType = "T";
destinationDocument = sOShipmentEntry.Document.Update(destinationDocument);
destinationDocument.Operation = "I";
destinationDocument = sOShipmentEntry.Document.Update(destinationDocument);
using (IEnumerator<PXResult<SOLine>> enumerator1 = PXSelectReadonly<SOLine, Where<SOLine.orderType, Equal<Required<SOLine.orderType>>, And<SOLine.orderNbr, Equal<Required<SOLine.orderNbr>>>>>.Select(Base, new object[] { Base.Document.Current.OrderType, Base.Document.Current.OrderNbr }).GetEnumerator())
{
if (enumerator1.MoveNext())
{
SOLine line = (SOLine)enumerator1.Current;
siteID = line.SiteID;
}
}
destinationDocument.SiteID = siteID;
destinationDocument.DestinationSiteID = sOOrder.DestinationSiteID;
destinationDocument = sOShipmentEntry.Document.Update(destinationDocument);
//sOOrderEntry.Document.Current = sOOrder;
if (Base.Document.Current != null)
{
DocumentList<SOShipment> documentList = new DocumentList<SOShipment>(sOShipmentEntry);
sOShipmentEntry.CreateShipment(Base.Document.Current, sOShipmentEntry.Document.Current.SiteID, sOShipmentEntry.Document.Current.ShipDate, new bool?(false), "I", documentList);
if (sOShipmentEntry.Document.Current.ShipmentNbr != null)
{
SOOrderEntry sOOrderEntry1 = PXGraph.CreateInstance<SOOrderEntry>();
sOOrderEntry1.Clear();
sOOrderEntry1.Document.Current = sOOrder;
int? openShipmentCntr = Base.Document.Current.OpenShipmentCntr;
if ((openShipmentCntr.GetValueOrDefault() > 0 ? openShipmentCntr.HasValue : false))
{
sOOrder.Status = SOOrderStatus.Shipping;
sOOrder.Hold = new bool?(false);
sOOrderEntry1.Document.Update(sOOrder);
sOOrderEntry1.Save.Press();
_retval = sOShipmentEntry.Document.Current.ShipmentNbr;
}
}
}
return _retval;
}
The following code confirms the shipment and update IN.
private void ConfirmShipment(string shipmentnbr)
{
SOShipmentEntry sOShipmentEntry = PXGraph.CreateInstance<SOShipmentEntry>();
SOOrderEntry sOOrderEntry = PXGraph.CreateInstance<SOOrderEntry>();
sOShipmentEntry.Clear();
sOOrderEntry.Clear();
sOOrderEntry.Document.Current = PXSelect<SOOrder, Where<SOOrder.orderType, Equal<Required<SOOrder.orderType>>, And<SOOrder.orderNbr, Equal<Required<SOOrder.orderNbr>>>>>.Select(sOOrderEntry, Base.Document.Current.OrderType, Base.Document.Current.OrderNbr);
sOShipmentEntry.Document.Current = PXSelect<SOShipment,Where<SOShipment.shipmentNbr, Equal<Required<SOShipment.shipmentNbr>>>>.Select(sOShipmentEntry,shipmentnbr);
if(sOShipmentEntry.Document.Current!= null && sOOrderEntry.Document.Current != null)
{
sOShipmentEntry.ConfirmShipment(sOOrderEntry, sOShipmentEntry.Document.Current);
sOShipmentEntry.UpdateIN.Press();
}
}
I am able to select sales order in purchase receipt transfer document, but the shipment document status still shows open and not completed.
I have tried the run confirm shipment on the document which is already confirmed through code from the menu of shipment document and I am getting the following error
“Shipment counters are corrupted.”

how to attach an XML file in the "Files" tab of an action

I have a big question, you can attach XML through an action, when you import the XML and also save it in the "Files" tab, the question is. if it can be attached?.
Here is an example image:
what is missing is that I automatically attach in the "Files" tab, when I put upload
Here is my code where, I attached the XML
public PXAction<ARInvoice> CargarXML;
[PXUIField(DisplayName = "Carga de código hash")]
[PXButton()]
public virtual void cargarXML()
{
var Result = NewFilePanel.AskExt(true);
if (Result == WebDialogResult.OK)
{
PX.SM.FileInfo fileInfo = PX.Common.PXContext.SessionTyped<PXSessionStatePXData>().FileInfo["CargaSessionKey"];
string result = System.Text.Encoding.UTF8.GetString(fileInfo.BinData);
ARInvoice ari = Base.Document.Current;
xtFECodHashEntry graph2 = PXGraph.CreateInstance<xtFECodHashEntry>();
var pchExt = ari.GetExtension<ARRegisterExt>();
string Valor = "";
XmlDocument xm = new XmlDocument();
xm.LoadXml(result);
XmlNodeList elemList = xm.GetElementsByTagName("ds:DigestValue");
for (int i = 0; i < elemList.Count;)
{
Valor = (elemList[i].InnerXml);
break;
}
PXLongOperation.StartOperation(Base, delegate ()
{
xtFECodHash dac = new xtFECodHash();
dac.RefNbr = ari.RefNbr;
dac.DocType = ari.DocType;
dac.Nrocomprobante = ari.InvoiceNbr;
dac.Hash = Valor;
dac.Tipo = pchExt.UsrTDocSunat;
graph2.xtFECodHashs.Insert(dac);
graph2.Actions.PressSave();
});
}
}
If you have the FileInfo object which it seems like you do I have used something like this:
protected virtual void SaveFile(FileInfo fileInfo, PXCache cache, object row)
{
if (fileInfo == null)
{
return;
}
var fileGraph = PXGraph.CreateInstance<UploadFileMaintenance>();
if (!fileGraph.SaveFile(fileInfo, FileExistsAction.CreateVersion))
{
return;
}
if (!fileInfo.UID.HasValue)
{
return;
}
PXNoteAttribute.SetFileNotes(cache, row, fileInfo.UID.Value);
}
So in your example you could call this method as shown above using the following:
SaveFile(fileInfo, Base.Document.Cache, Base.Document.Current);

MvvmCross - MvxTabBarViewController does not show the "More" button when using a Storyboard

In my application, I'm using the MvxTabBarViewController to display some tabs (the MvxTabBarViewController is loaded using a Storyboard):
public partial class RootView : MvxTabBarViewController
{
private int _tabIndex = 0;
private Dictionary<int, SectionBase> _sectionBaseForConfig;
public new RootViewModel ViewModel
{
get { return (RootViewModel)base.ViewModel; }
set { base.ViewModel = value; }
}
public RootView(IntPtr handle)
: base(handle)
{
}
UIViewController tab1, tab2, tab3, tab4, tab5, tab6, tab7;
public override async void ViewDidLoad()
{
base.ViewDidLoad();
if (ViewModel == null)
return;
tab1 = new UIViewController();
tab1.Title = "1";
tab1.View.BackgroundColor = UIColor.Green;
tab2 = new UIViewController();
tab2.Title = "2";
tab2.View.BackgroundColor = UIColor.Orange;
tab3 = new UIViewController();
tab3.Title = "3";
tab3.View.BackgroundColor = UIColor.Red;
tab4 = new UIViewController();
tab4.Title = "4";
tab4.View.BackgroundColor = UIColor.Blue;
tab5 = new UIViewController();
tab5.Title = "5";
tab5.View.BackgroundColor = UIColor.Brown;
tab6 = new UIViewController();
tab6.Title = "6";
tab6.View.BackgroundColor = UIColor.Brown;
tab7 = new UIViewController();
tab7.Title = "7";
tab7.View.BackgroundColor = UIColor.Brown;
var tabs = new UIViewController[] {
tab1, tab2, tab3, tab4, tab5, tab6, tab7
};
ViewControllers = tabs;
CustomizableViewControllers = null;
SelectedViewController = ViewControllers[0];
}
}
Unfortunately, even if there are 7 tabs, only 5 are displayed and the "More" button does not show. Anyone got an idea ? I stuck on this problem since 2 hrs now, without any clues :(
Thanks!

Resources