Search Results

Search found 713 results on 29 pages for 'quantity'.

Page 10/29 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • PayPal IPN - having trouble accessing session data?

    - by Martin Bean
    Hello, all. I'm having issues with PayPal IPN integration where it seems I cannot get my solution to read session variables. Basically, in my shop module script, I store the customer's details as provided by PayPal to an orders table. However, I also wish to save products ordered in a transaction to a separate table linked by the order ID. However, it's the second part of the script that's not working, where I loop through the products in the session and then save them to the orders_products table. Is there a reason why the session data not being read? The code within shop.php is as follows: if ($paypal->validate_ipn()) { $name = $paypal->ipn_data['address_name']; $street_1 = $paypal->ipn_data['address_street']; $street_2 = ""; $city = $paypal->ipn_data['address_city']; $state = $paypal->ipn_data['address_state']; $zip = $paypal->ipn_data['address_zip']; $country = $paypal->ipn_data['address_country']; $txn_id = $paypal->ipn_data['txn_id']; $sql = "INSERT INTO orders (name, street_1, street_2, city, state, zip, country, txn_id) VALUES (:name, :street_1, :street_2, :city, :state, :zip, :country, :txn_id)"; $smt = $this->pdo->prepare($sql); $smt->bindParam(':name', $name, PDO::PARAM_STR); $smt->bindParam(':street_1', $street_1, PDO::PARAM_STR); $smt->bindParam(':street_2', $street_2, PDO::PARAM_STR); $smt->bindParam(':city', $city, PDO::PARAM_STR); $smt->bindParam(':state', $state, PDO::PARAM_STR); $smt->bindParam(':zip', $zip, PDO::PARAM_STR); $smt->bindParam(':country', $country, PDO::PARAM_STR); $smt->bindParam(':txn_id', $txn_id, PDO::PARAM_INT); $smt->execute(); // save products to orders relationship $order_id = $this->pdo->lastInsertId(); // $cart = $this->session->get('cart'); $cart = $this->session->get('cart'); foreach ($cart as $product_id => $item) { $quantity = $item['quantity']; $sql = "INSERT INTO orders_products (order_id, product_id, quantity) VALUES ('$order_id', '$product_id', '$quantity')"; $res = $this->pdo->query($sql); } $this->session->del('cart'); mail('[email protected]', 'IPN result', 'IPN was successful on wrestling-wear.com'); } else { mail('[email protected]', 'IPN result', 'IPN failed on wrestling-wear.com'); } And I'm using the PayPal IPN class for PHP as found here: http://www.micahcarrick.com/04-19-2005/php-paypal-ipn-integration-class.html, but the contents of the validate_ipn() method is as follows: public function validate_ipn() { $url_parsed = parse_url($this->paypal_url); $post_string = ''; foreach ($_POST as $field => $value) { $this->ipn_data[$field] = $value; $post_string.= $field.'='.urlencode(stripslashes($value)).'&'; } $post_string.= "cmd=_notify-validate"; // append IPN command // open the connection to PayPal $fp = fsockopen($url_parsed[host], "80", $err_num, $err_str, 30); if (!$fp) { // could not open the connection. If logging is on, the error message will be in the log $this->last_error = "fsockopen error no. $errnum: $errstr"; $this->log_ipn_results(false); return false; } else { // post the data back to PayPal fputs($fp, "POST $url_parsed[path] HTTP/1.1\r\n"); fputs($fp, "Host: $url_parsed[host]\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ".strlen($post_string)."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $post_string . "\r\n\r\n"); // loop through the response from the server and append to variable while (!feof($fp)) { $this->ipn_response.= fgets($fp, 1024); } fclose($fp); // close connection } if (eregi("VERIFIED", $this->ipn_response)) { // valid IPN transaction $this->log_ipn_results(true); return true; } else { // invalid IPN transaction; check the log for details $this->last_error = 'IPN Validation Failed.'; $this->log_ipn_results(false); return false; } }

    Read the article

  • Storing a set of criteria in another table

    - by bendataclear
    I have a large table with sales data, useful data below: RowID Date Customer Salesperson Product_Type Manufacturer Quantity Value 1 01-06-2004 James Ian Taps Tap Ltd 200 £850 2 02-06-2004 Apple Fran Hats Hats Inc 30 £350 3 04-06-2004 James Lawrence Pencils ABC Ltd 2000 £980 ... Many rows later... ... 185352 03-09-2012 Apple Ian Washers Tap Ltd 600 £80 I need to calculate a large set of targets from table containing values different types, target table is under my control and so far is like: TargetID Year Month Salesperson Target_Type Quantity 1 2012 7 Ian 1 6000 2 2012 8 James 2 2000 3 2012 9 Ian 2 6500 At present I am working out target types using a view of the first table which has a lot of extra columns: SELECT YEAR(Date) , MONTH(Date) , Salesperson , Quantity , CASE WHEN Manufacturer IN ('Tap Ltd','Hats Inc') AND Product_Type = 'Hats' THEN True ELSE False END AS IsType1 , CASE WHEN Manufacturer = 'Hats Inc' AND Product_Type IN ('Hats','Coats') THEN True ELSE False END AS IsType2 ... ... , CASE WHEN Manufacturer IN ('Tap Ltd','Hats Inc') AND Product_Type = 'Hats' THEN True ELSE False END AS IsType24 , CASE WHEN Manufacturer IN ('Tap Ltd','Hats Inc') AND Product_Type = 'Hats' THEN True ELSE False END AS IsType25 FROM SalesTable WHERE [some stuff here] This is horrible to read/debug and I hate it!! I've tried a few different ways of simplifying this but have been unable to get it to work. The closest I have come is to have a third table holding the definition of the types with the values for each field and the type number, this can be joined to the tables to give me the full values but I can't work out a way to cope with multiple values for each field. Finally the question: Is there a standard way this can be done or an easier/neater method other than one column for each type of target? I know this is a complex problem so if anything is unclear please let me know. Edit - What I need to get: At the very end of the process I need to have targets displayed with actual sales: Type Year Month Salesperson TargetQty ActualQty 2 2012 8 James 2000 2809 2 2012 9 Ian 6500 6251 Each row of the sales table could potentially satisfy 8 of the types. Some more points: I have 5 different columns that need to be defined against the targets (or set to NULL to include any value) I have between 30 and 40 different types that need to be defined, several of the columns could contain as many as 10 different values For point 2, if I am using a row for each permutation of values, 2 columns with 10 values each would give me 100 rows for each sales person for each month which is a lot but if this is the only way to define multiple values I will have to do this. Sorry if this makes no sense!

    Read the article

  • LINQ InsertOnSubmit Required Fields needed for debugging

    - by Derek Hunziker
    Hi All, I've been using the ADO.NET Strogly-Typed DataSet model for about 2 years now for handling CRUD and stored procedure executions. This past year I built my first MVC app and I really enjoyed the ease and flexibility of LINQ. Perhaps the biggest selling point for me was that with LINQ I didn't have to create "Insert" stored procedures that would return the SCOPE_IDENTITY anymore (The auto-generated insert statements in the DataSet model were not capable of this without modification). Currently, I'm using LINQ with ASP.NET 3.5 WebForms. My inserts are looking like this: ProductsDataContext dc = new ProductsDataContext(); product p = new product { Title = "New Product", Price = 59.99, Archived = false }; dc.products.InsertOnSubmit(p); dc.SubmitChanges(); int productId = p.Id; So, this product example is pretty basic, right, and in the future, I'll probably be adding more fields to the database such as "InStock", "Quantity", etc... The way I understand it, I will need to add those fields to the database table and then delete and re-add the tables to the LINQ to SQL Class design view in order to refresh the DataContext. Does that sound right? The problem is that any new fields that are non-null are NOT caught by the ASP.NET build processes. For example, if I added a non-null field of "Quantity" to the database, the code above would still build. In the DataSet model, the stored procedure method would accept a certain amount of parameters and would warn me that my Insert would fail if I didn't include a quantity value. The same goes for LINQ stored procedure methods, however, to my knowledge, LINQ doesn't offer a way to auto generate the insert statements and that means I'm back to where I started. The bottom line is if I used insert statements like the one above and I add a non-null field to my database, it would break my app in about 10-20 places and there would be no way for me to detect it. Is my only option to do a solution-side search for the keyword "products.InsertOnSubmit" and make sure the new field is getting assigned? Is there a better way? Thanks!

    Read the article

  • Problem with View - it does not refresh after db update

    - by crocodillez
    Hi, I am working with small ASP.NET MVC project - online store. I have addToCart method which adds selected product to cart - it updates cart table in my db and showing cart view with its content. But I have problems. While db is updating correctly the view does not. I see that quantity of the product in my db is incremented correctly but quantity in view is not changed. I have to stop debugging my app in visual studia and restart it - then my view is showing correct data. What can be wrong?

    Read the article

  • Traverse list to add elements, C#.

    - by Addie
    I have a list of objects. Each object has an integer quantity and a DateTime variable which contains a month and year value. I'd like to traverse the list and pad the list by adding missing months (with quantity 0) so that all consecutive months are represented in the list. What would be the best way to accomplish this? Example: Original List { Jan10, 3 }, { Feb10, 4 }, { Apr10, 2 }, { May10, 2 }, { Aug10, 3 }, { Sep10, -3 }, { Oct10, 6 }, { Nov10, 3 }, { Dec10, 7 }, { Feb11, 3 } New List { Jan10, 3 }, { Feb10, 4 }, {Mar10, 0}, { Apr10, 2 }, { May10, 2 }, { Jun10, 0 }, { Jul10, 0 } { Aug10, 3 }, { Sep10, -3 }, { Oct10, 6 }, { Nov10, 3 }, { Dec10, 7 }, { Jan11, 0 }, { Feb11, 3 }

    Read the article

  • Custom Sorting on Custom Field in Django

    - by RotaJota
    In my app, I have defined a custom field to represent a physical quantity using the quantities package. class AmountField(models.CharField): def __init__(self, *args, **kwargs): ... def to_python(self, value): create_quantities_value(value) Essentially the way it works is it extends CharField to store the value as a string in the database "12 min" and represents it as a quantities object when using the field in a model array(12) * min Then in a model it is used as such: class MyModel(models.Model): group = models.CharField() amount = AmountField() class Meta: ordering = ['group', 'amount'] My issue is that these fields do not seem to sort by the quantity, but instead by the string. So if I have some objects that contain something like {"group":"A", "amount":"12 min"} {"group":"A", "amount":"20 min"} {"group":"A", "amount":"2 min"} {"group":"B", "amount":"20 min"} {"group":"B", "amount":"1 hr"} they end up sorted something like this: >>> MyModel.objects.all() [{A, 12 min}, {A, 2 min}, {A, 20 min}, {B, 1 hr}, {B, 20 min}] essentially alphabetical order. Can I give my custom AmountField a comparison function so that it will compare by the python value instead of the DB value?

    Read the article

  • Why am I getting unexpected output trying to write a hash structure to a file?

    - by Harm De Weirdt
    I have a hash in which I store the products a customer buys (%orders). It uses the product code as key and has a reference to an array with the other info as value. At the end of the program, I have to rewrite the inventory to the updated version (i.e. subtract the quantity of the bought items) This is how I do rewrite the inventory: sub rewriteInventory{ open(FILE,'>inv.txt'); foreach $key(%inventory){ print FILE "$key\|$inventory{$key}[0]\|$inventory{$key}[1]\|$inventory{$key}[2]\n" } close(FILE); } where $inventory{$key}[x] is 0 → Title, 1 → price, 2 → quantity. The problem here is that when I look at inv.txt afterwards, I see things like this: CD-911|Lady Gaga - The Fame|15.99|21 ARRAY(0x145030c)||| BOOK-1453|The Da Vinci Code - Dan Brown|14.75|12 ARRAY(0x145bee4)||| Where do these ARRAY(0x145030c)||| entries come from? Or more important, how do I get rid of them?

    Read the article

  • how can I get data in the table cell that is checked after submit

    - by arnold
    can someone give me help, please. here's my basic html <form action="addSomething.php" method="POST"> <table> <tr> <th>Add Data</th> <th>Description</th> <th>Quantity</th> </tr> <tr> <td><input type="checkbox" name="data[]" value="sample1" /> </td> <td class="desc">Newbie</td> <td>2</td> </tr> <tr> <td><input type="checkbox" name="data[]" value="sample1" /> </td> <td class="desc">Pro</td> <td>1</td> </tr> <tr> <td><input type="checkbox" name="data[]" value="sample1"/> </td> <td class="desc" > Master </td> <td>1</td> </tr> <br/> <input type="submit" name="add" value="SUBMIT"/> ..... how can I get the one with the class "desc" and the column for quantity that is checked after submitting the form because the only I can add when querying in mysql is the value of checkbox but I want also the value of the data in "Description" column and "Quantity" column In my addSomething.php the code I have is if(isset($_POST['add'])) { foreach($_POST['data'] as $value) { $sql = "INSERT INTO tablename (column1) VALUES('$value');" //query stuff } } what I will do , Any hints guys?

    Read the article

  • Access: Reading deleted record buffer

    - by Michael Itzoe
    According to the Access (2003) documentation, when you delete a record, it's placed in a buffer, then the BeforeDeleteConfirm event is raised, then the AfterConfirmDelete ad Delete events. In my table if a record is deleted, I need to add one of its field values (a quantity value) to a field in another table. I tried setting the quantity to a private variable in the Current event, but as soon as I delete click delete, it looks like the Current event fires again and resets my variable. How can I access the value of a field in a deleted record?

    Read the article

  • How to access and work with XML from API in C#

    - by Jarek
    My goal is to pull XML data from the API and load it to a sql server database. The frist step I'm attempting here is to access the data and display it. Once I get this to work I'll loop through each row and insert the values into a sql server database. When I try to run the code below nothing happens and when I paste the url directly into the browser I get this error "2010-03-08 04:24:17 Wallet exhausted: retry after 2010-03-08 05:23:58. 2010-03-08 05:23:58" To me it seems that every iteration of the foreach loop makes a call to the site and I get blocked for an hour. Am I retrieving data from the API in an incorrect manner? Is there some way to load the data into memory or an array then loop through that? Here's the bit of code I hacked together. using System; using System.Data.SqlClient; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Xml; using System.Data; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { try { string userID = "123"; string apiKey = "abc456"; string characterID = "789"; string url = "http://api.eve-online.com/char/WalletTransactions.xml.aspx?userID=" + userID + "&apiKey=" + apiKey + "&characterID=" + characterID; XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(url); XmlNamespaceManager xnm1 = new XmlNamespaceManager(xmldoc.NameTable); XmlNodeList nList1 = xmldoc.SelectNodes("result/rowset/row", xnm1); foreach (XmlNode xNode in nList1) { Response.Write(xNode.InnerXml + "<br />"); } } catch (SqlException em) { Response.Write(em.Message); } } } Here's a sample of the xml <eveapi version="2"> <currentTime>2010-03-06 17:38:35</currentTime> <result> <rowset name="transactions" key="transactionID" columns="transactionDateTime,transactionID,quantity,typeName,typeID,price,clientID,clientName,stationID,stationName,transactionType,transactionFor"> <row transactionDateTime="2010-03-06 17:16:00" transactionID="1343566007" quantity="1" typeName="Co-Processor II" typeID="3888" price="1122999.00" clientID="1404318579" clientName="unseenstrike" stationID="60011572" stationName="Osmeden IX - Moon 6 - University of Caille School" transactionType="sell" transactionFor="personal" /> <row transactionDateTime="2010-03-06 17:15:00" transactionID="1343565894" quantity="1" typeName="Co-Processor II" typeID="3888" price="1150000.00" clientID="1404318579" clientName="unseenstrike" stationID="60011572" stationName="Osmeden IX - Moon 6 - University of Caille School" transactionType="sell" transactionFor="personal" /> </rowset> </result> <cachedUntil>2010-03-06 17:53:35</cachedUntil> </eveapi>

    Read the article

  • Traverse list to add elements using .NET

    - by Addie
    I have a list of objects. Each object has an integer quantity and a DateTime variable which contains a month and year value. I'd like to traverse the list and pad the list by adding missing months (with quantity 0) so that all consecutive months are represented in the list. What would be the best way to accomplish this? Example: Original List { Jan10, 3 }, { Feb10, 4 }, { Apr10, 2 }, { May10, 2 }, { Aug10, 3 }, { Sep10, -3 }, { Oct10, 6 }, { Nov10, 3 }, { Dec10, 7 }, { Feb11, 3 } New List { Jan10, 3 }, { Feb10, 4 }, {Mar10, 0}, { Apr10, 2 }, { May10, 2 }, { Jun10, 0 }, { Jul10, 0 } { Aug10, 3 }, { Sep10, -3 }, { Oct10, 6 }, { Nov10, 3 }, { Dec10, 7 }, { Jan11, 0 }, { Feb11, 3 }

    Read the article

  • Django Grouping Query

    - by Matt
    I have the following (simplified) models: class Donation(models.Model): entry_date = models.DateTimeField() class Category(models.Model): name = models.CharField() class Item(models.Model): donation = models.ForeignKey(Donation) category = models.ForeignKey(Category) I'm trying to display the total number of items, per category, grouped by the donation year. I've tried this: Donation.objects.extra(select={'year': "django_date_trunc('year', %s.entry_date)" % Donation._meta.db_table}).values('year', 'item__category__name').annotate(items=Sum('item__quantity')) But I get a Field Error on item__category__name. I've also tried: Item.objects.extra(select={"year": "django_date_trunc('year', entry_date)"}, tables=["donations_donation"]).values("year", "category__name").annotate(items=Sum("quantity")).order_by() Which generally gets me what I want, but the item quantity count is multiplied by the number of donation records. Any ideas? Basically I want to display this: 2010 - Category 1: 10 items - Category 2: 17 items 2009 - Category 1: 5 items - Category 3: 8 items

    Read the article

  • Cannot implicitly convert type System.Collection.Generic.IEnumberable

    - by Cen
    I'm receiving this error in my Linq statement --- Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'hcgames.ObjectClasses.ShoppingCart.ShoppingCartCartAddon'. An explicit conversion exists (are you missing a cast?) From this query ShoppingCartItems items = Cart.GetAllItems(); ShoppingCartCartAddons addons = Cart.GetAllAddons(); var stuff = from x in items select new ShoppingCartItem() { ProductID = x.ProductID, Quantity = x.Quantity, Name = x.Name, Price = x.Price, Weight = x.Weight, Addons = (from y in addons where y.ShoppingCartItemID == x.ID select y) }; I can not figure out how to cast this properly. Any suggestions? Thanks for your help!

    Read the article

  • mysql select from multiple table

    - by Loon Yew
    I have 3 tables with values like below tbl_product recID pID price colour 1 BDPLA-0001 1.23 White 2 BDPLA-0002 2.23 Black 3 BDPLA-0003 2.28 Blue tbl_product_size recID pID size stock 1 1 2.0cm 10 2 1 3.0cm 20 3 2 2.5cm 30 4 3 3.6cm 40 5 3 3.8cm 50 tbl_order_details recID pID quantity size 201 BDPLA-0001 5 2.0cm 202 BDPLA-0002 10 2.5cm tbl_product.recID = tbl_product_size.pID tbl_product.pID = tbl_order_details.pID how can i combine the tables and produce result like this pID size stock quantity price BDPLA-0001 2.0cm 10 5 1.23 BDPLA-0001 3.0cm 20 null 1.23 BDPLA-0002 2.5cm 30 10 2.23 BDPLA-0003 3.6cm 40 null 2.28 BDPLA-0003 3.8cm 50 null 2.28

    Read the article

  • LINQ-to-XML to DataGridView: Cannot edit fields -- How to fix?

    - by Pretzel
    I am currently doing LINQ-to-XML and populating a DataGridView with my query just fine. The trouble I am running into is that once loaded into the DataGridView, the values appear to be Un-editable (ReadOnly). Here's my code: var barcodes = (from src in xmldoc.Descendants("Container") where src.Descendants().Count() > 0 select new { Id = (string)src.Element("Id"), Barcode = (string)src.Element("Barcode"), Quantity = float.Parse((string)src.Element("Quantity").Attribute("value")) }).Distinct(); dataGridView1.DataSource = barcodes.ToList(); I read somewhere that the "DataGridView will be in ReadOnly mode when you use Anonymous types." But I couldn't find an explanation why or exactly what to do about it. Any ideas?

    Read the article

  • ruby in 100 minutes good_morning method issue

    - by user2525947
    I have been doing the Ruby in 100 minutes on the JumpStart labs website, and encountered a problem during part 5. I was asked to create a good_morning method that would print out a greeting such as 'Happy Monday, it's the 130 day of 2013'. Here is my current program: class PersonalChef def good_morning today = Date.today.strftime("%A") day_of_year = Date.today.yday puts "Happy#{today}! It is the #{day_of_year} day of year." return self end def make_toast(color) puts " Making your toast #{color}!" return self end def make_milkshake(flavor) puts " Making a #{flavor} milkshake!" return self end def make_eggs(quantity) puts " Making you #{quantity} eggs!" return self end end when I try to run the program load on irb( 'personal_chef.rb', frank = PersonalChef.new, frank.make_milkshake('chocolate'), etc, everything works fine until I try to type frank.good_morning into irb, which gives the following error message: NameError: uninitialized constant PersonalChef :: Date from personal_chef.rb:5: in good_morning from (irb):3 from /bin/irb:12:in '' Any help or information to help me solve this issue would be greatly appreciated. Thanks for your time!

    Read the article

  • Can I do transactions and locks in CouchDB?

    - by damian
    I need to do transactions (begin, commit or rollback), locks (select for update). How can I do it in a document model db? Edit: The case is this: I want to run an auctions site. And I think how to direct purchase as well. In a direct purchase I have to decrement the quantity field in the item record, but only if the quantity is greater than zero. That is why I need locks and transactions. I don't know how to address that without locks and/or transactions. Can I solve this with CouchDB?

    Read the article

  • symfony 2 verify type of data stored in a single column

    - by GRafoKI
    In my DB I have a column 'own_product' that contains 2 values ( quantity and name) In my Edit form I want to check if the first field (quantity) is string and positive or not. I added a new column 'type-prod' (int , string) this is my controller : $request = $this->container->get('request'); if ($request->getMethod() == 'POST') { $formel = $request->query->get('edit_formal'); $type_value = $formel['own_product']; //case int $type_int= $this ->getDoctrine() ->getEntityManager() ->getRepository('DHG\WelcomeBundle\Entity\type-prod') ->findOneBy(array('type' => 'int')); //case string $type_string = $this ->getDoctrine() ->getEntityManager() ->getRepository('DHG\WelcomeBundle\Entity\type-prod') ->findOneBy(array('type' => 'string')); if (isset($type_value) && $type_int && $type_value > 0 && is_int($type_value)) { echo 'Success'; } else echo 'error' ; } Thank you !

    Read the article

  • MySQL date query only returns one year, when multiple exist

    - by Bowman
    I'm a part-time designer/developer with a part-time photography business. I've got a database of photos with various bits of metadata attached. I want to query the database and return a list of the years that photos were taken, and the quantity of photos that were taken in that year. In short, I want a list that looks like this: 2010 (35 photos) 2009 (67 photos) 2008 (48 photos) Here's the query I'm using: SELECT YEAR(date) AS year, COUNT(filename) as quantity FROM photos WHERE visible='1' GROUP BY 'year' ORDER BY 'year' DESC Instead of churning out all the possible years (the database includes photos from 2010-2008), this is the sole result: 2010 (35 photos) I've tried a lot of different syntax but at this point I'm giving in and asking for help!

    Read the article

  • why won't my ajax work asynchronously

    - by payling
    I'm having trouble understanding why my code will not work asynchronously. When running asynchronously the get_price.php always receives the same $_GET value even though the alert before outputs a unique $_GET value. var arraySize = "<? echo count($_SESSION['items']); ?>"; //get items count var pos = 0; var pid; var qty; getPriceAjax(); function getPriceAjax() { pid = document.cartItemForm.elements[pos].id; //product id qty = document.cartItemForm.elements[pos].value; //quantity alert('Product: ' + pid + ' Quantity: ' + qty); $.ajax({ url:"includes/ajax_php/get_price.php", type:"GET", data:'pid='+pid+'&qty='+qty, async:true, cache:false, success:function(data){ while(pos < arraySize) { document.getElementById(pid + 'result').innerHTML=data; pos++; getPriceAjax(); } } }) }

    Read the article

  • Asp.net razor textbox array for list items

    - by yycdev
    I can't find or figure out how to take a list of items (cupcakes) and display them in razor with a quantity field. What is happening is I am not able to get the values for each cupcake quantity in the list. Can you do textbox arrays in Razor? VIEW <div class="form-group"> <label>Cupcakes</label> @foreach (var cupcake in Model.CupcakeList) { @Html.TextBox("CupcakeQuantities", cupcake.Id) @cupcake.Name <br/> } </div> MODEL public List<Cupcake> CupcakeList { get; set; } public List<int> CupcakeQuantities { get; set; } CONTROLLER public ActionResult Create() { var model = new PartyBookingModel() { CupcakeList = db.Cupcakes.ToList(), CupcakeQuantities = new List<int>() }; return View(model); }

    Read the article

  • Fluent nHibernate - How to map a non-key column on an association table?

    - by The Matt
    Taking an example that is provided on the Fluent nHibernate website, I need to extend it slightly: I need to add a 'Quantity' column to the StoreProduct table. How would I map this using nHibernate? An example mapping is provided for the given scenario above, but I'm not sure how I would get the Quantity column to map: public class StoreMap : ClassMap<Store> { public StoreMap() { Id(x => x.Id); Map(x => x.Name); HasMany(x => x.Employee) .Inverse() .Cascade.All(); HasManyToMany(x => x.Products) .Cascade.All() .Table("StoreProduct"); } }

    Read the article

  • Why does Custom UITableViewCell *sometimes* cause an NSInvalidArgumentException?

    - by Wayne Hartman
    I have created a custom UITableViewCell, but when I dequeue the cell, sometimes it throws an NSInvalidArgumentException: [UITableViewCell nameLabel]: unrecognized selector sent to instance 0x3b4e7f0 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[UITableViewCell nameLabel]: unrecognized selector sent to instance 0x3b4e7f0' Now, my custom UITableViewCell does have an attribute nameLabel, so I am confused why it is throwing this error. Below is the code I use to dequeue the cell: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; CTMenuItemVO* key = [[[self retrieveCartItems] allKeys] objectAtIndex:row]; NSNumber* quantity = [[self retrieveCartItems] objectForKey:key]; static NSString* SectionsTableIdentifier = @"SectionsTableIdentifier2"; OrderItemCell* cell = (OrderItemCell*)[tableView dequeueReusableCellWithIdentifier: SectionsTableIdentifier]; if (cell == nil) { NSArray* topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"OrderItemCell" owner:nil options:nil]; for(id currentObject in topLevelObjects) { if ([currentObject isKindOfClass:[UITableViewCell class]]) { cell = (OrderItemCell*) currentObject; break; } } } cell.nameLabel.text = key.Name; cell.qtyLabel.text = [quantity stringValue]; return cell; }

    Read the article

  • DJANGO complex modelling

    - by SledgehammerPL
    Hello. I have such model now: receipt contains components. component contain product. The difference between component and product is, that component has quantity and measure unit: eg. component is 100g sugar - sugar is a product. So I need to make lots of components to satisfy different recipes - 100g sugar is not equal 200g sugar I wonder if I can remodel it to kick off components - in pure sql it's rather easy, but I'm trying to USE django - not making workarounds. class Receipt(models.Model): name = models.CharField(max_length=128) (...) components = models.ManyToManyField(Component) class Component(models.Model): quantity = models.FloatField(max_length=9) unit = models.ForeignKey(Unit) product = models.ForeignKey(Product) class Product(models.Model): name = models.CharField(max_length = 128) TIA

    Read the article

  • How To Query Many-to-Many Table (one table's values becomes column headers)

    - by CRice
    Given this table structure, I want to flatten out the many-to-many relationships and make the values in the Name field of one table into column headers and the quantities from the same table into column values. The current idea which will work is to put the values into a Dictionary (hashtable) and represent this data in code but im wondering if there is a SQL way to do this. I am also using Linq-to-SQL for data access so a Linq-to-SQL solution would be ideal. [TableA] (int Id) [TableB] (int id, string Name) [TableAB] (int tableAId, int tableBId, int Quantity) fk: TableA.Id joins to TableAB.tableAId fk: TableB.Id joins to TableAB.tableBId Is there a way I can query the three tables and return one result for example: TableA [Id] 1 TableB [Id], [Name] 1, "Red" 2, "Green" 3, "Blue" TableAB [TableAId], [TableBId], [Quantity] 1 1 5 1 2 6 1 3 7 Query Result: [TableA.Id], [Red], [Green], [Blue] 1, 5, 6, 7

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >