Ejemplo n.º 1
0
        public static string  Generate(string Text)
        {
            //https://stackoverflow.com/questions/6453640/how-to-include-external-font-in-wpf-application-without-installing-it/22669818
            string barCode = Text;

            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            using (Bitmap bitMap = new Bitmap(barCode.Length * 40, 80))
            {
                using (Graphics graphics = Graphics.FromImage(bitMap))
                {
                    string Fontpath = HttpContext.Current.Server.MapPath("~/fonts/fre3of9x.ttf");
                    //  FontFamily ffm = new FontFamily(Fontpath, 'fre3of9x');
                    //GlyphTypeface ttf = new GlyphTypeface(new Uri(Fontpath));
                    Font       oFont      = new Font("", 16);
                    PointF     point      = new PointF(2f, 2f);
                    SolidBrush blackBrush = new SolidBrush(Color.Black);
                    SolidBrush whiteBrush = new SolidBrush(Color.White);
                    graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
                    graphics.DrawString("*" + barCode + "*", oFont, blackBrush, point);
                }
                using (MemoryStream ms = new MemoryStream())
                {
                    bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] byteImage = ms.ToArray();

                    Convert.ToBase64String(byteImage);
                    imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
            }
            return(imgBarCode.ImageUrl);
        }
Ejemplo n.º 2
0
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            DateTime aDate = DateTime.Now;
            string   code  = txtQRCode.Text + " " + aDate;
            var      data  = new Lessons
            {
                ders     = lesUser.ders,
                Kredi    = lesUser.Kredi,
                derskodu = lesUser.derskodu,
                QrVal    = code
            };
            FirebaseResponse response  = client.Update(@"Dersler/" + denemeders, data);
            QRCodeGenerator  qrOlustur = new QRCodeGenerator();

            QRCodeGenerator.QRCode          qrCode     = qrOlustur.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q);
            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            imgBarCode.Height = 250;
            imgBarCode.Width  = 250;
            using (Bitmap bitMap = qrCode.GetGraphic(20))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] byteImage = ms.ToArray();
                    imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
                PlaceHolder1.Controls.Add(imgBarCode);
            }
        }
        /***********Method  GetSlide Added by:Zeeshan*******/
        public Slide GetSlide(int slideNumber)
        {
            try
            {
                //build URI to get slide count
                string strURI = Product.BaseProductUri + "/slides/" + FileName + "/slides/" + slideNumber;

                string signedURI = Utils.Sign(strURI);

                Stream responseStream = Utils.ProcessCommand(signedURI, "GET");

                StreamReader reader  = new StreamReader(responseStream);
                string       strJSON = reader.ReadToEnd();

                System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();

                //Parse the json string to JObject
                JObject parsedJSON = JObject.Parse(strJSON);

                //Deserializes the JSON to a object.
                SlideDetailResponse slidesResponse = JsonConvert.DeserializeObject <SlideDetailResponse>(parsedJSON.ToString());

                return(slidesResponse.Slide);
            }
            catch (Exception ex)
            { throw ex; }
        }
        public static void QRGenerator(string MandateID, string EntityId, string Refrence1, string AppId)
        {
            QuickCheck_AngularEntities dbcontext = new QuickCheck_AngularEntities();
            string          code        = MandateID + "_" + Refrence1;
            QRCodeGenerator qrGenerator = new QRCodeGenerator();

            QRCodeGenerator.QRCode          qrCode     = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.H);
            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            imgBarCode.Height = 250;
            imgBarCode.Width  = 250;
            using (Bitmap bitMap = qrCode.GetGraphic(20))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] byteImage = ms.ToArray();
                    imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                    string result = Convert.ToBase64String(byteImage, 0, byteImage.Length);
                    string check  = CreateImage(result.ToString(), MandateID, AppId);
                    if (check != "")
                    {
                        var Result = dbcontext.MultipleResults("[dbo].[Sp_Mandate]").Execute("@QueryType", "@EntityId", "@MandateId", "@QRCodeImagepath", "QRCodeImagepath", EntityId, MandateID, check);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public static Image QrcodeGenerator(string url, string pic)
        {
            var qrGenerator = new QRCodeGenerator();
            var imgBarCode  = new Image();

            imgBarCode.Height = 150;
            imgBarCode.Width  = 150;
            var qrCodeData = qrGenerator.CreateQrCode(url, QRCodeGenerator.ECCLevel.Q);
            var qrCode     = new QRCode(qrCodeData);

            using (var qrCodeImage = qrCode.GetGraphic(20))
            {
                // Set the image inside the QR code
                var path = pic;
                var logo = System.Drawing.Image.FromFile(path);
                logo = resizeImage(logo, new Size(200, 200)); // Use the method created
                var left = qrCodeImage.Width / 2 - logo.Width / 2;
                var top  = qrCodeImage.Height / 2 - logo.Height / 2;
                var g    = Graphics.FromImage(qrCodeImage);
                g.DrawImage(logo, new Point(left, top));
                //
                using (var ms = new MemoryStream())
                {
                    qrCodeImage.Save(ms, ImageFormat.Png);
                    var byteImage = ms.ToArray();
                    imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
            }

            return(imgBarCode);
        }
Ejemplo n.º 6
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["supplierId"], out supplierId))
            {
                return;
            }

            SupplierInfo shipper = SupplierHelper.GetSupplier(this.supplierId);

            if (shipper == null)
            {
                return;
            }

            this.litStoreName = (System.Web.UI.WebControls.Literal) this.FindControl("litStoreName");

            this.litStoreOwnerName = (System.Web.UI.WebControls.Literal) this.FindControl("litStoreOwnerName");

            this.litStoreAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litStoreAddress");

            this.SupplierADImg = (System.Web.UI.WebControls.Image) this.FindControl("SupplierADImg");

            this.litStoreName.Text = string.IsNullOrWhiteSpace(shipper.ShopName) ? shipper.SupplierName : shipper.ShopName; //shipper.SupplierName;

            this.litStoreOwnerName.Text = shipper.ShopOwner;

            this.litStoreAddress.Text = RegionHelper.GetFullRegion(shipper.County, "");

            if (!string.IsNullOrWhiteSpace(shipper.PCImage))
            {
                this.SupplierADImg.ImageUrl = shipper.PCImage;
            }
        }
