コード例 #1
0
 protected void itemsDso_ObjectCreated(object sender, ObjectDataSourceEventArgs e)
 {
     Shop.shop_itemTableAdapters.shop_itemTableAdapter inst = (Shop.shop_itemTableAdapters.shop_itemTableAdapter)e.ObjectInstance;
     inst.SqlConnection = connection_;
 }
コード例 #2
0
        public static string show_user_basket(System.Data.SqlClient.SqlConnection conn, System.Web.HttpRequest req, AccessControl.AccessManager access_manager, System.Data.SqlClient.SqlTransaction tr)
        {
            System.Guid guididix = new System.Guid(req["guididx"]);

            Shop.shop_sold_item sold_items = new Shop.shop_sold_item();
            Shop.shop_sold_itemTableAdapters.shop_sold_itemTableAdapter ta = new Shop.shop_sold_itemTableAdapters.shop_sold_itemTableAdapter();
            ta.Connection = (System.Data.SqlClient.SqlConnection)access_manager.Connection;
            ta.FillByOwner(sold_items._shop_sold_item, guididix);

            Shop.shop_sold_item sold_items_sorted = sort_sold_items(sold_items);

            string left = "<form name='to_delete_items'><table border=0 cellpadding=0 cellspacing=0>";

            left += "<tr><td colspan='5'>Bought items</td></tr>";


            foreach (Shop.shop_sold_item.shop_sold_itemRow r in sold_items_sorted._shop_sold_item)
            {
                left += "<tr>";
                left += String.Format("<td><input type='checkbox' class='itt' style='border: none;' value='{0}' name='to_del_idx_{0}'/></td>", r.idx);
                left += String.Format("<td><img width='16' height='16' src='i/{0}'/></td>", (r.is_expired() || r.is_depleted())?"expired.gif":"blank.gif");
                string img = String.Format("<img width='16' height='16' src='i/{0}'/>", ((r.type == 1) ? "package.gif":(r.type == 2?"test.gif":"pdf.gif")));

                if (r.type != 1 && r.parent != -1)
                {
                    left += "<td width='10'>&nbsp;</td><td>" + img + r.name + "</td>";
                }
                else
                {
                    left += "<td colspan='2'>" + img + r.name + "</td>";
                }
                left += "</tr>";
            }
            if (sold_items_sorted._shop_sold_item.Rows.Count != 0)
            {
                left += "<tr><td colspan='5'><input value='Delete' type='button' style='itt' onclick='javascript:delete_bought_items();'></td></tr>";
            }

            left += "<tr><td colspan='5'><input type='hidden' name='guididx' value='" + guididix.ToString() + "'/></td></tr>";
            left += "</table></form>";

            //////////////////////////////////////////////////////////////////////////////////////////////

            string right = "<form name='to_purchase_items'><table border=0 cellpadding=0 cellspacing=0>";

            right += "<tr><td colspan='2'>Shop items</tr>";
            Shop.binded_tests bt = new Shop.binded_tests();
            Shop.binded_testsTableAdapters.binded_testsTableAdapter bta = new Shop.binded_testsTableAdapters.binded_testsTableAdapter();
            bta.Connection = conn;
            bta.Fill(bt._binded_tests);

            Shop.shop_item sh = new Shop.shop_item();
            Shop.shop_itemTableAdapters.shop_itemTableAdapter sha = new Shop.shop_itemTableAdapters.shop_itemTableAdapter();
            sha.Connection = conn;
            sha.Fill(sh._shop_item);

            foreach (shop_item.shop_itemRow r in sh._shop_item.Rows)
            {
                right += build_pdescr(r, bt);
            }


            right += "<tr><td colspan='2'><input value='Add to user' type='button' style='itt' onclick='javascript:add_selected_items();'></td></tr>";
            if (sh._shop_item.Rows.Count != 0)
            {
                right += "<tr><td colspan='2'><input type='hidden' name='guididx' value='" + guididix.ToString() + "'/></td></tr>";
            }
            right += "</table></form>";
            //////////////////////////////////////////////////////////////////////////////////////////////
            return("<table width='100%' border=0><tr><td valign='top' width='50%'>" + left + "</td><td width='50%' valign='top'>" + right + "</td></tr></table>");
        }