Retrieving Opening balance from Netsuite Chart of Accounts using Web Service - search

While I try to retrieve Account details from Netsuite using Webservice, Opening balance always returns null.
I am using the following code to retrieve account details:
AccountSearch accountSearch = new AccountSearch();
AccountSearchBasic accBasic = new AccountSearchBasic();
accountSearch.setBasic(accBasic);
port.search(accountSearch);
I also tried using port.get(recordRef), port.getList(recordRef[]) and port.getAll(getAllrecord) but got the same result.is there any other way to retrieve the account details of Netsuite using webservice ?
Thanks in advance

This may help
public boolean performSearch(NetSuitePortType p_objportCall) throws Exception
{
boolean status = false;
AccountSearchBasic l_objaccountSearchBasic = new AccountSearchBasic();
try
{
SearchResult l_objSearchResult = p_objportCall.search(l_objaccountSearchBasic);
System.out.println(" Account Search Number of records: " +l_objSearchResult.getTotalRecords());
if (l_objSearchResult.getTotalRecords() > 0 )
{
processResults(l_objSearchResult.getRecordList());
}
}
catch (Exception e)
{
System.err.println("Acct Search performsearch: "+e.toString());
throw e;
}
return status;

Related

Page_load method may leak server-side conditional values, enabling user tracking from another website

I am getting Cross Site History Manipulation issue on a Checkmarx scan of my solution.
The issue I am getting is:
Method Page_Load at line 40 of xyz\abc.aspx.cs may leak server-side conditional values, enabling user tracking from another website. This may constitute a Privacy Violation.
THIS IS THE CODE AND I AM GETTING THE ERROR ON LINE (*)
protected void Page_Load(object sender, EventArgs e)
{
try
{
lblErrorMsg.Text = "";
lblErrorMsg.Visible = false;
if (!IsPostBack)
{
//Code to get the content page name.
string[] strPageInfo = HttpContext.Current.Request.ServerVariables.GetValues("PATH_INFO");
string strPage = strPageInfo[0].Substring(strPageInfo[0].LastIndexOf('/') + 1, ((strPageInfo[0].Length - strPageInfo[0].LastIndexOf("/")) - 1)).ToLower();
msg.MessageText = "Verifying access";
oLogger.LogInfo(msg, "Verifying access");
//firstly, check whether the logged-in user is authorized to view the page
ManageAuthorization.CheckAccess(strPage, out BoolAccess);
if (BoolAccess)
{
msg.MessageText = "Authorized to perform operations";
oLogger.LogInfo(msg, "Authorized to perform operations");
}
else
{
////display unauthorized screen
msg.MessageText = "Unauthorized to perform operations";
oLogger.LogWarning(msg, "Unauthorized to perform operations");
RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
var byteArray = new byte[4];
var randomInteger = BitConverter.ToUInt32(byteArray, 0);
Response.Redirect(String.Format("../Default/Unauthorized.aspx?r={0}",randomInteger),true);
}
}
}
catch (Exception ex)
{
msg.MessageText = "Error while loading the page, Exception is:" + ex.Message;
oLogger.LogMessage(LogCategory.Error, msg);
}
}
I am not getting any proper answer how can I fix this, please can anybody help. Thanks in advance :)
Checkmarx is marking this as a vulnerability because a threat agent could potentially compromise the browser's SOP and may leak user information through activity inference.
To remediate this, you need to add a random value in your Redirects:
msg.MessageText = "Unauthorized to perform operations";
oLogger.LogWarning(msg, "Unauthorized to perform operations");
RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
var byteArray = new byte[4];
provider.GetBytes(byteArray);
var randomInteger = BitConverter.ToUInt32(byteArray, 0);
Response.Redirect(String.Format("../Default/Unauthorized.aspx?r={0}", randomInteger), true);

In app purchase cannot connect to itunes store ios 12 following InAppBillingPlugin for Xamarin

I am trying to test in app purchases in my application following plugin. Also I have checked this and thousands of other officical/not official articles but there is no result. I do not thins there is a problem in my code because I asked another developer to share me his code and I use it in my app. In his project this code works perfect but I have InAppBillingPurchaseException "Can not connect to Itunes Store". I also logged out of my real accounts before entering sandbox credentials. This is the code but the I do not think the problem is here:
public async Task<bool> PurchaseItemAsync()
{
var billing = CrossInAppBilling.Current;
LastExceptionMessage = null;
try
{
var connected = await billing.ConnectAsync();
if (connected == false)
return false;
var purchase = await billing.PurchaseAsync(_kProductId, ItemType.InAppPurchase, _kPayload);
if (purchase == null)
return false;
else if (purchase.State == PurchaseState.Purchased)
return true;
}
catch (InAppBillingPurchaseException ex)
{
OnPurchaseException(ex);
}
catch (Exception ex)
{
//Dlog.Error("Issue connecting: " + ex);
LastExceptionMessage = ex.Message;
}
finally
{
await billing.DisconnectAsync();
}
return false;
}
In my case, bundleID in my app was not matching with the product id of In App purchase. I had bundle ID com.xam.sample in my app code. But product ID was testiap. So I created IAP with productID com.xam.sample.testiap and I was able to solve that error this way.

Error: Reference Nbr. cannot be found in the system.."}

I customized the ARPaymentEntry in which it creates a Journal Voucher Entry with created Credit Memo, it retrieves the Credit Memo applies the open invoice that is also applied in the current payment. when I create the instance to call the Credit Memo and add the Invoice in ARAdjust table, an error occurs when trying to insert it, giving a Reference Nbr cannot be found in the system, although when I'm trying to manually applying it I could see the open invoice.
public void ReleaseCreditMemo(string refNbr)
{
try
{
ARPaymentEntry docGraph = PXGraph.CreateInstance<ARPaymentEntry>();
List<ARRegister> list = new List<ARRegister>();
ARPayment payment;
ARRegister invoice = PXSelect<ARRegister, Where<ARRegister.docType, Equal<Required<ARRegister.docType>>, And<ARRegister.refNbr, Equal<Required<ARRegister.refNbr>>>>>.Select(docGraph, ARInvoiceType.CreditMemo, refNbr);
docGraph.Document.Current = PXSelect<ARPayment, Where<ARPayment.docType, Equal<Required<ARPayment.docType>>, And<ARPayment.refNbr, Equal<Required<ARPayment.refNbr>>>>>.Select(docGraph, ARInvoiceType.CreditMemo, refNbr);
payment = docGraph.Document.Current;
list.Add(payment);
foreach (ISARWhTax item in ARWhLine.Select())
{
decimal? _CuryAdjgAmt = payment.CuryOrigDocAmt > invoice.CuryDocBal ? invoice.CuryDocBal : payment.CuryOrigDocAmt;
decimal? _CuryAdjgDiscAmt = payment.CuryOrigDocAmt > invoice.CuryDocBal ? 0m : invoice.CuryDiscBal;
ARAdjust adj = new ARAdjust();
adj.AdjdBranchID = item.AdjdBranchID;
adj.AdjdDocType = ARInvoiceType.Invoice;
adj.AdjdRefNbr = item.AdjdRefNbr;
adj.AdjdCustomerID = item.CustomerID;
adj.AdjdDocDate = invoice.DocDate;
adj.CuryAdjgAmt = _CuryAdjgAmt;
adj.CuryAdjdDiscAmt = _CuryAdjgDiscAmt;
if (docGraph.Document.Current.CuryUnappliedBal == 0m && docGraph.Document.Current.CuryOrigDocAmt > 0m)
{
throw new PXLoadInvoiceException();
}
//This line code below OCCURS THE ERROR
docGraph.Adjustments.Insert(adj);
}
docGraph.Save.Press();
PXLongOperation.StartOperation(docGraph, delegate() { ARDocumentRelease.ReleaseDoc(list, false); });
}
catch (Exception ex)
{
throw new PXException(ex.Message);
}
}
I would look at the selector of the field causing the error ("Reference Nbr.") as having a selector on a field will validate the entered value to the selector's select statement (unless validatevalue=false for the selector). Maybe the selector will give you some pointers as to what is missing or causing the validation to fail.
I figured it out it that after the code below executes it does not immediately updates the View. So what I did is to execute my code at ARPayment_RowSelected event with a conditional statement if the document is released.
PXLongOperation.StartOperation(this.Base, delegate() { ARDocumentRelease.ReleaseDoc(list, false); });