Ejemplo n.º 7
0
        protected void savedSearchResultsRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem)
            {
                System.Data.DataRowView currentRow = e.Item.DataItem as System.Data.DataRowView;
                string itemLinkValue = currentRow["HitHighlightedPropertiesXml"] as string;

                System.Xml.Linq.XElement xEl            = System.Xml.Linq.XElement.Parse(itemLinkValue);
                System.Xml.Linq.XElement hhTitleElement =
                    (from node in xEl.Elements()
                     where node.Name == "HHTitle"
                     select node).FirstOrDefault();

                System.Xml.Linq.XElement hhUrlElement =
                    (from node in xEl.Elements()
                     where node.Name == "HHUrl"
                     select node).FirstOrDefault();

                string hhTitle = hhTitleElement != null ? hhTitleElement.Value : string.Empty;
                string hhUrl   = hhUrlElement != null ? hhUrlElement.Value : string.Empty;;
                string iconUrl = Microsoft.SharePoint.Publishing.Fields.LinkFieldValue.GetDefaultIconUrl(currentRow["Url"] as string, SPContext.Current.Web);

                System.Web.UI.WebControls.Image docTypeImage = e.Item.FindControl("docTypeImage") as System.Web.UI.WebControls.Image;
                if (docTypeImage != null)
                {
                    docTypeImage.ImageUrl = iconUrl;
                }

                System.Web.UI.WebControls.HyperLink titleLink = e.Item.FindControl("titleLink") as System.Web.UI.WebControls.HyperLink;
                if (titleLink != null)
                {
                    titleLink.NavigateUrl = hhUrl;
                    titleLink.Text        = hhTitle;
                }

                System.Web.UI.WebControls.CheckBox reviewedCheckBox = e.Item.FindControl("reviewedCheckBox") as System.Web.UI.WebControls.CheckBox;
                if (reviewedCheckBox != null)
                {
                    reviewedCheckBox.InputAttributes.Add("onclick",
                                                         String.Format("SaveSearchResultData({0}, {1}, {2});",
                                                                       currentRow["Id"],
                                                                       "'reviewed'",
                                                                       "$('#" + reviewedCheckBox.ClientID + "').prop('checked')")
                                                         );
                    reviewedCheckBox.Checked = (currentRow.Row.IsNull("Reviewed")) ? false: (bool)currentRow["Reviewed"];
                }

                System.Web.UI.WebControls.CheckBox includeInSetCheckBox = e.Item.FindControl("includeInSetCheckBox") as System.Web.UI.WebControls.CheckBox;
                if (includeInSetCheckBox != null)
                {
                    includeInSetCheckBox.InputAttributes.Add("onclick",
                                                             String.Format("SaveSearchResultData({0}, {1}, {2});",
                                                                           currentRow["Id"],
                                                                           "'IncludeInSet'",
                                                                           "$('#" + includeInSetCheckBox.ClientID + "').prop('checked')")
                                                             );
                    includeInSetCheckBox.Checked = (currentRow.Row.IsNull("IncludeInSet")) ? false : (bool)currentRow["IncludeInSet"];
                }
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                double punctX = 10;
                double punctY = 10;

                double spacing = 5;

                pnlImages.Style["position"] = "relative";

                for (int y = 0; y < 3; y++)
                {
                    System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
                    image.ID = "culoare" + y.ToString();
                    image.Style["position"] = "absolute";
                    image.Style["left"]     = punctX.ToString() + "px";
                    image.Style["top"]      = punctY.ToString() + "px";
                    image.Width             = 100;
                    image.Height            = 60;
                    image.ImageUrl          = "~/Images/" + image.ID.ToString() + ".jpg";

                    pnlImages.Controls.Add(image);

                    punctX += image.Width.Value + spacing;
                }
            }
        }
Ejemplo n.º 9
0
        public ActionResult QR_Button_Click(string LessonCode)
        {
            QRCodeGenerator qrgenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrgenerator.CreateQrCode(LessonCode, QRCodeGenerator.ECCLevel.Q);
            QRCode          qrCode      = new QRCode(qrCodeData);

            System.Web.UI.WebControls.Image imgQRcode = new System.Web.UI.WebControls.Image();
            imgQRcode.Width  = 500;
            imgQRcode.Height = 500;

            using (Bitmap qrCodeImage = qrCode.GetGraphic(20))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    qrCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] byteImage = ms.ToArray();
                    imgQRcode.ImageUrl = "data:image/png;base64, " + Convert.ToBase64String(byteImage);
                }
                ViewData["QRCodeImage"] = imgQRcode.ImageUrl;
                imgQRcode.Dispose();
                qrCodeData.Dispose();
                qrgenerator.Dispose();
                qrCode.Dispose();
                qrCodeData.Dispose();
                return(View("TestQR"));
            }
        }
Ejemplo n.º 10
0
 public System.Web.UI.WebControls.Image crear(string barCode, out MemoryStream _ms)
 {
     System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
     using (Bitmap bitMap = new Bitmap(barCode.Length * 40, 80))
     {
         using (Graphics graphics = Graphics.FromImage(bitMap))
         {
             Font       oFont      = new Font("IDAutomationHC39M", 16);
             PointF     point      = new PointF(2f, 2f);
             SolidBrush blackBrush = new SolidBrush(Color.Black);
             SolidBrush whiteBrush = new SolidBrush(Color.White);
             graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
             graphics.DrawString(barCode, oFont, blackBrush, point);
         }
         using (MemoryStream ms = new MemoryStream())
         {
             bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
             byte[] byteImage = ms.ToArray();
             Convert.ToBase64String(byteImage);
             imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
             _ms = ms;
         }
     }
     return(imgBarCode);
 }
Ejemplo n.º 11
0
        public ActionResult Index(FormCollection form)
        {
            string barCode = form["text"];

            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            using (Bitmap bitMap = new Bitmap(barCode.Length * 40, 80))
            {
                using (Graphics graphics = Graphics.FromImage(bitMap))
                {
                    Font       oFont      = new Font("IDAutomationHC39M", 16);
                    PointF     point      = new PointF(2f, 2f);
                    SolidBrush blackBrush = new SolidBrush(Color.Black);
                    SolidBrush whiteBrush = new SolidBrush(Color.White);
                    graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
                    graphics.DrawString("*" + barCode + "*", oFont, blackBrush, point);
                }
                using (MemoryStream ms = new MemoryStream())
                {
                    bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] byteImage = ms.ToArray();

                    Convert.ToBase64String(byteImage);
                    imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
                ViewBag.Image = imgBarCode;
                return(View());
            }
        }
        /// <summary>
        /// 改变图片大小
        /// </summary>
        /// <param name="image"></param>
        /// <param name="height"></param>
        /// <param name="width"></param>
        public static void ResizeImageHtml(System.Web.UI.WebControls.Image image, int height, int width)
        {
            HttpContext context = HttpContext.Current;

            if (context == null || (context.Request.Browser.IsBrowser("IE") && context.Request.Browser.MajorVersion < 7))
            {
                if (height > 0)
                {
                    image.Height = new System.Web.UI.WebControls.Unit(height);
                }

                if (width > 0)
                {
                    image.Width = new System.Web.UI.WebControls.Unit(width);
                }
            }
            else
            {
                if (height > 0)
                {
                    image.Style["max-height"] = height.ToString() + "px";
                }

                if (width > 0)
                {
                    image.Style["max-width"] = width.ToString() + "px";
                }
            }
        }
        public ActionResult CodeQr(string txtQRCode)
        {
            ViewBag.txtQRCode = txtQRCode;
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(txtQRCode, QRCodeGenerator.ECCLevel.Q);
            QRCode          qrCode      = new QRCode(qrCodeData);

            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            imgBarCode.Height = 50;
            imgBarCode.Width  = 50;
            string uniqueId   = Guid.NewGuid().ToString("N");
            string filename   = string.Format("{0}.{1}", uniqueId, "png");
            var    serverpath = Server.MapPath(string.Format("{0}{1}", "~/doc/", filename));

            using (Bitmap bitMap = qrCode.GetGraphic(20))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    using (FileStream fs = new FileStream(serverpath, FileMode.Create, FileAccess.ReadWrite))
                    {
                        bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                        byte[] bytes = ms.ToArray();
                        fs.Write(bytes, 0, bytes.Length);
                        ViewBag.imageBytes = bytes;
                    }
                    //imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
            }
            var Ocr = new AdvancedOcr()
            {
                CleanBackgroundNoise             = true,
                EnhanceContrast                  = true,
                EnhanceResolution                = true,
                Language                         = IronOcr.Languages.English.OcrLanguagePack,
                Strategy                         = IronOcr.AdvancedOcr.OcrStrategy.Advanced,
                ColorSpace                       = AdvancedOcr.OcrColorSpace.Color,
                DetectWhiteTextOnDarkBackgrounds = true,
                InputImageType                   = AdvancedOcr.InputTypes.AutoDetect,
                RotateAndStraighten              = true,
                ReadBarCodes                     = true,
                ColorDepth                       = 4
            };
            var testImage = serverpath;
            var Results   = Ocr.Read(testImage);
            var Barcodes  = Results.Barcodes.Select(b => b.Value);

            ViewBag.qrcode = string.Format("Texte : {0} Barcodes: {1}", Results.Text, String.Join(",", Barcodes));
            InformationViewModel informationViewModel = new InformationViewModel()
            {
                CodeQr      = uniqueId,
                Name        = "Stratège Takam",
                CodeQrPath  = filename,
                Title       = "Informations de retrait de la carte national d'idendité",
                Description = "Pour retirer votre coli, vous vous servirai soit du code QR soit du numéro du code "
            };

            return(View(informationViewModel));
        }
