logo
down
shadow

How to post ordered items without timeout to controller


How to post ordered items without timeout to controller

By : Magnus Braathen
Date : November 17 2020, 11:52 AM
This might help you HTML5 offline ASP.NET MVC4 application allows to enter order quantities and submit order for customer. , Ok, here is what I think your view should look like
code :
<!DOCTYPE html>
<html>
<body>
    @using (Html.BeginForm())
    {
        <table>
            @for (int i = 0; i < Model.Products.Count; i++)
            {
                <tr>
                    <td>@Model.Products[i].Id</td>
                    <td>
                        <input type="hidden" name="Products.Index" value="@i"/>
                        @Html.HiddenFor(m => Model.Products[i].Id)
                        @Html.TextBoxFor(m => Model.Products[i].Quantity, new { @class="quantity", type = "number", min = 0 })
                    </td>
                </tr>
            }
        </table>
        <input type="submit" value="Send order">
        @Html.HiddenFor(m => Model.CustomerId)
    }

    <script>
        $(function() {
            $("form").submit(function () {
                var elementsToSend = [];
                var quantityElements = $("input.quantity").filter(function(index, element) {
                    if ($(this).val() != 0) { return true; }
                    else{ return false;}
                });
                $.each(quantityElements, function (index, element) {
                    var productIndex = $(element).prevAll()[1];
                    var productIdElement = $(element).prevAll()[0];
                    elementsToSend.push(productIndex);
                    elementsToSend.push(productIdElement);
                    elementsToSend.push(element);
                });
                elementsToSend.push($("#CustomerId")[0]);
                var dataToPost = $(elementsToSend).serializeArray();
                //send elementsToSend via ajax
                $.post("/OfflineOrder/Order", dataToPost);
                return false;
            });
        })
    </script>
</body>
</html>
[HttpPost]
public ActionResult Order(string customerId, List<OrderedItems> products)
{
    .....
}


Share : facebook icon twitter icon
MySQL Query with first 20 items ordered by one field and rest ordered by name ASC

MySQL Query with first 20 items ordered by one field and rest ordered by name ASC


By : Ricardo
Date : March 29 2020, 07:55 AM
help you fix your problem I have a database table that has two fields , date and name. , It's a bit ugly, but you can do it in one query:
code :
SELECT name,
       `date`
  FROM (  SELECT @rank := @rank + 1 AS rank,
                 name,
                 `date`
            FROM (SELECT @rank := 0) dummy
            JOIN products
        ORDER BY `date` DESC, name) dateranked
ORDER BY IF(rank <= 20, rank, 21), name;
Set a total based on items ordered, two types, and sometimes one type will not be ordered.

Set a total based on items ordered, two types, and sometimes one type will not be ordered.


By : user2786563
Date : March 29 2020, 07:55 AM
may help you . Ok, I am kicking myself, because I had this giving me a total before, but now, It does not grab ALL items chosen for sale, and it does not total correctly. How do I get this to total correctly. There are two types of products and two tables populating these rows, one type is OrderIn_Id and the other is OrderOut_Id. The products are populating perfectly, just not getting a total, and gives me an error of underfined variable, if a person only chooses one type of product, like the OrderIn_id products, then PriceOut gives an error of undefined variable. Can you help? , Does this work?
code :
<?php
echo "<table class='middlecheckOut'> 
<tr>
<td class='td2'><b>Order ID: </b></td>
<td class='td2'><b>Product Name: </b></td>
<td class='td2'><b>Quantity: </b></td>
<td class='td2'><b>Price: </b></td>
</tr>";

if (isset($_GET['user_id'])) {     
    $user_id = $_GET['user_id']; 
} elseif (isset($_POST['user_id']))  {    
    $user_id = $_POST['user_id'];
} 

$display="SELECT * 
    FROM order_instate JOIN in_Product ON 
    order_instate.ip_id = in_product.ip_id
    WHERE user_id = '$user_id'; " ; 

$displayResult = @mysqli_query($dbhandle, $display)
            or die(mysqli_error($dbhandle));
$priceIn = 0;
while($row = mysqli_fetch_array($displayResult, MYSQLI_ASSOC)) { 
    if($row['orderIn_complete'] == "No") {      
echo "<tr>
<td class='td2'>" . $row['orderIn_id'] . " &nbsp&nbsp</td>
<td class='td2'>" . $row['ip_name'] . " &nbsp&nbsp</td>
<td class='td2'>" . $row['orderIn_quantity'] . " &nbsp&nbsp</td>
<td class='td2'>$" . $row['orderIn_total'] . " &nbsp&nbsp</td>
 </tr>";

 $priceIn += $row['orderIn_total'];
    }
 }

 if (isset($_GET['user_id'])) {     
    $user_id = $_GET['user_id']; 
} elseif (isset($_POST['user_id']))  {    
    $user_id = $_POST['user_id'];
} 

$display2="SELECT * 
    FROM order_outstate JOIN op_Product ON 
    order_outstate.op_id = op_product.op_id
    WHERE user_id = '$user_id'; " ; 

$displayResult = @mysqli_query($dbhandle, $display2)
            or die(mysqli_error($dbhandle));

$priceOut = 0;
while($row2 = mysqli_fetch_array($displayResult, MYSQLI_ASSOC)) { 
    if($row2['orderOut_complete'] == "No") {        
echo "<tr>
<td class='td2'>" . $row2['orderOut_id'] . " &nbsp&nbsp</td>
<td class='td2'>" . $row2['op_name'] . " &nbsp&nbsp</td>
<td class='td2'>" . $row2['orderOut_quantity'] . " &nbsp&nbsp</td>
<td class='td2'>$" . $row2['orderOut_total'] . " &nbsp&nbsp</td>
 </tr>";

 $priceOut += $row2['orderOut_total'];
    }
 }