Is it possible to call wcf webservice on adf mobile?

I tried to consume a wcf webservice method on adf mobile by using java api as seen as below code snippet.
I tried to run on classical adf generic application by creating webservice proxy. Then i could get response properly. But when i consume webservice method on adfmobile i get http 501 error response. I have tried using drag and drop into amx page and execute binding action, result is same.
What might be the reason?
brgds
private boolean validateClient()
{
List pnames = new ArrayList();
List pvals = new ArrayList();
List ptypes = new ArrayList();
pnames.add("UserName");
pvals.add("test");
ptypes.add(String.class);
pnames.add("Password");
pvals.add("123");
ptypes.add(String.class);
pnames.add("DeviceID");
pvals.add("123456");
ptypes.add(String.class);
GenericType result = null;
try
{
ClientDetail clientDetail = null;
result = (GenericType)AdfmfJavaUtilities.invokeDataControlMethod("mlService", null, "ValidateClient", pnames, pvals, ptypes);
for (int i = 0; i < result.getAttributeCount(); i++)
{
// Get each individual GenericType instance that holds the attribute key-value pairs
GenericType entityGenericType = (GenericType)result.getAttribute(i);
clientDetail = (ClientDetail)GenericTypeBeanSerializationHelper.fromGenericType(ClientDetail.class, entityGenericType);
}
if (clientDetail != null)
{
if (clientDetail.getIsValidate().booleanValue())
return true;
else
AdfmfContainerUtilities.invokeContainerJavaScriptFunction("com.accmee.menu", "navigator.notification.alert",
new Object[] { "No access",
"No access: ", "Ok" });
} else
{
AdfmfContainerUtilities.invokeContainerJavaScriptFunction("com.accmee.menu", "navigator.notification.alert",
new Object[] { "No access",
"No access: ", "Ok" });
return false;
}
}
catch (AdfInvocationException aie)
{
if (AdfInvocationException.CATEGORY_WEBSERVICE.compareTo(aie.getErrorCategory()) == 0)
{
throw new AdfException("Error with the server. Please try later.", AdfException.ERROR);
}
aie.printStackTrace();
throw new AdfException("Uzak veri sağlayısı çağrılırken hata oluştu", AdfException.ERROR);
}
return false;
}
make sure the WSDL URL is accessible from inside the test environment of the app ( emulator or mobile device)

Cannot open database "pubs" requested by the login. The login failed. Login failed for user 'ESLAM\Eslam_Nora'

Hello iam trying to store sum information inside a SQL Server table , but when i run the form and turned to store the data the above runtime error appears also the the pubs database icon in SQL Server is missing the (+) sign how come ! , i wrote that code for inserting , Thanks in advance.
public partial class Add_Client : Form
{
SqlConnection clientConnection;
string connString;
SqlCommand insertCommand;
public Add_Client()
{
InitializeComponent();
connString = "Data Source=.\\INSTANCE2;Initial Catalog=pubs; Integrated security=true ";
clientConnection = new SqlConnection();
clientConnection.ConnectionString = connString;
}
private void button1_ADD(object sender, EventArgs e)
{
try
{
SqlCommand insertCommand = new SqlCommand();
insertCommand.Connection = clientConnection;
insertCommand.CommandText = "INSERT INTO Client_Data values(#Client_Name,#Autorization_No,#Issue_Type,#Status)";
insertCommand.Parameters.Add("#Client_Name", SqlDbType.NVarChar, 60).Value = txt_Name.Text;
insertCommand.Parameters.Add("#Autorization_No", SqlDbType.Int, 60).Value = txt_Auth.Text.ToString();
insertCommand.Parameters.Add("#Issue_Type", SqlDbType.Text, 200).Value = txt_Iss.Text;
insertCommand.Parameters.Add("#Status", SqlDbType.Text, 200).Value = txt_Iss.Text;
//insertCommand.Parameters.Add("#Date To Memorize", SqlDbType.Date, 15).Value=Ca_Mem.se;
insertCommand.Connection.Open();
insertCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (clientConnection != null)
{
clientConnection.Close();
}
}
}
}
You use integrated security to access the database. Therefore your windows user needs to be authorized to access the database. Check the security settings for the server and the database.

Resources