Ejemplo n.º 14
0
        protected override void Render(HtmlTextWriter output)
        {
            if (!string.IsNullOrEmpty(Value))
            {
                var array = Value.Split(',');
                if (array.Length > 0)
                {
                    int.TryParse(array[0], out _mapZoomFactor);
                }

                if (array.Length > 1)
                {
                    _mapType = array[1];
                }
            }

            ParseParameters(Source);
            if (!string.IsNullOrEmpty(AddressFieldName))
            {
                base.Render(output);

                var db = Factory.GetDatabase("master") ?? Factory.GetDatabase("web");

                var id = !string.IsNullOrEmpty(ItemID)
                    ? ItemID
                    : ControlAttributes.Substring(ControlAttributes.IndexOf("//master/", StringComparison.Ordinal) + 9,
                                                  38);
                var item = new ID(id).ToSitecoreItem(db);

                //render other control

                var centre = "";

                //get lat lng

                var location = GetGeoData(item, ref centre);


                _mapImageCtrl = new Image
                {
                    ID       = ID + "_Img_MapView",
                    CssClass = "imageMapView",
                    Width    = MAP_WIDTH,
                    Height   = MAP_HEIGHT,
                    ImageUrl = GetGoogleMapImageUrl(location, centre, item)
                };
                _mapImageCtrl.Style.Add("padding-top", "5px");

                if (Debug)
                {
                    output.Write(
                        "<div style='background-color:silver;color:white'>{0}</div>",
                        _mapImageCtrl.ImageUrl);
                }

                _mapImageCtrl.RenderControl(output);
            }
        }
        public ActionResult Index(QRModel model)
        {
            QRService objService = new QRService();
            QRModel   objModel   = new QRModel();

            List <ExamTranModel> lstShedule = new List <ExamTranModel>();

            lstShedule = objService.getExamShedule(Convert.ToInt32(model.EID));
            if (lstShedule.Count() > 0)
            {
                int stdID   = Convert.ToInt32(lstShedule[0].StdID);
                var lstStud = Dbcontext.StudentMasters.Where(m => m.StdID == stdID).ToList();


                foreach (var i in lstShedule)
                {
                    foreach (var st in lstStud)
                    {
                        var std = Dbcontext.StandardMasters.Where(m => m.StdID == st.StdID).SingleOrDefault();
                        var sub = Dbcontext.SubjectMasters.Where(m => m.SubID == i.SubID).SingleOrDefault();

                        string                          code        = "Registration# : " + st.Prefix + "" + st.StudID + ",Roll No. : " + st.RollNo + ",Name : " + st.FirstName + ' ' + st.MiddleName + ' ' + st.LastName + ",Subject : " + sub.Subject + ",Standard : " + std.Standard;
                        QRCodeGenerator                 qrGenerator = new QRCodeGenerator();
                        QRCodeGenerator.QRCode          qrCode      = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q);
                        System.Web.UI.WebControls.Image imgBarCode  = new System.Web.UI.WebControls.Image();
                        imgBarCode.Height = 150;
                        imgBarCode.Width  = 150;

                        using (Bitmap bitMap = qrCode.GetGraphic(20))
                        {
                            using (MemoryStream ms = new MemoryStream())
                            {
                                bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                                byte[] byteImage = ms.ToArray();
                                imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                                model.QRCodeImage   = byteImage;
                            }
                            //plBarCode.Controls.Add(imgBarCode);

                            model.QRCode   = Convert.ToString(imgBarCode.ImageUrl);
                            model.StudID   = st.StudID;
                            model.SubID    = i.SubID;
                            model.ETID     = i.ETID;
                            model.SchoolID = i.SchoolID;
                            model.EID      = i.EID;
                            objService.Insert(model);
                        }
                    }
                }
                return(RedirectToAction("Print", new { @SchoolID = model.SchoolID, @StdID = model.StdID }));
            }
            else
            {
                TempData["AMsg"] = "QR Code not Generated! First you should to arrange shedule.";
                return(RedirectToAction("Index"));
            }
        }
Ejemplo n.º 16
0
        /* There are two ways of using this site. Either no parameters, then all graphs for all locations will
         * be generated, or with arguments (e.g. location=12345&duration=0) and only one graph will be generated
         */
        public void update(String location, String duration)
        {
            String dbToUse = "";

            dbToUse = "Surfvind_data";
            WindData wd      = new WindData(true, dbToUse);
            bool     isMySQL = Convert.ToBoolean(ConfigurationManager.AppSettings["isMySQL"]);

            List <Location> loc = wd.GetLocations();

            loc.Sort();

            placeholder.InnerHtml += "Thomas " + loc.Count;

            if (!checkArguments(location, duration, loc))
            {  /* Update everything */
                foreach (Location l in loc)
                {
                    //   Response.Write(l.imei.ToString());
                    this.location = l.imei.ToString();
                    wd.SetImei(this.location);
                    for (int i = 0; i < 5; i++)
                    {
                        int interval = i;
                        fetchData(i, wd);

                        System.Web.UI.WebControls.Image a = new System.Web.UI.WebControls.Image();
                        a.Width    = 800;
                        a.Height   = 200;
                        a.ImageUrl = generateGraphOnServer(interval, 800, 200);
                        placeholder.Controls.Add(a);
                    }
                }
            }

            else
            {
                this.location = location;
                // Safe, we know this value can be parsed, we've tried it before
                int interval = int.Parse(duration);
                wd.SetImei(this.location);
                //   Response.Write("Generate Graph");

                fetchData(interval, wd);
                //    Response.Write("Create Graph");

                System.Web.UI.WebControls.Image a = new System.Web.UI.WebControls.Image();
                a.Width    = 800;
                a.Height   = 200;
                a.ImageUrl = generateGraphOnServer(interval, 800, 200);
                placeholder.Controls.Add(a);
            }
        }