echo "</table>";

$subtotal = 0;
$tax = 0;
$gtotal = 0;
$subtotal = number_format($priceIn + $priceOut, 2);
$tax = number_format($subtotal * .074, 2);
$gtotal = number_format($subtotal + $tax, 2);

?>
How to get list of ordered items in ASP.NET MVC4 form post method

How to get list of ordered items in ASP.NET MVC4 form post method


By : Lor
Date : March 29 2020, 07:55 AM
Any of those help Have you tried the techniques that Phil Haack described in the following blog post? http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx/
In short, you can use something like the following. It's better if you make the Products a property instead of a method call.
code :
@for (int i = 0; i < Model.Products.Length; i++) {
  <tr>
     <td>@Model.Products[i].Id</td>
     <td>
         @Html.HiddenFor(m => Model.Products[i].Title)
         @Html.TextBoxFor(m => Model.Products[i].Quantity)

     </td>
  </tr>
}
[HttpPost]
public ActionResult Order(string customerId, [Bind(Prefix = "Products")] IEnumerable<OrderedItems> Result)
{.....}
How Post the list of items from PartialView to controller?

How Post the list of items from PartialView to controller?


By : Uday Rakesh
Date : March 29 2020, 07:55 AM
hope this fix your issue You can use FormCollection. Assign item.DayName to input's name attribute:
PartialView(fragment):
code :
<li class="list-group-item">
      <input type="checkbox" name="@(item.DayName)Days" @if (item.Id > 0) { <text>checked</text> } /> @item.DayName
</li>
[HttpPost]
[RBAC]
public async Task<ActionResult> Create(UserProgramsViewModel model, FormCollection formCollection)
{
    model.Days = new List<DaysViewModel>();
    foreach(var key in formCollection.AllKeys.Where(x => x.Contains("Days")))
        model.Days.Add(new DaysViewModel { Id = formCollection[key] == "on" ? 1 : 0, DayName = key.Replace("Days", "")} );

     //other stuff...
}
MySQL query to find items ordered at least once that have not been ordered lately

MySQL query to find items ordered at least once that have not been ordered lately


By : user3555468
Date : March 29 2020, 07:55 AM
With these it helps I simplified the query and the table, but to give you some context: I have an "orders" table that contains all the items ordered by customers. I want to check which items have been ordered at least once in history, but then, for whatever reason, nobody ordered them anymore (in this case, 180 days but it's just an example).
code :
SELECT idItem
FROM orders
GROUP BY idItem
HAVING 0 = SUM(myDate > (CURRENT_DATE - INTERVAL 180 DAY))
Related Posts Related Posts :
  • TabIndex - hitting tab moves me to Address Bar - unable to work around this using Focus
  • Create JSON from string, to use as object
  • Jquery - How do I make ifModified:true work in .ajax request?
  • Jquery and create html on the fly
  • jQuery Validation not validating on button click
  • Jquery Draggable/Droppable appending multiple divs
  • jQuery selector not working properly. Possible Sizzle bug?
  • enable anchor in twitter bootstrap modal
  • jQuery keydown : Wait for previous event to finish
  • why magnific popup ajax box closes if clicked on content
  • JQPlot pie charts "jqplotDataClick" event fires multiple times
  • Show div as the page scrolls on div height
  • Keypress event for ajax call does not work
  • responsive/fluid jQGrid with Twitter Bootstrap
  • IE10 does not seem to fire load event
  • Remove tipTip tool tip
  • jquery datepicker changing unavailable dates in one instance
  • TableTools plugin export buttons are not working
  • Prepopulate jquery token input textbox
  • Open a fancybox link with ajax
  • Getting jQuery and AngularJS content assist / auto-complete in eclipse for standalone HTML "file"
  • TR alternate background colour with unequal number of TD
  • DATATABLE jQuery TH and TD alignment
  • Jquery UI Convert Select's to Range Slider
  • Change text in text field according to link that has been clicked
  • Animate addClass + removeClass transitions?
  • knockout ajax call data-BIND
  • How do I create a variable with a number based on an element's number position using jquery?
  • Prevent fixed position element from flickering during jQuery animation
  • points are not visible clearly in nvd3 ghaph
  • How to write a regular expression for IP address format
  • Animate 3 DIVs from right to left when page is loading.
  • How to pivot columns in free jqgrid 4.15.4
  • the jquery method works fine but when made as a function not working
  • Show/hide text doesn't work when targeting link within div
  • multiple autocomplete search input fields
  • Display image in cell using Jquery jTable
  • jQuery and Wordpress - Scripts not working
  • flickering when mouse over, .hover() show/hide div(s)
  • Using Django's JSONResponseMixin to respond to AJAX requests
  • Unable to render charts using Wicked PDF
  • Style to dynamically created elements
  • hover not working for items in list
  • Keep server session alive automatically based on activity / input, using JQuery
  • jQuery load() taking a long time
  • Change / Exchange values in textboxes on text change in jquery
  • Unslider arrow code overriding slider options
  • what is the traditional way of sorting search results?
  • Do the action when the DIV comes in the display area of the browser with jQuery
  • jQuery slideshow overlapping CSS ribbon
  • JQuery animate function dont work
  • problems charts jquery highcharts
  • How to reset the select box values in Jquery sumoselect Multi select plugin
  • css absolute position on top of another element
  • How use jQuery String variable in html body
  • Get a row from table in view on modal bootstrap using codeigniter
  • How to make the effect of a div that covers an other div when scrolling?
  • Data binding using a button
  • How do i replace all dot in string to Underscore?
  • grab non-sibling element with jquery
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org