|
You need to go back to your teacher or business analyst as they seem to have missed a rather vital piece of information.
Samkelo34 wrote: exceed 75% of their income
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
A couple of days down the track..
OP: How do I calculate 75% of NaN?
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
a. Maserati Ghibli S
b. £80,095
c. £5,000
d. 0%
e. £2,000
When can I expect delivery?
|
|
|
|
|
I have an string parameter with xml content in it. Basically the string have an XML inside.
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<InvoiceQueryRs requestID="0" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<InvoiceRet>
<TxnID>7-1623419127</TxnID>
<TimeCreated>2021-06-11T06:45:27-08:00</TimeCreated>
<TimeModified>2021-06-18T10:26:37-08:00</TimeModified>
<EditSequence>1624037197</EditSequence>
<TxnNumber>3</TxnNumber>
<CustomerRef>
<ListID>E0000-1624055316</ListID>
<FullName>*michael</FullName>
</CustomerRef>
<ARAccountRef>
<ListID>470000-1623418914</ListID>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TxnDate>2021-06-11</TxnDate>
<RefNumber>1</RefNumber>
<BillAddress>
<Addr1>*michael</Addr1>
</BillAddress>
<IsPending>false</IsPending>
<IsFinanceCharge>false</IsFinanceCharge>
<DueDate>2021-06-11</DueDate>
<ShipDate>2021-06-11</ShipDate>
<Subtotal>1200.00</Subtotal>
<ItemSalesTaxRef>
<ListID>10000-1623418832</ListID>
<FullName>Vat 14%</FullName>
</ItemSalesTaxRef>
<SalesTaxPercentage>14.00</SalesTaxPercentage>
<SalesTaxTotal>168.00</SalesTaxTotal>
<AppliedAmount>0.00</AppliedAmount>
<BalanceRemaining>1368.00</BalanceRemaining>
<IsPaid>false</IsPaid>
<IsToBePrinted>true</IsToBePrinted>
<CustomerSalesTaxCodeRef>
<ListID>10000-1623418756</ListID>
<FullName>Tax</FullName>
</CustomerSalesTaxCodeRef>
<InvoiceLineRet>
<TxnLineID>9-1623419127</TxnLineID>
<ItemRef>
<ListID>30000-1623418915</ListID>
<FullName>*م1</FullName>
</ItemRef>
<Desc>صنف رقم 1
</Desc>
<Quantity>10</Quantity>
<Rate>30.00</Rate>
<Amount>300.00</Amount>
<SalesTaxCodeRef>
<ListID>10000-1623418756</ListID>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>12-1623419127</TxnLineID>
<ItemRef>
<ListID>40000-1623418915</ListID>
<FullName>*م2</FullName>
</ItemRef>
<Desc>مواصفات ملابس 2</Desc>
<Quantity>15</Quantity>
<Rate>60.00</Rate>
<Amount>900.00</Amount>
<SalesTaxCodeRef>
<ListID>10000-1623418756</ListID>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>13-1623419127</TxnLineID>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>14-1623419127</TxnLineID>
<ItemRef>
<ListID>60000-1624037191</ListID>
<FullName>total</FullName>
</ItemRef>
<Amount>1200.00</Amount>
</InvoiceLineRet>
</InvoiceRet>
</InvoiceQueryRs>
</QBXMLMsgsRs>
</QBXML>
i want to Delete
<ListID> and
<ItemRef> with out delete
<FullName>*م1</FullName>
i need new file that format
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<InvoiceQueryRs requestID="0" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<InvoiceRet>
<TxnID>7-1623419127</TxnID>
<TimeCreated>2021-06-11T06:45:27-08:00</TimeCreated>
<TimeModified>2021-06-18T10:26:37-08:00</TimeModified>
<EditSequence>1624037197</EditSequence>
<TxnNumber>3</TxnNumber>
<CustomerRef>
<FullName>*michael</FullName>
</CustomerRef>
<ARAccountRef>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TxnDate>2021-06-11</TxnDate>
<RefNumber>1</RefNumber>
<BillAddress>
<Addr1>*michael</Addr1>
</BillAddress>
<IsPending>false</IsPending>
<IsFinanceCharge>false</IsFinanceCharge>
<DueDate>2021-06-11</DueDate>
<ShipDate>2021-06-11</ShipDate>
<Subtotal>1200.00</Subtotal>
<ItemSalesTaxRef>
<FullName>Vat 14%</FullName>
</ItemSalesTaxRef>
<SalesTaxPercentage>14.00</SalesTaxPercentage>
<SalesTaxTotal>168.00</SalesTaxTotal>
<AppliedAmount>0.00</AppliedAmount>
<BalanceRemaining>1368.00</BalanceRemaining>
<IsPaid>false</IsPaid>
<IsToBePrinted>true</IsToBePrinted>
<CustomerSalesTaxCodeRef>
<FullName>Tax</FullName>
</CustomerSalesTaxCodeRef>
<InvoiceLineRet>
<TxnLineID>9-1623419127</TxnLineID>
<FullName>*م1</FullName>
<Desc>صنف رقم 1
</Desc>
<Quantity>10</Quantity>
<Rate>30.00</Rate>
<Amount>300.00</Amount>
<SalesTaxCodeRef>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>12-1623419127</TxnLineID>
<FullName>*م2</FullName>
<Desc>مواصفات ملابس 2</Desc>
<Quantity>15</Quantity>
<Rate>60.00</Rate>
<Amount>900.00</Amount>
<SalesTaxCodeRef>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>13-1623419127</TxnLineID>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>14-1623419127</TxnLineID>
<FullName>total</FullName>
<Amount>1200.00</Amount>
</InvoiceLineRet>
</InvoiceRet>
</InvoiceQueryRs>
</QBXMLMsgsRs>
</QBXML>
How can I make file like above thanks
|
|
|
|
|
|
The simplest solution would be to use LINQ to XML:
Overview - LINQ to XML | Microsoft Docs[^]
string sourceXml = @"...";
XDocument document = XDocument.Parse(sourceXml);
List<XElement> elementsToRemove = document.Descendants("ListID").ToList();
foreach (XElement element in elementsToRemove)
{
element.Remove();
}
elementsToRemove = document.Descendants("ItemRef").ToList();
foreach (XElement element in elementsToRemove)
{
element.Remove();
}
string resultXml = document.ToString();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thanks for your response
this code remove all sub nodes in
ItemRef
but i need to keep the sub node
<FullName>*م1</FullName>
thanks
|
|
|
|
|
I have an application in MFC which creates shared memory using CreateFileMapping where I share a Struct object. In another console application in C++, I am accessing the shared memory using OpenFileMapping function and so the struct object is changed/accessed in both the applications.
Now, I want to redevelop my MFC Application in WPF C#. Is it possible to share the memory with the same console application as I have done earlier in MFC.
Please advise
|
|
|
|
|
I know that the latest .Net frameworks offer classes for file mapping. Search "C# File mapping"
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Is it possible that the 2 applications that share the memory (File mapping) be developed in C# and C++ respectively.
Example:
One application in C# to create shared memory
Other application 2 in C++ opens and shares the memory file mapping.
|
|
|
|
|
Memory-mapped files have been supported in .NET Framework since 4.0:
Memory-Mapped Files | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I have created one C# dll of .Net Framework 4.7.2. In this DLL, I want to deserialize the JSON file and when I have added the code for deserialization ,I got compilation error to install the NuGet package
After installing System.Text.Json NuGet package of latest version(5.0.2), dll builds successfully.
When I connect this Dll with the C++ application and calls the deserialization method of the DLL, at that time I got one run time exception stating that:
“Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.”
Solutions I Tried:
1) I tried to change in the app.config file with the value of the version which is specified in the error.
After changing in app. Config file , I got different run time exception:
“System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'”
I tried changing the version of System. Buffers also in config file, but still getting the same error.
2) I tried to install the System.Text.Json of version 4.7.2
In this version also I am getting the same System. Buffers error.
Note: If we use the .Net 5.0.0(Core version) then System.Text.Json already present in it as default but with this version we are not able the generate the .tlb file as Regasm.exe gives error while registering the dll and in .Net 5.0.0 Register for COM interop is also disabled.
Thank you in advance.
|
|
|
|
|
If your .DLL is written targeting .NET Framework 4.7.2, you can NOT use .NET Core 5.0 libraries.
Also, trying to just download those libraries and register them with RegAsm will NOT work.
What code did you write for handling the JSON files?
|
|
|
|
|
Dave Kreskowiak wrote: If your .DLL is written targeting .NET Framework 4.7.2, you can NOT use .NET Core 5.0 libraries.
System.Text.Json explicitly supports .NET Framework 4.6.1 or higher:
NuGet Gallery | System.Text.Json 5.0.2[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yeah, I forgot about .NET Standard Libraries.
|
|
|
|
|
The NuGet package you have referenced depends on other NuGet packages:
NuGet Gallery | System.Text.Json 5.0.2[^]
Specifically, for .NET Framework 4.x, it depends on:
- Microsoft.Bcl.AsyncInterfaces (>= 5.0.0)
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.4)
- System.Numerics.Vectors (>= 4.5.0)
- System.Runtime.CompilerServices.Unsafe (>= 5.0.0)
- System.Text.Encodings.Web (>= 5.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.ValueTuple (>= 4.5.0)
You will need to make sure all of those packages, and all of their dependencies (and their dependencies' dependencies etc.), are present in the same folder as your dll.
Alternatively, change your code to use Json.NET , which has no dependencies:
NuGet Gallery | Newtonsoft.Json 13.0.1[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I was trying to login to a site programmatically. i am loading site into web browser control. i tried this code but it did not worked. https://auth.accounts.dowjones.com/login
Sorry could not share actual credentials.
HtmlElement username = null;
HtmlElement password = null;
HtmlElement submit = null;
foreach (HtmlElement divcontainer in webBrowser1.Document.GetElementsByTagName("div"))
{
if (divcontainer.GetAttribute("className") == "text-input")
{
foreach (HtmlElement child in divcontainer.Children)
{
if (divcontainer.GetAttribute("className") == "js-email-input")
{
username = divcontainer;
}
if (divcontainer.GetAttribute("className") == "password js-password-input")
{
password = divcontainer;
}
}
}
if (divcontainer.GetAttribute("className") == "sign-in")
{
foreach (HtmlElement child in divcontainer.Children)
{
if (divcontainer.GetAttribute("className") == "solid-button basic-login-submit")
{
submit = divcontainer;
}
}
}
}
if (username != null && password != null && submit != null)
{
username.SetAttribute("value", "test@gmail.com");
password.SetAttribute("value", "test11");
submit.InvokeMember("click");
}
please some one guide me what to change in my code to automate login.
Thanks
|
|
|
|
|
This seems logical. What's not working?
"Did not work" does not help. Did it click the button? Did the text appear in the controls? Did it start playing Pacman?
|
|
|
|
|
the code i have mention in my post which is not filling textbox and not clicking button. so help me where i made the mistake?
|
|
|
|
|
Either you didn't wait for the page to finish loading, or the elements in the page don't match the elements you're looking for.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
 Issue sorted. i have done the job this way and it worked.
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (webBrowser1.ReadyState == WebBrowserReadyState.Complete && IsRedirect)
{
System.Threading.Thread.Sleep(5000);
timer1.Enabled = true;
}
else if (webBrowser1.ReadyState == WebBrowserReadyState.Complete && IsloginPage)
{
mshtml.IHTMLDocument2 htmlDocument = (mshtml.IHTMLDocument2) webBrowser1.Document.DomDocument;
mshtml.IHTMLElementCollection objforms = htmlDocument.forms;
foreach (mshtml.HTMLFormElementClass form in objforms)
{
if (form.className == "form")
{
IHTMLElementCollection inputElements = form.getElementsByTagName("INPUT");
foreach (HTMLInputElementClass inputElement in inputElements)
{
if ((inputElement.type.Trim().ToLower() == "email") && (inputElement.name.Trim() == "email"))
{
inputElement.value = "Test_UID@gmail.com";
}
else if ((inputElement.type.Trim().ToLower() == "password") && (inputElement.name.Trim() == "password"))
{
inputElement.value = "Test_PWD";
}
}
IHTMLElementCollection inputElements1 = form.getElementsByTagName("BUTTON");
foreach (HTMLButtonElementClass inputElement in inputElements1)
{
if ((inputElement.innerText.ToLower() == "sign in") && (inputElement.type.Trim().ToLower() == "submit")
&& (inputElement.tagName.Trim().ToLower() == "button"))
{
inputElement.click();
break;
}
}
}
}
}
}
Thanks
|
|
|
|
|
code curve in c#.image processing
|
|
|
|
|
Was that supposed to be a question?
|
|
|
|
|
Do you mean the Graphics.DrawArc Method (System.Drawing) | Microsoft Docs[^]?
If not, you are going to have to explain in a lot more details as we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hey,
I'm new to C# and coding in general. I've done some reading and online "hands-on" tutorials but I'm truly stuck here. Can someone please help me out and review the code I have written? I'm willing to put the time in to learn, I just don't know where to go from here.
I'm having a problem with my switch statement that involves different levels of commission rates, as well as getting the calculation to work. Also, on my last line it is giving me an error -- saying that "dblCalculateCommission" is an unassigned variable. I haven't had this problem on similar exercises. Appreciate any help, ready to pull my hair out!
private void btnCalculateCommission_Click(object sender, EventArgs e)
{
// declare variables to be used in the calculation
double dblSalesPersonLevel;
double dblAmountSold;
double dblCalculateCommission;
// convert the values in the text boxes to numeric and place into variables
dblSalesPersonLevel = Convert.ToDouble(txtSalesPersonLevel.Text);
dblAmountSold = Convert.ToDouble(txtAmountSold.Text);
// check the sales level is between 1 and 4, if it is outside of these parameters display an error message
if (dblSalesPersonLevel < 1)
{
MessageBox.Show("Sales level cannot be less than 1", "Input Error");
txtSalesPersonLevel.SelectAll();
txtSalesPersonLevel.Select();
}
else if (dblSalesPersonLevel > 4)
{
MessageBox.Show("Sales level cannot be greater that 4", "Input Error");
txtSalesPersonLevel.SelectAll();
txtSalesPersonLevel.Select();
}
// Calculate commissions based on sales person level
{
string strSalesPersonLevel;
strSalesPersonLevel = txtSalesPersonLevel.Text;
switch (strSalesPersonLevel)
{
case "1":
{
dblCalculateCommission = 500 + (dblAmountSold * 0.02);
break;
}
case "2":
{
dblCalculateCommission = 750 + (dblAmountSold * 0.03);
break;
}
case "3":
{
dblCalculateCommission = 1000 + (dblAmountSold * 0.04);
break;
}
case "4":
{
dblCalculateCommission = 1250 + (dblAmountSold * 0.05);
break;
}
}
// Convert commission into a string and place into a label with currency
//formatting
lblCalculateCommission.Text = dblCalculateCommission.ToString("C2");
|
|
|
|