Ejemplo n.º 17
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            // Create and render a new Image web control.
            System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
            image.ID            = "Image1";
            image.ImageUrl      = "image.jpg";
            image.AlternateText = "Image for XML.";
            image.RenderControl(writer);

            // Call the base class's Render method.
            base.Render(writer);
        }
        protected override void CreateChildControls()
        {
            Table table = new Table();
            TableRow row = null;
            TableCell cell;

            string iconsFolder = LocalResolveUrl(this.IconsFolder);
            if (iconsFolder.Length > 0)
            {
                string lastCh = iconsFolder.Substring(iconsFolder.Length - 1, 1);
                if (lastCh != "\\" && lastCh != "/") iconsFolder += "/";
            }

            if (Directory.Exists(System.Web.HttpContext.Current.Server.MapPath(iconsFolder)))
            {
                string[] files = Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath(iconsFolder));
                int j = 0;

                foreach (string file in files)
                {
                    string ext = Path.GetExtension(file).ToLower();
                    if (ext == ".gif" || ext == ".jpg" || ext == ".jpeg" || ext == ".png")
                    {
                        if(j==0)
                        {
                            row = new TableRow();
                            table.Rows.Add(row);
                        }
                        cell = new TableCell();
                        System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
                        image.ImageUrl = iconsFolder + Path.GetFileName(file);
                        image.Attributes.Add("onmousedown", "insertImage(\"" + iconsFolder + Path.GetFileName(file) + "\")");
                        image.Style[HtmlTextWriterStyle.Cursor] = "pointer";
                        cell.Controls.Add(image);
                        row.Cells.Add(cell);

                        j++;
                        if (j == IconsInRow) j = 0;
                    }
                }
            }
            table.Attributes.Add("border", "0");
            table.Attributes.Add("cellspacing", "2");
            table.Attributes.Add("cellpadding", "0");
            table.Style["background-color"] = "transparent";

            Content.Add(table);

            base.CreateChildControls();
        }
Ejemplo n.º 19
0
 void CreateRuleImage(KeyValuePair<PropertyEditor, RuleType> keyValuePair, TableEx tableEx) {
     var tableCell = tableEx.Rows[0].Cells[0];
     var image = new System.Web.UI.WebControls.Image();
     var imageName = keyValuePair.Value.ToString();
     ImageInfo imageInfo = ImageLoader.Instance.GetImageInfo(imageName);
     image.AlternateText = imageName;
     image.ImageUrl = imageInfo.ImageUrl;
     image.Width = imageInfo.Width;
     image.Height = imageInfo.Height;
     image.ToolTip = keyValuePair.Key.ErrorMessage;
     image.Style["margin"] = "5px";
     tableCell.Controls.Clear();
     tableCell.Controls.Add(image);
 }
Ejemplo n.º 20
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            // Call the base class's Render method.
            base.Render(writer);

            // Render a BR HTML tag
            writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Br);

            // Create and render a new Image Web control.
            System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
            image.ID            = "Image1";
            image.ImageUrl      = "image.jpg";
            image.AlternateText = "Image for CheckBox1.";
            image.RenderControl(writer);
        }
Ejemplo n.º 21
0
        private void GenerateMapBox()
        {
            this.Style.Add("overflow", "hidden");
            this.Style.Add("z-index", "101");
            this.Style.Add("cursor", "pointer");
            this.Style.Add("position", "relative");
            this.Style.Add("display", "block");
            if (this.Style["BackColor"] != null)
            {
                this.Style.Add("background", System.Drawing.ColorTranslator.ToHtml(map.BackColor));
            }

            imgMap1 = new System.Web.UI.WebControls.Image();
            imgMap2 = new System.Web.UI.WebControls.Image();
            imgMap1.Attributes["galleryimg"] = "false";             //Disable Internet Explorer image toolbar
            imgMap2.Attributes["galleryimg"] = "false";             //Disable Internet Explorer image toolbar

            imgMap1.Style.Add("position", "absolute");
            imgMap1.Style.Add("Z-index", "10");
            imgMap2.Style.Add("position", "absolute");
            imgMap2.Style.Add("visibility", "hidden");
            imgMap2.Style.Add("opacity", "0");
            imgMap2.Style.Add("filter", "'ALPHA(opacity=0)'");
            imgMap2.Style.Add("Z-index", "9");

            this.Controls.Add(imgMap1);
            this.Controls.Add(imgMap2);

            if (_DisplayStatusBar)
            {
                spanCursorLocation           = new HtmlGenericControl("span");
                spanCursorLocation.InnerText = "";
                spanCursorLocation.Style.Add("filter", "ALPHA(opacity=100)");
                divTopBar = new HtmlGenericControl("div");
                divTopBar.Style.Clear();

                divTopBar.Style.Add("Z-index", "20");
                divTopBar.Style.Add("border-bottom", "1px solid #000");
                divTopBar.Style.Add("position", "absolute");
                divTopBar.Style.Add("filter", "ALPHA(opacity=50)");
                divTopBar.Style.Add("opacity ", "0.5");
                divTopBar.Style.Add("background", "#fff");
                divTopBar.Style.Add("width", "100%");

                divTopBar.Controls.Add(spanCursorLocation);
                this.Controls.Add(divTopBar);
            }
        }
Ejemplo n.º 22
0
        void CreateRuleImage(KeyValuePair <PropertyEditor, RuleType> keyValuePair, TableEx tableEx)
        {
            var       tableCell = tableEx.Rows[0].Cells[0];
            var       image     = new System.Web.UI.WebControls.Image();
            var       imageName = keyValuePair.Value.ToString();
            ImageInfo imageInfo = ImageLoader.Instance.GetImageInfo(imageName);

            image.AlternateText   = imageName;
            image.ImageUrl        = imageInfo.ImageUrl;
            image.Width           = imageInfo.Width;
            image.Height          = imageInfo.Height;
            image.ToolTip         = keyValuePair.Key.ErrorMessage;
            image.Style["margin"] = "5px";
            tableCell.Controls.Clear();
            tableCell.Controls.Add(image);
        }
Ejemplo n.º 23
0
 private string GetImageResults(Image imageToCheck)
 {
     if (imageToCheck.ImageUrl == "~/Images/Bar.png")
     {
         return("bar");
     }
     if (imageToCheck.ImageUrl == "~/Images/Cherry.png")
     {
         return("cherry");
     }
     if (imageToCheck.ImageUrl == "~/Images/Seven.png")
     {
         return("seven");
     }
     return("other");
 }
