Пример #1
0
        protected void CommandCreate_Click(object sender, EventArgs e)
        {
            SessionObject userObject = (SessionObject)HttpContext.Current.Session["ID"];
            //HttpContext.Current.Session.Clear();
            CommandManager commandManager = new CommandManager(Int32.Parse(userObject.getUserID()), userObject.connector);

            commandManager.createCommand(Quantity.Text);
            int lastOrderID = commandManager.getLastCommand(Int32.Parse(userObject.getUserID()));
            BarCodeGenerator barCodeGenerator = new BarCodeGenerator(lastOrderID);

            commandManager.createCommandBarCode(barCodeGenerator.barcodecode + barCodeGenerator.controlKeystr);

            Msg.Text = lastOrderID.ToString();

            System.Drawing.Image image = barCodeGenerator.barcodeImage;

            Response.Clear();
            Response.ContentType = "image/png";
            Response.AppendHeader("Content-Disposition", "attachment; filename=downloadedFile.png");
            byte[] bytes = (byte[])(new ImageConverter()).ConvertTo(image, typeof(byte[]));
            Response.BinaryWrite(bytes);
            Response.End();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string         referer = Request.UrlReferrer.ToString();
            ButtonGenerate button  = new ButtonGenerate();

            button.createReturn(referer);
            DynButton.Text = button.getButton();



            SessionObject  userObject     = (SessionObject)HttpContext.Current.Session["ID"];
            CommandManager commandManager = new CommandManager(Int32.Parse(userObject.getUserID()), userObject.connector);

            List <string> list = commandManager.getHistoryList();

            foreach (string listdisplay in list)
            {
                Msg.Text += listdisplay + "<br>";
            }
        }