Пример #1
0
        public void BarcodeTypeChanged(object sender, EventArgs e)
        {
            code.Barcode temporaryBarcode = FindSelectedBarcode();
            explanation.Controls.Add(new LiteralControl(temporaryBarcode.Explanation));

            DisplayKeys(temporaryBarcode.Keys, temporaryBarcode.SizeKeys);

            data1.Text = temporaryBarcode.SpecificText;

            HtmlControl control = temporaryBarcode.SpecificValue;

            data2.Controls.Clear();
            data2.Controls.Add(control);
        }
Пример #2
0
        public void GenerateClick(object sender, EventArgs e)
        {
            int scale;

            if (general_res3.Checked)
            {
                scale = 3;
            }
            else if (general_res2.Checked)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            string text = HttpUtility.UrlEncode(Request.Form[general_Text.UniqueID]);

            code.Barcode temporaryBarcode = FindSelectedBarcode();
            HtmlControl  control          = temporaryBarcode.SpecificValue;

            data2.Controls.Clear();
            data2.Controls.Add(control);

            string a1   = string.Empty;
            string a2   = string.Empty;
            string a3   = string.Empty;
            Type   type = control.GetType();

            if (type == typeof(HtmlInputCheckBox))
            {
                a1 = Request.Form[control.UniqueID];
                if (!string.IsNullOrEmpty(a1) && a1.Equals("1"))
                {
                    ((HtmlInputCheckBox)control).Checked = true;
                }
            }
            else if (type == typeof(HtmlSelect))
            {
                a2 = Request.Form[control.UniqueID];
                if (!string.IsNullOrEmpty(a2))
                {
                    foreach (ListItem item in ((HtmlSelect)control).Items)
                    {
                        item.Selected = item.Value.Equals(a2);
                    }
                }
            }
            else if (type == typeof(HtmlInputText))
            {
                a3 = Request.Form[control.UniqueID];
                if (!string.IsNullOrEmpty(a3))
                {
                    ((HtmlInputText)control).Value = a3;
                }
            }

            if (!string.IsNullOrEmpty(text))
            {
                imagerow.Visible      = true;
                barcodeimage.ImageUrl = string.Format("image.aspx?code={0}&o={1}&t={2}&r={3}&text={4}&f1={5}&f2={6}&a1={7}&a2={8}&a3={9}",
                                                      HttpUtility.UrlEncode(Request.Form[general_type.UniqueID]),
                                                      Request.Form[general_output.UniqueID],
                                                      Request.Form[general_thickness.UniqueID],
                                                      scale,
                                                      text,
                                                      HttpUtility.UrlEncode(Request.Form[general_font.UniqueID]),
                                                      Request.Form[general_fontsize.UniqueID],
                                                      a1,
                                                      a2,
                                                      a3);
            }
            else
            {
                imagerow.Visible = false;
            }
        }