Ejemplo n.º 24
0
        /// <summary>
        /// This method will generate a QR Code in jpeg format at location as ~/Resources/TempImages/QR.jpeg
        /// </summary>
        /// <param name="QRString"></param>
        public static void GenerateQR(string QRString)
        {
            QRCodeGenerator qRCodeGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData      = qRCodeGenerator.CreateQrCode(QRString, QRCodeGenerator.ECCLevel.Q);

            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();

            imgBarCode.Height = 250;
            imgBarCode.Width  = 250;
            QRCode qRCode = new QRCode(qrCodeData);

            string data   = qRCode.ToString();
            Bitmap bitMap = qRCode.GetGraphic(5);

            bitMap.Save(HttpContext.Current.Server.MapPath("~/Images/qr.jpeg"));
        }
Ejemplo n.º 25
0
        public static System.Web.UI.WebControls.Image generate_barcode(string nazwa, string stanowisko, string telefon, string email)

        {
            StringBuilder vcard = new StringBuilder("MECARD:N:" + nazwa + ";");

            vcard.Append("ORG: YourCompany;");
            vcard.Append("TEL: " + telefon + ";");
            vcard.Append("EMAIL: " + email + ";");
            vcard.Append("NOTE:" + stanowisko + "; ;");


            string barCode = vcard.ToString();

            var qrCodeWriter = new ZXing.BarcodeWriterPixelData
            {
                Format  = ZXing.BarcodeFormat.QR_CODE,
                Options = new QrCodeEncodingOptions
                {
                    Height = 250,
                    Width  = 250,
                    Margin = 0
                }
            };
            var pixelData = qrCodeWriter.Write(barCode);


            using (var bitmap = new System.Drawing.Bitmap(pixelData.Width, pixelData.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb))
                using (var ms = new MemoryStream())
                {
                    var bitmapData = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, pixelData.Width, pixelData.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
                    try
                    {
                        System.Runtime.InteropServices.Marshal.Copy(pixelData.Pixels, 0, bitmapData.Scan0, pixelData.Pixels.Length);
                    }
                    finally
                    {
                        bitmap.UnlockBits(bitmapData);
                    }


                    System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
                    bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(ms.ToArray());

                    return(imgBarCode);
                }
        }
Ejemplo n.º 26
0
 private System.Web.UI.Control AddNext(System.Web.UI.Control p)
 {
     System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image()
     {
         ImageUrl = URI,
         CssClass = "OverlapImage",
     };
     img.Style["filter"] = "sepia(1) "
                           + "hue-rotate(" + hue + "deg) "
                           + "brightness(" + brightness + ") "
                           + "contrast(" + contrast + ")";
     p.Controls.Add(img);
     if (null != Next)
     {
         Next.AddNext(p);
     }
     return(p);
 }
Ejemplo n.º 27
0
        protected override void Render(HtmlTextWriter writer)
        {
            System.Web.UI.WebControls.Image loadImage = new System.Web.UI.WebControls.Image();
            loadImage.ImageUrl      = ((Page)HttpContext.Current.Handler).ResolveClientUrl("~/Includes/Images/loader.gif");
            loadImage.AlternateText = "Processando";

            System.Web.UI.HtmlControls.HtmlGenericControl divProcessMessage = new System.Web.UI.HtmlControls.HtmlGenericControl();
            divProcessMessage.Attributes["class"] = "processMessage";
            divProcessMessage.Controls.Add(loadImage);

            System.Web.UI.HtmlControls.HtmlGenericControl divProgressBackgroundFilter = new System.Web.UI.HtmlControls.HtmlGenericControl();
            divProgressBackgroundFilter.Attributes["class"] = "progressBackgroundFilter";

            Controls.Add(divProcessMessage);
            Controls.Add(divProgressBackgroundFilter);

            base.Render(writer);
        }
Ejemplo n.º 28
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            string navigateUrl   = System.String.Empty;
            string imageUrl      = System.String.Empty;
            string alternateText = System.String.Empty;

            // If the value for the Advertisement File is not empty.
            if (this.AdvertisementFile.Length > 0)
            {
                // Get a random ad.
                GetRandomAd(out imageUrl, out navigateUrl, out alternateText);
            }

            // Create and render a new HyperLink Web control.
            System.Web.UI.WebControls.HyperLink bannerLink = new System.Web.UI.WebControls.HyperLink();
            foreach (string key in this.Attributes.Keys)
            {
                bannerLink.Attributes[key] = this.Attributes[key];
            }
            if (this.ID != null && this.ID.Length > 0)
            {
                bannerLink.ID = this.ClientID;
            }
            bannerLink.NavigateUrl = navigateUrl;
            bannerLink.Target      = this.Target;
            bannerLink.AccessKey   = this.AccessKey;
            bannerLink.Enabled     = this.Enabled;
            bannerLink.TabIndex    = this.TabIndex;
            bannerLink.RenderBeginTag(writer);

            // Create and render a new Image Web control.
            System.Web.UI.WebControls.Image bannerImage = new System.Web.UI.WebControls.Image();
            if (ControlStyleCreated)
            {
                bannerImage.ApplyStyle(this.ControlStyle);
            }
            bannerImage.AlternateText = alternateText;
            bannerImage.ImageUrl      = imageUrl;
            bannerImage.ToolTip       = this.ToolTip;
            bannerImage.RenderControl(writer);
            bannerLink.RenderEndTag(writer);
        }
Ejemplo n.º 29
0
        public FileResult Index(string code = "AndyCaBar")
        {
            QRCodeGenerator qrGenerator = new QRCodeGenerator();

            QRCodeGenerator.QRCode          qrCode     = qrGenerator.CreateQrCode("ACB_" + code, QRCodeGenerator.ECCLevel.Q);
            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            imgBarCode.Height = 150;
            imgBarCode.Width  = 150;
            using (Bitmap bitMap = qrCode.GetGraphic(20))
            {
                Byte[] data;
                using (var memoryStream = new MemoryStream())
                {
                    bitMap.Save(memoryStream, ImageFormat.Bmp);

                    data = memoryStream.ToArray();
                }
                return(base.File(data, "image/bmp"));
            }
        }
Ejemplo n.º 30
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Wraps a control in an update panel
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static Control WrapUpdatePanelControl(Control objControl, bool blnIncludeProgress)
        {
            UpdatePanel updatePanel = new UpdatePanel();

            updatePanel.ID         = objControl.ID + "_UP";
            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;

            Control objContentTemplateContainer = updatePanel.ContentTemplateContainer;

            for (int i = 0; i <= objControl.Parent.Controls.Count - 1; i++)
            {
                //find offset of original control
                if (objControl.Parent.Controls[i].ID == objControl.ID)
                {
                    //if ID matches
                    objControl.Parent.Controls.AddAt(i, updatePanel);
                    //insert update panel in that position
                    objContentTemplateContainer.Controls.Add(objControl);
                    //inject passed in control into update panel
                    break; // TODO: might not be correct. Was : Exit For
                }
            }

            if (blnIncludeProgress)
            {
                //create image for update progress control
                System.Web.UI.WebControls.Image objImage = new System.Web.UI.WebControls.Image();
                objImage.ImageUrl = "~/images/progressbar.gif";
                //hardcoded
                objImage.AlternateText = "ProgressBar";

                UpdateProgress updateProgress = new UpdateProgress();
                updateProgress.AssociatedUpdatePanelID = updatePanel.ID;
                updateProgress.ID = updatePanel.ID + "_Prog";
                updateProgress.ProgressTemplate = new LiteralTemplate(objImage);

                objContentTemplateContainer.Controls.Add(updateProgress);
            }

            return(updatePanel);
        }
        public ActionResult Index(string txtQRCode)
        {
            ViewBag.txtQRCode = txtQRCode;
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(txtQRCode, QRCodeGenerator.ECCLevel.Q);
            QRCode          qrCode      = new QRCode(qrCodeData);

            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            imgBarCode.Height = 150;
            imgBarCode.Width  = 150;
            using (Bitmap bitMap = qrCode.GetGraphic(20))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    ViewBag.imageBytes = ms.ToArray();
                    //imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
            }
            return(View());
        }
