コード例 #1
0
        protected static string build_pdescr(Shop.shop_item.shop_itemRow r, Shop.binded_tests bt)
        {
            string ret = "";

            ret += "<tr>";
            //if (r.rdr == -1)
            {
                string v = r.idx.ToString() + "_1_" + r.idx.ToString();
                string n = "buy_it_" + r.idx.ToString() + "_1_" + r.idx.ToString();
                ret += "<td><input type='checkbox' name='" + n + "' value='" + v + "'></td>";
            }

            ret += ("<td> <img src='i/package.gif' width='16' height='16'/>" + r.name + "</td>");
            ret += "</tr>";

            foreach (binded_tests.binded_testsRow i in bt._binded_tests.Rows)
            {
                if (i.idx == r.idx)
                {
                    if (i["ch_name"] != null && i["ch_name"].GetType() != typeof(System.DBNull))
                    {
                        string img = "package.gif";
                        if (i.type == 2)
                        {
                            img = "test.gif";
                        }
                        if (i.type == 3)
                        {
                            img = "pdf.gif";
                        }

                        string v = "";
                        // this is a hack for those packages who are members of sub package
                        if (i.type == 1)
                        {
                            v = i.chidx.ToString() + "_" + i.type.ToString() + "_" + i.chidx.ToString();
                        }
                        else
                        {
                            v = i.chidx.ToString() + "_" + i.type.ToString() + "_" + i.idx.ToString();
                        }
                        string n = "buy_it_" + i.chidx.ToString() + "_" + i.type.ToString() + "_" + i.idx.ToString();

                        ret += "<tr><td><input type='checkbox' name='" + n + "' value='" + v + "'/></td><td>&nbsp;&nbsp;<img src='i/" + img + "' width='16' height='16'/>" + i.ch_name + "</td></tr>";
                    }
                }
            }

            return(ret);
        }
コード例 #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>");
        }