moshimoshi
moshimoshi
Explore posts from servers
CC#
Created by moshimoshi on 4/19/2023 in #help
❔ Help needed to fix ASP.NET syntax errors
Here's my code in the js file:
function removeRow(index) {
$('input[name="quantity[' + index + ']"]').val(0);
updatePrice(carts, index); //removerow of each item in cart
}

function removeAll() {
$('input[name^="quantity"]').val(0);
updatePrice(carts, -1);
} //removeall items in cart

function updatePrice(carts, index) {
var quantity = parseInt($('input[name="quantity[' + index + ']"]').val());
var price = carts;
var total = quantity * price;
$('#totalPrice_' + index).text(total.toFixed(2));
var hiddenInputProductItemId = document.getElementById(index).value;
var hiddenIputCustomerId = document.getElementById("hidden-customer-id").value;
onLoadData(index, quantity, total, hiddenInputProductItemId, hiddenIputCustomerId);
}
function removeRow(index) {
$('input[name="quantity[' + index + ']"]').val(0);
updatePrice(carts, index); //removerow of each item in cart
}

function removeAll() {
$('input[name^="quantity"]').val(0);
updatePrice(carts, -1);
} //removeall items in cart

function updatePrice(carts, index) {
var quantity = parseInt($('input[name="quantity[' + index + ']"]').val());
var price = carts;
var total = quantity * price;
$('#totalPrice_' + index).text(total.toFixed(2));
var hiddenInputProductItemId = document.getElementById(index).value;
var hiddenIputCustomerId = document.getElementById("hidden-customer-id").value;
onLoadData(index, quantity, total, hiddenInputProductItemId, hiddenIputCustomerId);
}
Some snippets of the cshtml file:
@{
List<Cart> carts = ViewBag.Carts;
decimal price;
decimal? tprice = 0;
}

<div><h8 class="removeall" onclick="removeAll()">Remove all</h8></div>

@for (int i = 0; i < carts.Count; i++)
{
var totalprice = carts[i].price * carts[i].quantity;
carts[i].totalprice = totalprice;
tprice += totalprice;

<img class="trash_icon" onclick="removeRow(@carts[i].price,@i)" src="https://www.freeiconspng.com/uploads/trash-can-icon-24.png" width="30" height="30" alt="Icon Drawing Trash Can" />
</div>
<p class="subtotal">Subtotal: $<span id="totalPrice_@i">@carts[i].totalprice</span></p>
@{
List<Cart> carts = ViewBag.Carts;
decimal price;
decimal? tprice = 0;
}

<div><h8 class="removeall" onclick="removeAll()">Remove all</h8></div>

@for (int i = 0; i < carts.Count; i++)
{
var totalprice = carts[i].price * carts[i].quantity;
carts[i].totalprice = totalprice;
tprice += totalprice;

<img class="trash_icon" onclick="removeRow(@carts[i].price,@i)" src="https://www.freeiconspng.com/uploads/trash-can-icon-24.png" width="30" height="30" alt="Icon Drawing Trash Can" />
</div>
<p class="subtotal">Subtotal: $<span id="totalPrice_@i">@carts[i].totalprice</span></p>
Any help would be really appreciated. Thanks!
13 replies
CC#
Created by moshimoshi on 4/17/2023 in #help
❔ Running ASP.NET file in Rider
all guds i managed to resolve this hehe
7 replies
CC#
Created by moshimoshi on 4/14/2023 in #help
❔ Dependency injection & inheritance
Thank you for the clarifications!
10 replies
CC#
Created by moshimoshi on 4/14/2023 in #help
❔ Dependency injection & inheritance
perhaps can use interface yea? That would make more sense..!
10 replies
CC#
Created by moshimoshi on 4/14/2023 in #help
❔ Dependency injection & inheritance
I am planning to override some accessor methods
10 replies
CC#
Created by moshimoshi on 3/23/2023 in #help
✅ Heaps & Priority Queue
hahaha yeah i read some explanation online too! thanks 🙂
9 replies
CC#
Created by moshimoshi on 3/23/2023 in #help
✅ Heaps & Priority Queue
yes thats right
9 replies
CC#
Created by moshimoshi on 3/23/2023 in #help
✅ Heaps & Priority Queue
Haha, apologies for not being clear. My lecture slides had this written on it but had no clue what it meant - as an application of heap Priority Queues (e.g. CPU job-scheduling) • Give each runnable task a priority number • Execute the next runnable task with highest priority
9 replies
CC#
Created by moshimoshi on 3/19/2023 in #help
✅ Algorithm analysis
Ahhhhhh I see.. Got it now thank you sir 🙂
17 replies
CC#
Created by moshimoshi on 3/19/2023 in #help
✅ Algorithm analysis
Can you please walk me through how you arrived at that formula?
17 replies
CC#
Created by moshimoshi on 3/19/2023 in #help
✅ Algorithm analysis
f(n) = n^2/2 + n/2, which is O(n^2) Sorry this is the formula! Didnt type it properly
17 replies
CC#
Created by moshimoshi on 3/15/2023 in #help
✅ Why wont these SQL queries work?
Ah i managed to resolve this!!
5 replies
CC#
Created by moshimoshi on 3/15/2023 in #help
✅ Why wont these SQL queries work?
5 replies
CC#
Created by moshimoshi on 3/15/2023 in #help
✅ Why wont these SQL queries work?
Can I ask for this query in SQLite: I have created a view successfully called Customer1998. When I run this query
SELECT * FROM customer1998;
SELECT * FROM customer1998;
it gives me this error: Result: no such table: main.order details How can i Resolve this?
5 replies
CC#
Created by moshimoshi on 2/23/2023 in #help
❔ Polymorphism
can I ask, why dont the account field go into the constructor's args?
14 replies