Ejemplo n.º 32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.Label label = new System.Web.UI.WebControls.Label();
            label.ID = "startDate";
            Int64 unixTimestamp = (Int64)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds;

            label.Text = "" + unixTimestamp;

            string[] filePaths = Directory.GetFiles(@"" + WebConfigurationManager.AppSettings["PathImage"] + "", "*.jpg");

            foreach (string file in filePaths)
            {
                byte[] imageArray = File.ReadAllBytes(file);

                System.Web.UI.WebControls.Image newimage = new System.Web.UI.WebControls.Image();
                newimage.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(imageArray);

                pnlContent.Controls.Add(newimage);
            }

            pnlContent.Controls.Add(label);
        }
Ejemplo n.º 33
0
 private void decodeMessage( anmar.SharpMimeTools.SharpMimeMessage mm, System.Web.UI.WebControls.PlaceHolder entity )
 {
     System.String inline = System.String.Empty;
     switch ( mm.Header.TopLevelMediaType ) {
         case anmar.SharpMimeTools.MimeTopLevelMediaType.multipart:
         case anmar.SharpMimeTools.MimeTopLevelMediaType.message:
             // TODO: allow other subtypes of "message"
             // Only message/rfc822 allowed, other subtypes ignored
             if ( mm.Header.TopLevelMediaType.Equals(anmar.SharpMimeTools.MimeTopLevelMediaType.message)
                  && !mm.Header.SubType.Equals("rfc822") )
                 break;
             if ( mm.Header.SubType.Equals ("alternative") ) {
                 if ( mm.PartsCount>0 ) {
                     this.decodeMessage ( mm.GetPart(mm.PartsCount-1),
                                          entity);
                 }
             // TODO: Take into account each subtype of "multipart"
             } else if ( mm.PartsCount>0 ) {
                 System.Web.UI.WebControls.PlaceHolder nestedentity = new System.Web.UI.WebControls.PlaceHolder ();
                 System.Collections.IEnumerator enu = mm.GetEnumerator();
                 while ( enu.MoveNext() ) {
                     this.decodeMessage ((anmar.SharpMimeTools.SharpMimeMessage) enu.Current, nestedentity);
                 }
                 entity.Controls.Add (nestedentity);
             }
             break;
         case anmar.SharpMimeTools.MimeTopLevelMediaType.text:
             if ( ( mm.Disposition==null || !mm.Disposition.Equals("attachment") )
                 && ( mm.Header.SubType.Equals("plain") || mm.Header.SubType.Equals("html") ) ) {
                 System.Web.UI.WebControls.Label label = new System.Web.UI.WebControls.Label ();
                 label.Text = mm.BodyDecoded;
                 if ( mm.IsTextBrowserDisplay ) {
                     label.Text = System.Web.HttpUtility.HtmlEncode (label.Text);
                     label.Text = label.Text.Insert (0, "<pre id=\"message\">");
                     label.Text = label.Text.Insert (label.Text.Length, "</pre>");
                 } else {
                     label.CssClass = "XPFormText";
                     if ( (int)Application["sharpwebmail/read/message/sanitizer_mode"]==1 ) {
                         label.Text = anmar.SharpWebMail.BasicSanitizer.SanitizeHTML(label.Text, anmar.SharpWebMail.SanitizerMode.CommentBlocks|anmar.SharpWebMail.SanitizerMode.RemoveEvents);
                     }
                 }
                 entity.Controls.Add (label);
                 break;
             } else {
                 goto case anmar.SharpMimeTools.MimeTopLevelMediaType.application;
             }
         case anmar.SharpMimeTools.MimeTopLevelMediaType.application:
         case anmar.SharpMimeTools.MimeTopLevelMediaType.audio:
         case anmar.SharpMimeTools.MimeTopLevelMediaType.image:
         case anmar.SharpMimeTools.MimeTopLevelMediaType.video:
             System.Web.UI.WebControls.HyperLink attachment = new System.Web.UI.WebControls.HyperLink ();
             System.Web.UI.WebControls.Image image = null;
             attachment.CssClass = "XPDownload";
             if ( mm.Name!=null )
                 attachment.Text = System.String.Format ("{0} ({1} bytes)", System.IO.Path.GetFileName(mm.Name), mm.Size);
             if ( Session["sharpwebmail/read/message/temppath"]!=null ) {
                 System.String path = Session["sharpwebmail/read/message/temppath"].ToString();
                 path = System.IO.Path.Combine (path, msgid);
                 // Dump file contents
                 System.IO.FileInfo file = mm.DumpBody ( path, true );
                 if ( file!=null && file.Exists ) {
                     System.String urlstring = System.String.Format("download.aspx?msgid={0}&name={1}&i={2}",
                                                         Server.UrlEncode(msgid), Server.UrlEncode(file.Name),
                                                         inline);
                     if ( mm.Disposition!=null && mm.Disposition.Equals("inline") ) {
                         inline = "1";
                         if ( mm.Header.TopLevelMediaType.Equals(anmar.SharpMimeTools.MimeTopLevelMediaType.image)
                                 && ( mm.Header.SubType.Equals("gif") || mm.Header.SubType.Equals("jpg") || mm.Header.SubType.Equals("png")) ) {
                             image = new System.Web.UI.WebControls.Image ();
                             image.ImageUrl = urlstring;
                         }
                     }
                     attachment.NavigateUrl = urlstring;
                     attachment.Text = System.String.Format ("{0} ({1} bytes)", file.Name, file.Length);
                 }
             }
             this.readMessageWindowAttachmentsHolder.Controls.Add (attachment);
             // Display inline image
             if ( image!=null ) {
                 entity.Controls.Add (image);
             }
             break;
         default:
             break;
     }
 }
Ejemplo n.º 34
0
		private void GenerateMapBox()
		{
			this.Style.Add("overflow", "hidden");
			this.Style.Add("z-index", "101");
			this.Style.Add("cursor", "pointer");
			this.Style.Add("position", "relative");
			this.Style.Add("display", "block");
			if(this.Style["BackColor"]!=null)
				this.Style.Add("background", System.Drawing.ColorTranslator.ToHtml(map.BackColor));

			imgMap1 = new System.Web.UI.WebControls.Image();
			imgMap2 = new System.Web.UI.WebControls.Image();
			imgMap1.Attributes["galleryimg"] = "false"; //Disable Internet Explorer image toolbar
			imgMap2.Attributes["galleryimg"] = "false"; //Disable Internet Explorer image toolbar						
			
			imgMap1.Style.Add("position", "absolute");
			imgMap1.Style.Add("Z-index", "10");
			imgMap2.Style.Add("position", "absolute");
			imgMap2.Style.Add("visibility", "hidden");
			imgMap2.Style.Add("opacity","0");
			imgMap2.Style.Add("filter","'ALPHA(opacity=0)'");
			imgMap2.Style.Add("Z-index","9");

			this.Controls.Add(imgMap1);
			this.Controls.Add(imgMap2);

			if (_DisplayStatusBar)
			{
				spanCursorLocation = new HtmlGenericControl("span");
				spanCursorLocation.InnerText = "";
				spanCursorLocation.Style.Add("filter", "ALPHA(opacity=100)");
				divTopBar = new HtmlGenericControl("div");
				divTopBar.Style.Clear();
				
				divTopBar.Style.Add("Z-index", "20");
				divTopBar.Style.Add("border-bottom", "1px solid #000");
				divTopBar.Style.Add("position", "absolute");
				divTopBar.Style.Add("filter", "ALPHA(opacity=50)");
				divTopBar.Style.Add("opacity ", "0.5");
				divTopBar.Style.Add("background", "#fff");
				divTopBar.Style.Add("width", "100%");

				divTopBar.Controls.Add(spanCursorLocation);
				this.Controls.Add(divTopBar);
			}
		}
Ejemplo n.º 35
0
        private void GenerateMapBox()
        {
            this.Style.Add("overflow", "hidden");
            this.ID = "ajaxMap";
            this.Style.Add("z-index", "101");
            this.Style.Add("cursor", "pointer");
            this.Style.Add("position", "relative");
            this.Style.Add("display", "block");
            if (this.Style["BackColor"] != null)
                this.Style.Add("background", System.Drawing.ColorTranslator.ToHtml(map.BackColor));

            imgMap1 = new System.Web.UI.WebControls.Image();
            imgMap2 = new System.Web.UI.WebControls.Image();
            imgMap1.Attributes["galleryimg"] = "false"; //Disable Internet Explorer image toolbar
            imgMap2.Attributes["galleryimg"] = "false"; //Disable Internet Explorer image toolbar

            imgMap1.Style.Add("position", "absolute");
            imgMap1.Style.Add("Z-index", "10");
            imgMap2.Style.Add("position", "absolute");
            imgMap2.Style.Add("visibility", "hidden");
            imgMap2.Style.Add("opacity", "0");
            imgMap2.Style.Add("mozopacity", "0");
            imgMap2.Style.Add("filter", "'ALPHA(opacity=0)'");
            imgMap2.Style.Add("Z-index", "9");

            this.Controls.Add(imgMap1);
            this.Controls.Add(imgMap2);

            if (_DisplayStatusBar)
            {

                spanCursorLocation = new HtmlGenericControl("span");
                spanCursorLocation.ID = "statusBar";
                spanCursorLocation.InnerText = "";
                spanCursorLocation.Style.Add("filter", "ALPHA(opacity=100)");
                divTopBar = new HtmlGenericControl("div");
                divTopBar.ID = "statusContainer";
                divTopBar.Style.Clear();
                divTopBar.Style.Add("Z-index", "20");
                divTopBar.Style.Add("border-bottom", "1px solid #000");
                divTopBar.Style.Add("position", "absolute");
                divTopBar.Style.Add("filter", "ALPHA(opacity=50)");
                divTopBar.Style.Add("opacity ", "0.5");
                divTopBar.Style.Add("background", "#fff");
                divTopBar.Style.Add("width", "100%");
                divTopBar.Controls.Add(spanCursorLocation);
                this.Controls.Add(divTopBar);
            }
            divScaleBar = new HtmlGenericControl("div");
            divScaleBar.ID = "scaleBar";
            divScaleBar.Style.Clear();
            divScaleBar.Style.Add("position", "relative");
            divScaleBar.Style.Add("height", "0.3em");
            divScaleBar.Style.Add("width", "12px");
            divScaleBar.Style.Add("overflow", "hidden");
            divScaleBar.Style.Add("border-bottom", "solid 1px #000");
            divScaleBar.Style.Add("border-right", "solid 1px #000");
            divScaleBar.Style.Add("border-left", "solid 1px #000");

            divScaleText = new HtmlGenericControl("div");
            divScaleText.ID = "scaleText";
            divScaleText.Style.Clear();
            divScaleText.Style.Add("position", "relative");
            divScaleText.InnerText = "5 mi";

            divScaleFrame = new HtmlGenericControl("div");
            divScaleFrame.ID = "scaleFrame";
            divScaleFrame.Style.Clear();
            divScaleFrame.Style.Add("position", "absolute");
            divScaleFrame.Style.Add("text-align", "center");
            divScaleFrame.Style.Add("background-color", "#fff");
            divScaleFrame.Style.Add("opacity ", "0.7");
            divScaleFrame.Style.Add("filter", "ALPHA(opacity=70)");
            divScaleFrame.Style.Add("Z-index", "21");
            divScaleFrame.Style.Add("padding", "0.3em");
            divScaleFrame.Style.Add("left", "60%");
            divScaleFrame.Style.Add("top", "95%");
            divScaleFrame.Controls.Add(divScaleBar);
            divScaleFrame.Controls.Add(divScaleText);
            this.Controls.Add(divScaleFrame);

            divZoomLayer = new HtmlGenericControl("div");
            divZoomLayer.ID = "zoomBox";
            divZoomLayer.Style.Clear();
            divZoomLayer.Style.Add("z-index", "22");
            divZoomLayer.Style.Add("border", "1px dashed #0000ff");
            divZoomLayer.Style.Add("background-color", "#ccccff");
            divZoomLayer.Style.Add("opacity ", "0.7");
            divZoomLayer.Style.Add("filter", "ALPHA(opacity=70)");
            divZoomLayer.Style.Add("overflow", "hidden");
            divZoomLayer.Style.Add("position", "absolute");
            divZoomLayer.Style.Add("line-height", "0px");
            divZoomLayer.Style.Add("visibility", "hidden");
            this.Controls.Add(divZoomLayer);

            divCanvas = new HtmlGenericControl("div");
            divCanvas.ID = "canvas";
            divCanvas.Style.Add("z-index", "23");
            divCanvas.Style.Add("position", "absolute");
            divCanvas.Style.Add("height", "100%");
            divCanvas.Style.Add("width", "100%");
            divCanvas.Controls.Add(new LiteralControl("<script type=\"text/javascript\">var jg = new jsGraphics(\"" + this.ClientID + "_" + divCanvas.ClientID + "\");</script>\r\n"));
            this.Controls.Add(divCanvas);

            divMeasure = new HtmlGenericControl("div");
            divMeasure.ID = "measure";
            divMeasure.Style.Clear();
            divMeasure.Style.Add("z-index", "24");
            divMeasure.Style.Add("position", "absolute");
            divMeasure.Style.Add("background-color", "#fff");
            divMeasure.Style.Add("visibility", "hidden");
            this.Controls.Add(divMeasure);
        }
Ejemplo n.º 36
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Wraps a control in an update panel
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static Control WrapUpdatePanelControl(Control objControl, bool blnIncludeProgress)
        {
            UpdatePanel updatePanel = new UpdatePanel();
            updatePanel.ID = objControl.ID + "_UP";
            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;

            Control objContentTemplateContainer = updatePanel.ContentTemplateContainer;

            for (int i = 0; i <= objControl.Parent.Controls.Count - 1; i++)
            {
                //find offset of original control
                if (objControl.Parent.Controls[i].ID == objControl.ID)
                {
                    //if ID matches
                    objControl.Parent.Controls.AddAt(i, updatePanel);
                    //insert update panel in that position
                    objContentTemplateContainer.Controls.Add(objControl);
                    //inject passed in control into update panel
                    break; // TODO: might not be correct. Was : Exit For
                }
            }

            if (blnIncludeProgress)
            {
                //create image for update progress control
                System.Web.UI.WebControls.Image objImage = new System.Web.UI.WebControls.Image();
                objImage.ImageUrl = "~/images/progressbar.gif";
                //hardcoded
                objImage.AlternateText = "ProgressBar";

                UpdateProgress updateProgress = new UpdateProgress();
                updateProgress.AssociatedUpdatePanelID = updatePanel.ID;
                updateProgress.ID = updatePanel.ID + "_Prog";
                updateProgress.ProgressTemplate = new LiteralTemplate(objImage);

                objContentTemplateContainer.Controls.Add(updateProgress);
            }

            return updatePanel;
        }
Ejemplo n.º 37
0
                private void CreateControls()
                {
                    if (Question == null)
                    {
                        Label noPollAvailableLabel = new Label();
                        noPollAvailableLabel.Text = "No poll available";
                        this.Controls.Add(new LiteralControl("<i>"));
                        this.Controls.Add(noPollAvailableLabel);
                        this.Controls.Add(new LiteralControl("</i>"));
                    }
                    else
                    {

                    }
                    //Hyperlink
                    HyperLink hyp = new HyperLink();
                    hyp.NavigateUrl = "~/portal/evaluation/poll/List.aspx";
                    hyp.Text = "All polls";

                    this.Controls.Add(hyp);
                    this.Controls.Add(new LiteralControl("<br/>"));
                    this.Controls.Add(new LiteralControl("<br/>"));

                    //Question
                    Label questionLabel = new Label();
                    questionLabel.Text = Question.Question;
                    questionLabel.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");
                    this.Controls.Add(questionLabel);

                    this.Controls.Add(new LiteralControl("<br/>"));

                    //Me.Controls.Add(New LiteralControl("<ul>"))

                    if (IsUserAllowedToVote)
                    {

                        RadioButtonList rbl = new RadioButtonList();
                        //The LinkButton Answers

                        foreach (PollAnswers answer in AnswerTable)
                        {
                            rbl.Items.Add(new ListItem(answer.Answer, answer.PollAnswerId.ToString()));
                        }

                        this.Controls.Add(rbl);
                        this.Controls.Add(new LiteralControl("<br />"));

                        //only render the SubmitButton when there are answers
                        if (AnswerTable.Count > 0)
                        {
                            System.Web.UI.WebControls.Button rlb = new System.Web.UI.WebControls.Button();
                            rlb.Text = "Submit";
                            rlb.Click += new System.EventHandler(SubmitButton_Click);

                            this.Controls.Add(rlb);
                        }

                        this.Controls.Add(new LiteralControl("<br />"));

                    }
                    else
                    {
                        this.Controls.Add(new LiteralControl("<ul>"));
                        //The Label answers

                        foreach (PollAnswers row in AnswerTable)
                        {
                            decimal percentage = ComputePercentage(Poll.NumberOfVotesByAnswer(row.PollAnswerId));

                            this.Controls.Add(new LiteralControl("<li>"));

                            Label answerLabel = new Label();
                            answerLabel.Text = string.Format("{0}:", row.Answer);
                            this.Controls.Add(answerLabel);

                            this.Controls.Add(new LiteralControl("<br/>"));

                            System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                            img.ImageUrl = "~/images/pixel.png";
                            img.Height = new Unit(7);
                            img.Width = new Unit(percentage.ToString());
                            this.Controls.Add(img);

                            Label percentageLabel = new Label();
                            percentageLabel.Text = string.Format(" ({0}%)", percentage.ToString());
                            this.Controls.Add(percentageLabel);

                            this.Controls.Add(new LiteralControl("</li>"));
                        }
                        this.Controls.Add(new LiteralControl("</ul>"));

                        //The summary
                        HyperLink summaryLink = new HyperLink();
                        string ttlvotes = Poll.CountTotalVotes(Question.PollId).ToString();
                        if (ttlvotes == "1")
                        {
                            summaryLink.Text = string.Format("{0} vote", ttlvotes);
                        }
                        else
                        {
                            summaryLink.Text = string.Format("{0} votes", ttlvotes);
                        }

                        summaryLink.NavigateUrl = "~/portal/evaluation/poll/View.aspx?PollId=" + Question.PollId.ToString();
                        this.Controls.Add(summaryLink);

                        this.Controls.Add(new LiteralControl("<br/>"));

                        HyperLink totalReactionsLink = new HyperLink();
                        string ttlrxns = Poll.CountTotalReactions(Question.PollId).ToString();
                        if (ttlrxns == "1")
                        {
                            totalReactionsLink.Text = string.Format("{0} reactie", ttlrxns);
                        }
                        else
                        {
                            totalReactionsLink.Text = string.Format("{0} reacties", ttlrxns);
                        }

                        totalReactionsLink.NavigateUrl = "~/portal/evaluation/poll/View.aspx?PollId=" + Question.PollId.ToString();
                        this.Controls.Add(totalReactionsLink);
                    }

                    //Administrator section
                    if (Page.User.IsInRole("Administrators"))
                    {
                        this.Controls.Add(new LiteralControl("<br/>"));
                        this.Controls.Add(new LiteralControl("<br/>"));
                        System.Web.UI.WebControls.Button adminLinkButton = new System.Web.UI.WebControls.Button();
                        adminLinkButton.PostBackUrl = "~/portal/evaluation/poll/Manage.aspx";
                        adminLinkButton.Text = "Manage Polls";
                        this.Controls.Add(adminLinkButton);
                    }
                }
Ejemplo n.º 38
0
        /***********Method  GetSlide Added by:Zeeshan*******/
        public Slide GetSlide(int slideNumber)
        {
            try
            {
                //build URI to get slide count
                string strURI = Product.BaseProductUri + "/slides/" + FileName + "/slides/" + slideNumber;

                string signedURI = Utils.Sign(strURI);

                Stream responseStream = Utils.ProcessCommand(signedURI, "GET");

                StreamReader reader = new StreamReader(responseStream);
                string strJSON = reader.ReadToEnd();

                System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();

                //Parse the json string to JObject
                JObject parsedJSON = JObject.Parse(strJSON);

                //Deserializes the JSON to a object. 
                SlideDetailResponse slidesResponse = JsonConvert.DeserializeObject<SlideDetailResponse>(parsedJSON.ToString());

                return slidesResponse.Slide;
            }
            catch (Exception ex)
            { throw ex; }
        }