Exemple #1
0
        public IEnumerable<object> Render(PanelItem panelItem)
        {
            if (panelItem.Type == PanelItemType.Image)
            {
                var image = new Image { ID = panelItem.GetId(), Enabled = false, Width = new Unit(panelItem.Width, UnitType.Pixel), CssClass = ItemStyle };

                panelItem.Target = image;

                return new object[] { image };
            }
            if (panelItem.Type == PanelItemType.InfoIcon)
            {
                var image = new Image
                {
                    ID = panelItem.GetId(),
                    ImageUrl = @"../images/info.png",
                    ToolTip = ResourceManager.GetString(panelItem.Text.IsNullOrEmpty() ? panelItem.GetPropertyName() + "Info" : panelItem.Text),
                    Enabled = false,
                    Width = new Unit(panelItem.Width, UnitType.Pixel),
                    CssClass = ItemStyle
                };

                panelItem.Target = image;

                return new object[] { image };
            }

            return null;
        }
    protected void cmdCreate_Click(object sender, System.EventArgs e)
    {
        tbl.Controls.Clear();

        int rows = Int32.Parse(txtRows.Text);
        int cols = Int32.Parse(txtCols.Text);

        for (int i = 0; i < rows; i++)
        {
            TableRow rowNew = new TableRow();
            tbl.Controls.Add(rowNew);
            for (int j = 0; j < cols; j++)
            {
                TableCell cellNew = new TableCell();
                Label lblNew = new Label();
                lblNew.Text = "(" + i.ToString() + "," + j.ToString() + ")<br />";

                System.Web.UI.WebControls.Image imgNew = new System.Web.UI.WebControls.Image();
                imgNew.ImageUrl = "cellpic.png";

                cellNew.Controls.Add(lblNew);
                cellNew.Controls.Add(imgNew);

                if (chkBorder.Checked == true)
                {
                    cellNew.BorderStyle = BorderStyle.Inset;
                    cellNew.BorderWidth = Unit.Pixel(1);
                }

                rowNew.Controls.Add(cellNew);
            }
        }
    }
 protected void lnkDownload_Click(object sender, EventArgs e)
 {
     System.Web.UI.WebControls.Image objImg = new System.Web.UI.WebControls.Image();
     objImg.
     objImg. = "handlethings.ashx?op=imagednld";
     Bitmap bmp2 = new Bitmap(objImg);
 }
Exemple #4
0
        public static System.Web.UI.WebControls.Image buildAlertImage(AlertLevel level)
        {
            System.Web.UI.WebControls.Image res = new System.Web.UI.WebControls.Image();

            switch (level)
            {
                case AlertLevel.None:
                    res.ImageUrl = "~/img/ok.png";
                    res.AlternateText = "OK";
                    break;
                case AlertLevel.Warning:
                    res.ImageUrl = "~/img/warning.png";
                    res.AlternateText = "Warning";
                    break;
                case AlertLevel.Critical:
                default:
                    res.ImageUrl = "~/img/critical.png";
                    res.AlternateText = "Critical";
                    break;
            }

            res.BorderWidth = 0;
            res.Style["vertical-align"] = "middle";

            return res;
        }
 void AddImage(HtmlGenericControl container, AppointmentImageItem imageItem)
 {
     System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
     imageItem.ImageProperties.AssignToControl(image, false);
     SchedulerWebEventHelper.AddOnDragStartEvent(image, ASPxSchedulerScripts.GetPreventOnDragStart());
     container.Controls.Add(image);
 }
        /// <summary>
        /// Sets the sort image states.
        /// </summary>
        /// <param name="gridView">The grid view.</param>
        /// <param name="row">The row.</param>
        /// <param name="columnStartIndex"> </param>
        /// <param name="sortField">The sort field.</param>
        /// <param name="sortAscending">if set to <c>true</c> [sort ascending].</param>
        public static void SetSortImageStates(GridView gridView, GridViewRow row,int columnStartIndex, string sortField, bool sortAscending)
        {
            for (var i = columnStartIndex; i < row.Cells.Count; i++)
            {
                var tc = row.Cells[i];
                if (!tc.HasControls()) continue;

                // search for the header link  
                var lnk = tc.Controls[0] as LinkButton;
                if (lnk == null) continue;

                // initialize a new image
                var img = new Image
                {
                    ImageUrl = string.Format("~/images/{0}.png", (sortAscending ? "bullet_arrow_up" : "bullet_arrow_down")),
                    CssClass = "icon"
                };

                // setting the dynamically URL of the image
                // checking if the header link is the user's choice
                if (sortField == lnk.CommandArgument)
                {
                    // adding a space and the image to the header link
                    //tc.Controls.Add(new LiteralControl(" "));
                    tc.Controls.Add(img);
                }
            }
        }
Exemple #7
0
    protected override void Render(HtmlTextWriter output)
    {
      Assert.ArgumentNotNull(output, nameof(output));

      base.Render(output);

      //render other control
      var value = GetValue();

     
      if (!string.IsNullOrEmpty(value))
      {
        //get lat lng
        var position = value.Split(',');

        if (position.Count() == 2)
        {
          double lat = 0;
          double lng = 0;

          double.TryParse(position[0], out lat);
          double.TryParse(position[1], out lng);

          var mapImageCtrl = new Image();
          mapImageCtrl.ID = ID + "_Img_MapView";
          mapImageCtrl.CssClass = "imageMapView";
          mapImageCtrl.Width = mapWidth;
          mapImageCtrl.Height = mapHeight;
          mapImageCtrl.ImageUrl = GetMapImageUrl();
          mapImageCtrl.Style.Add("padding-top", "5px");

          mapImageCtrl.RenderControl(output);
        }     
      }
    }
        /// <summary>
        /// Makes a bracket cell for a row.
        /// </summary>
        /// <param name="team">The team corressponding to the row the cell is being
        /// placed in.</param>
        /// <returns>The Bracket cell for the row.</returns>
        private TableCell MakeBracketCell(ContestTeam team)
        {
            TableCell bracketCell = new TableCell();
            bracketCell.HorizontalAlign = HorizontalAlign.Center;

            System.Web.UI.WebControls.Image bracketImage = new System.Web.UI.WebControls.Image();
            bracketImage.Width = new Unit("25px");
            bracketImage.Height = new Unit("25px");
            bracketImage.ImageAlign = ImageAlign.Middle;

            if (team.Bracket == (int)ContestBracket.Bronze)
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/BronzeBracket.png";
            }
            else if (team.Bracket == (int)ContestBracket.Silver)
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/SilverBracket.png";
            }
            else if (team.Bracket == (int)ContestBracket.Gold)
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/GoldBracket.png";
            }
            else if (team.Bracket == (int)ContestBracket.Platinum)
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/PlatinumBracket.png";
            }
            else
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/DiamondBracket.png";
            }

            bracketCell.Controls.Add(bracketImage);;

            return bracketCell;
        }
Exemple #9
0
        /// <summary>
        /// Sets the sort image states.
        /// </summary>
        /// <param name="gridView">The grid view.</param>
        /// <param name="row">The row.</param>
        /// <param name="sortField">The sort field.</param>
        /// <param name="sortAscending">if set to <c>true</c> [sort ascending].</param>
        public static void SetSortImageStates(GridView gridView, GridViewRow row,int columnStartIndex, string sortField, bool sortAscending)
        {
            for (int i = columnStartIndex; i < row.Cells.Count; i++)
            {
                TableCell tc = row.Cells[i];
                if (tc.HasControls())
                {
                    // search for the header link
                    LinkButton lnk = (LinkButton)tc.Controls[0];
                    if (lnk != null)
                    {
                        // initialize a new image
                        System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                        // setting the dynamically URL of the image
                        img.ImageUrl = "~/images/" + (sortAscending ? "bullet_arrow_up" : "bullet_arrow_down") + ".png";
                        img.CssClass = "icon";
                        // checking if the header link is the user's choice
                        if (sortField == lnk.CommandArgument)
                        {
                            // adding a space and the image to the header link
                            //tc.Controls.Add(new LiteralControl(" "));
                            tc.Controls.Add(img);
                        }

                    }
                }
            }
        }
Exemple #10
0
    protected void ugrdKpiList_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
    {
        Infragistics.WebUI.UltraWebGrid.TemplatedColumn cCol = (Infragistics.WebUI.UltraWebGrid.TemplatedColumn)e.Row.Band.Columns.FromKey("USE_YN");
        System.Web.UI.WebControls.Image objImg = (System.Web.UI.WebControls.Image)((Infragistics.WebUI.UltraWebGrid.CellItem)cCol.CellItems[e.Row.BandIndex]).FindControl("imgUseYn");
        objImg.ImageUrl = (e.Row.Cells.FromKey("USE_YN").Value.ToString() == "Y") ?
                          "../images/icon_o.gif" : "../images/icon_x.gif";

        //cCol   = (TemplatedColumn)e.Row.Band.Columns.FromKey("APPROVAL_STATUS");
        //objImg = (Image)((CellItem)cCol.CellItems[e.Row.BandIndex]).FindControl("imgUseYn");
        //objImg.ImageUrl = (e.Row.Cells.FromKey("APPROVAL_STATUS").Value.ToString() == "Y") ?
        //                  "../images/icon_o.gif" : "../images/icon_x.gif";

        cCol   = (Infragistics.WebUI.UltraWebGrid.TemplatedColumn)e.Row.Band.Columns.FromKey("APP_STATUS");
        objImg = (System.Web.UI.WebControls.Image)((Infragistics.WebUI.UltraWebGrid.CellItem)cCol.CellItems[e.Row.BandIndex]).FindControl("imgApp");
        string strImg = (e.Row.Cells.FromKey("APP_STATUS").Value == null) ? "" : e.Row.Cells.FromKey("APP_STATUS").Value.ToString();

        MicroBSC.Biz.Common.Biz.Biz_Com_Approval_Info.GetAppImageUrl(strImg);
        objImg.AlternateText = MicroBSC.Biz.Common.Biz.Biz_Com_Approval_Info.GetAppImageText(strImg);

        tRow += 1;
        if (strImg == Biz_Type.app_status_complete)
        {
            tCol += 1;
        }

        //lblRowCount.Text = tCol.ToString() + " / " + tRow.ToString();
    }
    protected void gridGAC_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.Cells.Count > 3)
            {
                // Last modified on is in Column - 3, index starts at 0.
                int compare = System.DateTime.Compare(DateTime.Parse(e.Row.Cells[2].Text), System.DateTime.Today);

                if (compare > 0)
                {
                    System.Web.UI.WebControls.Image tickImage = new System.Web.UI.WebControls.Image();
                    tickImage.ImageUrl = "~/Images/tick-circle-frame-icon.png";
                    tickImage.ToolTip = "This DLL was installed into GAC today.";

                    e.Row.Cells[0].Controls.Add(tickImage);
                    e.Row.Cells[1].ForeColor = Color.Teal;
                    e.Row.Cells[2].ForeColor = Color.Teal;
                    e.Row.Cells[3].ForeColor = Color.Teal;
                }
            }

            if (e.Row.Cells.Count > 0)
            {
                if (e.Row.Cells[0].Text.Contains(identifier))
                {
                    e.Row.Cells[0].ForeColor = Color.Red;
                    e.Row.Cells[1].ForeColor = Color.Red;
                    e.Row.Cells[2].ForeColor = Color.Red;
                    e.Row.Cells[3].ForeColor = Color.Red;
                }
            }
        }
    }
        /// <summary>
        /// Gets a panel with all the image elements from a device within it.
        /// </summary>
        /// <param name="images"></param>
        /// <returns></returns>
        internal static Panel GetImagesPanel(KeyValuePair<string, Uri>[] images)
        {
            if (images != null)
            {
                Panel panel = new Panel();
                foreach (var hardwareImage in images)
                {
                    Panel item = new Panel();
                    item.Style.Add("float", "left");

                    Panel imagePanel = new Panel();

                    System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
                    image.ImageUrl = hardwareImage.Value.ToString();
                    image.Height = 128;
                    image.Width = 128;
                    imagePanel.Controls.Add(image);


                    Literal caption = new Literal();

                    caption.Text = String.Format("<h4 class=\"deviceImageCaption\">{0}</h4>", hardwareImage.Key);

                    item.Controls.Add(imagePanel);
                    item.Controls.Add(caption);

                    panel.Controls.Add(item);
                }
                return panel;
            }
            else
                return null;
        }
        protected void showFood_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //Check for postback
            if (IsPostBack)
            {
                //Set the sort images depending on coloumn and sort direction
                if (e.Row.RowType == DataControlRowType.Header)
                {
                    System.Web.UI.WebControls.Image SortImage = new System.Web.UI.WebControls.Image();

                    for (int i = 0; i <= showFood.Columns.Count - 1; i++)
                    {
                        if (showFood.Columns[i].SortExpression == Session["SortColumn"].ToString())
                        {
                            if (Session["SortDirection"].ToString() == "DESC")
                            {
                                SortImage.ImageUrl      = "/images/desc.jpg";
                                SortImage.AlternateText = "Sort Descending";
                            }
                            else
                            {
                                SortImage.ImageUrl      = "/images/asc.jpg";
                                SortImage.AlternateText = "Sort Ascending";
                            }

                            e.Row.Cells[i].Controls.Add(SortImage);
                        }
                    }
                }
            }

            if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState == DataControlRowState.Alternate)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#D1F0FF'");
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#E6E6E6'");
                    e.Row.BackColor = Color.FromName("#E6E6E6");
                }
            }
            else
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#D1F0FF'");
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
                    e.Row.BackColor = Color.FromName("#FFFFFF");
                }

                //e.Row.Cells[0].BackColor = Color.FromName("gray");
                //e.Row.Cells[1].BackColor = Color.FromName("gray");
                //e.Row.Cells[2].BackColor = Color.FromName("gray");
                //e.Row.Cells[3].BackColor = Color.FromName("gray");
                //e.Row.Cells[4].BackColor = Color.FromName("gray");
                //e.Row.BorderWidth = 2;
                //e.Row.BorderColor = Color.FromName("#43C6DB");
            }
        }
Exemple #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection cc = new System.Data.SqlClient.SqlConnection();

        cc.ConnectionString = ConfigurationManager.ConnectionStrings["FYPproject"].ConnectionString;
        cc.Open();
        string sql;

        SqlDataReader reader;

        sql = "select location,FileName,description,f_type from UploadedFiles;";
        SqlCommand cmd = new SqlCommand(sql, cc);

        reader = cmd.ExecuteReader();
        TableCell[] cells = new TableCell[3];
        int         m     = 0;

        Table1.Controls.Clear();
        TableRow r = new TableRow();

        while (reader.Read())
        {
            TableCell c = new TableCell();
            string    t = reader[3].ToString();
            t = t.ToLower();
            if (t == ".jpg" || t == ".jpeg" || t == ".gif" || t == ".ping" || t == ".png" || t == ".jpg" || t == ".bmp")
            {
                System.Web.UI.WebControls.Image i = new System.Web.UI.WebControls.Image();
                i.Width    = 100;
                i.Height   = 100;
                i.ImageUrl = reader[0].ToString();
                i.ToolTip  = reader[1].ToString();
                c.Controls.Add(i);
            }
            else
            {
                HyperLink i = new HyperLink();
                i.Text        = reader[1].ToString();
                i.NavigateUrl = "download.aspx?file=" + reader[0];
                c.Controls.Add(i);
            }
            Label l = new Label();
            l.Text = "<br>" + reader[2].ToString();


            c.Controls.Add(l);
            // cells[m++] = c;
            m++;
            r.Controls.Add(c);

            if (m >= 2)
            {
                Table1.Controls.Add(r);
                r = new TableRow();
                m = 0;
            }
        }
    }
Exemple #15
0
    protected void Grid2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string PATH = "https://eip.tkfood.com.tw/BM/upload/note/";
        Image  img  = (Image)e.Row.FindControl("Image1");

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView row  = (DataRowView)e.Row.DataItem;
            Image       img1 = (Image)e.Row.FindControl("Image1");

            if (!string.IsNullOrEmpty(row["FILENAME"].ToString()))
            {
                img.ImageUrl = PATH + row["FILENAME"].ToString();

                //獲取當前行的圖片路徑
                string ImgUrl = img.ImageUrl;
                ////給帶圖片的單元格添加點擊事件
                //e.Row.Cells[10].Attributes.Add("onclick", e.Row.Cells[3].ClientID.ToString()
                //    + ".checked=true;CellClick('" + ImgUrl + "')");

                //img.ImageUrl = "https://eip.tkfood.com.tw/BM/upload/note/20200926112527.jpg";
            }
        }

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //Get the button that raised the event
            Button btn = (Button)e.Row.FindControl("Button1");

            //Get the row that contains this button
            GridViewRow gvr = (GridViewRow)btn.NamingContainer;

            //string cellvalue = gvr.Cells[2].Text.Trim();
            string Cellvalue = btn.CommandArgument;

            DataRowView row      = (DataRowView)e.Row.DataItem;
            Button      lbtnName = (Button)e.Row.FindControl("Button1");

            ExpandoObject param = new { ID = Cellvalue }.ToExpando();

            //Grid開窗是用RowDataBound事件再開窗
            Dialog.Open2(lbtnName, "~/CDS/WebPage/COP/TBBU_TBSALESEVENTSFORSALESDialogEDITDEL.aspx", "", 800, 600, Dialog.PostBackType.AfterReturn, param);


            //Button2
            //Get the button that raised the event
            Button btn2 = (Button)e.Row.FindControl("Button2");
            //Get the row that contains this button
            GridViewRow gvr2 = (GridViewRow)btn2.NamingContainer;
            //string cellvalue = gvr.Cells[2].Text.Trim();
            string        Cellvalue2 = btn2.CommandArgument;
            DataRowView   row2       = (DataRowView)e.Row.DataItem;
            Button        lbtnName2  = (Button)e.Row.FindControl("Button2");
            ExpandoObject param2     = new { ID = Cellvalue }.ToExpando();
            //Grid開窗是用RowDataBound事件再開窗
            Dialog.Open2(lbtnName2, "~/CDS/WebPage/COP/TBBU_TBSALESEVENTSCOMMENTSFORSALESDialogSALESADD.aspx", "", 800, 600, Dialog.PostBackType.AfterReturn, param2);
        }
    }
Exemple #16
0
        /// <summary>
        /// Handles the PreRender event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event
        /// data.</param>
        private void Page_PreRender(object sender, System.EventArgs e)
        {
            if (this.Visible)
            {
                if (this.InnerTopic.FivePointRatingsRecorded > 0)
                {
                    this.lblAverageRating.Text = this.InnerTopic.FivePointAverage.ToString("#.#");
                    this.lblRatingCount.Text   = string.Format(
                        Localization.GetString(
                            "RatingsNumberOf", this.RouterResourceFile),
                        this.InnerTopic.FivePointRatingsRecorded.ToString());

                    int i = 0;
                    i = 0;
                    for (i = 0; i <= 4; i++)
                    {
                        System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                        img.ImageUrl = this.DNNWikiModuleRootPath + "/Resources/images/bcImage.gif";
                        img.Width    = Unit.Pixel(10);

                        int currentCount = 0;
                        switch (i)
                        {
                        case 0:
                            currentCount = this.InnerTopic.RatingOneCount;
                            break;

                        case 1:
                            currentCount = this.InnerTopic.RatingTwoCount;
                            break;

                        case 2:
                            currentCount = this.InnerTopic.RatingThreeCount;
                            break;

                        case 3:
                            currentCount = this.InnerTopic.RatingFourCount;
                            break;

                        case 4:
                            currentCount = this.InnerTopic.RatingFiveCount;
                            break;
                        }

                        img.Height        = Unit.Pixel(Convert.ToInt32(25f * (Convert.ToDouble(currentCount) / Convert.ToDouble(this.InnerTopic.FivePointRatingsRecorded))));
                        img.AlternateText = currentCount.ToString();
                        this.RatingsGraphTable.Rows[0].Cells[i].Controls.Add(img);
                    }
                }
                else
                {
                    this.lblAverageRating.Text = Localization.GetString("RatingsNotRatedYet", this.RouterResourceFile);
                    this.lblRatingCount.Text   = string.Format(Localization.GetString("RatingsNumberOf", this.RouterResourceFile), "0");

                    this.RatingsGraphTable.Visible = false;
                }
            }
        }
Exemple #17
0
        protected void Lista_cotizacion_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lbl_num_cot_erp = e.Row.FindControl("lbl_num_cot_erp") as Label;
                // DataRowView drv = (DataRowView)e.Row.DataItem;

                System.Web.UI.WebControls.Image img_estado = e.Row.FindControl("img_estado") as System.Web.UI.WebControls.Image;

                string valor = e.Row.Cells[6].Text;

                string result = busca_estado_cot(Convert.ToInt32(valor));

                if (result.Substring(0, 8) == "Ingresad")
                {
                    img_estado.ImageUrl = "~/img/nuevo.png";
                    img_estado.ToolTip  = result;
                }

                if (result.Substring(0, 8) == "Asignada")
                {
                    img_estado.ImageUrl = "~/img/asignado.png";
                    img_estado.ToolTip  = result;
                }

                if (result.Substring(0, 8) == "Aceptada")
                {
                    img_estado.ImageUrl = "~/img/Apruebo.png";
                    img_estado.ToolTip  = result;
                }

                if (result.Substring(0, 8) == "Rechaza ")
                {
                    img_estado.ImageUrl = "~/img/Rechazo.png";
                    img_estado.ToolTip  = result;
                }

                lbl_num_cot_erp.Text = busca_numero_doc_erp(Convert.ToInt32(e.Row.Cells[6].Text), "CO");


                e.Row.Cells[0].HorizontalAlign  = HorizontalAlign.Left;
                e.Row.Cells[1].HorizontalAlign  = HorizontalAlign.Left;
                e.Row.Cells[2].HorizontalAlign  = HorizontalAlign.Center;
                e.Row.Cells[3].HorizontalAlign  = HorizontalAlign.Left;
                e.Row.Cells[4].HorizontalAlign  = HorizontalAlign.Left;
                e.Row.Cells[5].HorizontalAlign  = HorizontalAlign.Left;
                e.Row.Cells[6].HorizontalAlign  = HorizontalAlign.Center;
                e.Row.Cells[7].HorizontalAlign  = HorizontalAlign.Center;
                e.Row.Cells[8].HorizontalAlign  = HorizontalAlign.Center;
                e.Row.Cells[9].HorizontalAlign  = HorizontalAlign.Right;
                e.Row.Cells[10].HorizontalAlign = HorizontalAlign.Right;
                e.Row.Cells[11].HorizontalAlign = HorizontalAlign.Left;
                e.Row.Cells[12].HorizontalAlign = HorizontalAlign.Right;
                // e.Row.Cells[13].HorizontalAlign = HorizontalAlign.Right;
                // e.Row.Cells[14].HorizontalAlign = HorizontalAlign.Right;
            }
        }
Exemple #18
0
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            List<String> lstcode = new List<string>();
            //lstcode.Add(txtCode.Text);
            lstcode.Add("00271B7");
            //lstcode.Add("00533A7");
            //lstcode.Add("0056251");
            //lstcode.Add("00623D6");
            //lstcode.Add("007FF4C");
            //lstcode.Add("0085604");
            //lstcode.Add("009153D");
            //lstcode.Add("00947E7");
            //lstcode.Add("00A3631");

            //lstcode.Add("00C96DE");
            //lstcode.Add("00EB691");
            //lstcode.Add("00F3513");
            //lstcode.Add("010B183");
            //lstcode.Add("011DA5F");
            //lstcode.Add("0136BB5");
            //lstcode.Add("013ABFD");
            //lstcode.Add("013CFC7");
            //lstcode.Add("0142610");
            //lstcode.Add("0148237");
            //lstcode.Add("0151BA7");
            //lstcode.Add("0156796");
            //lstcode.Add("015AC84");
            //lstcode.Add("015C038");

            string barCode = txtCode.Text;

            foreach (string str in lstcode)
            {
                System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
                using (Bitmap bitMap = new Bitmap(str.Length * 40, 80))
                {
                    using (Graphics graphics = Graphics.FromImage(bitMap))
                    {
                        Font oFont = new Font("IDAutomationHC39M", 8);
                        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("*" + str + "*", 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);
                    }
                    plBarCode.Controls.Add(imgBarCode);
                }
            }
        }
        /// <summary>
        /// Handles when the visual rating loads
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Stars_Ld(Object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                System.Web.UI.WebControls.Image image = (System.Web.UI.WebControls.Image)sender;
                string originalImage = image.ImageUrl;

                //This sets the image to change to "View Comments" when the mouse is over it
                image.Attributes["OnMouseOver"] = "javascript:changeImage(this, 'images/View Comments.gif');";

                //Based on the numerical rating the associated visual rating is provided
                if (originalImage.Equals("images/stars0.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars0.gif');";
                }
                else if (originalImage.Equals("images/stars05.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars05.gif');";
                }
                else if (originalImage.Equals("images/stars1.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars1.gif');";
                }
                else if (originalImage.Equals("images/stars15.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars15.gif');";
                }
                else if (originalImage.Equals("images/stars2.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars2.gif');";
                }
                else if (originalImage.Equals("images/stars25.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars25.gif');";
                }
                else if (originalImage.Equals("images/stars3.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars3.gif');";
                }
                else if (originalImage.Equals("images/stars35.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars35.gif');";
                }
                else if (originalImage.Equals("images/stars4.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars4.gif');";
                }
                else if (originalImage.Equals("images/stars45.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars45.gif');";
                }
                else if (originalImage.Equals("images/stars5.gif"))
                {
                    image.Attributes["OnMouseOut"] = "javascript:changeImage(this, 'images/stars5.gif');";
                }
            }
        }
        protected void gvTerritoryGroupAudit_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                Label lblTerritory;
                Label lblTerritoryName;
                Label lblTerritoryLoc;

                string changeType;

                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    lblTerritory     = (e.Row.FindControl("lblTerritory") as Label);
                    lblTerritoryName = (e.Row.FindControl("lblTerritoryName") as Label);
                    lblTerritoryLoc  = (e.Row.FindControl("lblTerritoryLoc") as Label);

                    changeType = (e.Row.FindControl("hdnChangeType") as HiddenField).Value;

                    //For deleted records
                    //Change the color of details to red
                    if (changeType == "D")
                    {
                        lblTerritory.ForeColor     = Color.Red;
                        lblTerritoryName.ForeColor = Color.Red;
                        lblTerritoryLoc.ForeColor  = Color.Red;
                    }
                }
                //JIRA-746 Changes by Ravi on 05/03/2019 -- Start
                if (e.Row.RowType == DataControlRowType.Header)
                {
                    foreach (TableCell tc in e.Row.Cells)
                    {
                        if (tc.HasControls())
                        {
                            LinkButton lnkHeader = (LinkButton)tc.Controls[0];
                            lnkHeader.Style.Add("color", "black");
                            lnkHeader.Style.Add("text-decoration", "none");

                            if (lnkHeader != null && hdnSortExpression.Value == lnkHeader.CommandArgument)
                            {
                                // initialize a new image
                                System.Web.UI.WebControls.Image imgSort = new System.Web.UI.WebControls.Image();
                                imgSort.ImageUrl = (hdnSortDirection.Value == ascending) ? sort_Up : sort_Down;
                                // adding a space and the image to the header link
                                tc.Controls.Add(new LiteralControl(" "));
                                tc.Controls.Add(imgSort);
                            }
                        }
                    }
                }
                //JIRA-746 Changes by Ravi on 05/03/2019 -- End
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error in binding data to grid.", ex.Message);
            }
        }
Exemple #21
0
        //Row Data Bound
        protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                // for the Footer, display the running totals
                e.Row.Cells[0].ColumnSpan = e.Row.Cells.Count;
                e.Row.Cells[0].Text       = GetREMes("lblTotalRecords") + "  " + recordCount.ToString();
                for (int i = 1; i < e.Row.Cells.Count; i++)
                {
                    e.Row.Cells[i].Visible = false;
                }
            }
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                System.Web.UI.WebControls.Image imgIdle = (System.Web.UI.WebControls.Image)e.Row.FindControl("imgIdle");
                DataRowView drv = e.Row.DataItem as DataRowView;
                //根据成交时间不同,显示不同的颜色,绿,黄,红,灰
                if (String.IsNullOrEmpty(drv["LatestDealDate"].ToString()))
                {
                    e.Row.BackColor = ColorTranslator.FromHtml("#F1F3F5");
                }
                else
                {
                    TimeSpan ts = DateTime.Now - DateTime.Parse(drv["LatestDealDate"].ToString());
                    if (ts.Days <= 30)
                    {
                        e.Row.BackColor = Color.LightGreen;
                    }
                    else if (ts.Days > 30 && ts.Days <= 90)
                    {
                        e.Row.BackColor = Color.Yellow;
                    }
                    else
                    {
                        e.Row.BackColor = Color.Red;
                    }
                }

                var IdleDays = int.Parse(drv["IdleDays"].ToString());
                //现在行动记录变成15天没联系才提醒...
                if (IdleDays > 15)
                {
                    imgIdle.ImageUrl = "../images/report.gif";
                }
                else
                {
                    imgIdle.ImageUrl = "../images/setup.png";
                }

                //最后一列是按钮,该单元格不要onclick
                string sId = gvData.DataKeys[e.Row.RowIndex].Value.ToString();
                for (int i = 0; i < e.Row.Cells.Count - 2; i++)
                {
                    e.Row.Cells[i].Attributes.Add("onclick", "onEdit('" + sId + "','" + EditURL + "',true); return false;");
                }
            }
        }
Exemple #22
0
        protected void btnDeleteImage_Click(object sender, System.EventArgs e)
        {
            Button b = (Button)sender;

            System.Web.UI.WebControls.Image      img = (PnlBanners.FindControl(b.Attributes["ImageName"].ToString()) as System.Web.UI.WebControls.Image);
            System.Web.UI.WebControls.FileUpload fu  = (PnlBanners.FindControl(b.Attributes["FileUploadName"].ToString()) as System.Web.UI.WebControls.FileUpload);

            ImageFileHandler(fu, img, b);
        }
Exemple #23
0
 protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         string imgUrl = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "pimage"));
         System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)e.Row.FindControl("imgProduct");
         img.ImageUrl = "~/Upload/" + imgUrl;
     }
 }
 void rptrFeaturedArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.IsItem())
     {
         var article = e.Item.DataItem as DefaultArticlePageItem;
         System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs <System.Web.UI.WebControls.Image>("imgThumbnail");
         imgThumbnail.ImageUrl = article.GetArticleThumbnailUrl(230, 129);
     }
 }
 public override Control PaintCell(String id, TableCell parent, FarPoint.Web.Spread.Appearance style, FarPoint.Web.Spread.Inset margin, object val, bool ul)
 {
     //'-------------studentphoto
     System.Web.UI.WebControls.Image img2 = new System.Web.UI.WebControls.Image();
     img2.ImageUrl = this.ImageUrl; //base.ImageUrl;
     img2.Width    = Unit.Percentage(100);
     img2.Height   = Unit.Percentage(100);
     return(img2);
 }
 public override Control PaintCell(String id, TableCell parent, FarPoint.Web.Spread.Appearance style, FarPoint.Web.Spread.Inset margin, object val, bool ul)
 {
     //'-------------licence front
     System.Web.UI.WebControls.Image imagelicence = new System.Web.UI.WebControls.Image();
     imagelicence.ImageUrl = this.ImageUrl; //base.ImageUrl;
     imagelicence.Width    = Unit.Percentage(80);
     imagelicence.Height   = Unit.Percentage(70);
     return(imagelicence);
 }
    protected System.Web.UI.WebControls.Image GetIntHxChart(string chartfile)
    {
        int rand = new Random().Next(99999999);

        System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
        img.ImageUrl = string.Concat(chartfile, '?', rand);

        return(img);
    }
Exemple #28
0
        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();
        }
        protected void dtgPix_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView curData = (DataRowView)e.Item.DataItem;

                e.Item.Cells[2].Text = ConvertUtility.ToString(e.Item.DataSetIndex + 1);

                TextBox txtUrl      = (TextBox)e.Item.FindControl("txtUrl");
                Image   imgAvatar   = (Image)e.Item.FindControl("imgAvatar");
                Label   lblDatetime = (Label)e.Item.FindControl("lblDatetime");
                TextBox txtPriority = (TextBox)e.Item.FindControl("txtPriority");
                Image   imgUser     = (Image)e.Item.FindControl("imgUser");
                var     chkCover    = (CheckBox)e.Item.FindControl("chkCover");

                txtUrl.Text = "http://" + Request.Url.Host + curData["Image_File"];
                string tooltip = "<b>" + curData["Image_Name"] + "</b><br />" + "FileSize: " + curData["Image_FileSize"] + " KB" + "\n" + "Dimension: " + curData["Image_Width"] + " x " + curData["Image_Height"] + "\n\n" + curData["Image_Description"];
                string avatar  = ConvertUtility.ToString(curData["Image_File"]);
                if (string.IsNullOrEmpty(avatar))
                {
                    imgAvatar.Visible = false;
                }
                else
                {
                    imgAvatar.Visible       = true;
                    imgAvatar.ImageUrl      = avatar;
                    imgAvatar.AlternateText = tooltip;
                }
                lblDatetime.Text = ConvertUtility.ToDateTime(curData["Image_CreateDate"]).ToString("dd/MM/yyyy HH:mm");
                txtPriority.Text = curData["Priority"].ToString();
                chkCover.Checked = ConvertUtility.ToBoolean(curData["IsCover"]);
                string userEmail = ConvertUtility.ToString(UserDB.GetEmailByID(ConvertUtility.ToInt32(curData["User_ID"])));
                if (string.IsNullOrEmpty(userEmail))
                {
                    imgUser.Visible = false;
                }
                else
                {
                    imgUser.Visible = true;
                    imgUser.ToolTip = userEmail;
                }

                var btn_delete = (WebControl)e.Item.FindControl("btn_delete");
                btn_delete.Attributes.Add("onclick", MiscUtility.DELETE_CONFIRM);

                e.Item.Attributes.Add("onmouseover", "this.className='Hoverrow';");
                if (e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    e.Item.Attributes.Add("onmouseout", "this.className='DarkRow';");
                }
                else
                {
                    e.Item.Attributes.Add("onmouseout", "this.className='LightRow';");
                }
            }
        }
Exemple #30
0
        protected void RS_Agenda_ResourceHeaderCreated1(object sender, ResourceHeaderCreatedEventArgs e)
        {
            ////////Carga de colores e imagenes en encabezados de el scheduler de citas
            Panel ResourceImageWrapper = e.Container.FindControl("ResourceImageWrapper_Agenda") as Panel;

            ResourceImageWrapper.CssClass = "Resource" + e.Container.Resource.Key.ToString();

            System.Web.UI.WebControls.Image img = e.Container.FindControl("Imagen_Modalidad_Agenda") as System.Web.UI.WebControls.Image;
            img.ImageUrl = "images/" + e.Container.Resource.Text + ".png";

            string lstTec = "";

            try
            {
                AgendaRequest request = new AgendaRequest();
                request.mdlUser              = Usuario;
                request.mdlagenda.vchCodigo  = e.Container.Resource.Text;
                request.mdlagenda.intSitioID = Usuario.intSitioID;

                //request.mdlagenda.intSitioID = usuario_;
                //lstTec = RisService.getListColorModalidad(request);
                lstTec = RisService.getListColorModalidad_Sitio(request);
                lstTec = lstTec.TrimEnd();
            }
            catch (Exception ecU)
            {
                Log.EscribeLog("Existe un error en la busqueda de color de la modalidad: " + ecU.Message, 3, Usuario.vchUsuario);
            }

            Panel myControl1 = e.Container.FindControl("Panel_Agenda") as Panel;

            myControl1.Style.Add("Background", "linear-gradient(75deg, #CCCCCC, " + lstTec + " 10px, white);");



            //DataTable dt = new DataTable();
            //try
            //{
            //    string conexion = ConfigurationManager.ConnectionStrings["BD2"].ConnectionString;
            //    using (SqlConnection conn = new SqlConnection(conexion))
            //    {
            //        string query = "SELECT vchColor FROM [tbl_CAT_Modalidad] WHERE vchCodigo = '" + e.Container.Resource.Text + "'";
            //        SqlCommand cmd = new SqlCommand(query, conn);
            //        SqlDataAdapter da = new SqlDataAdapter(cmd);
            //        da.Fill(dt);
            //    }
            //}
            //catch
            //{ }

            //foreach (DataRow campo in dt.Rows)
            //{
            //    Panel myControl1 = e.Container.FindControl("Panel_Agenda") as Panel;
            //    myControl1.Style.Add("Background", "linear-gradient(75deg, #CCCCCC, " + campo[0].ToString() + " 10px, white);");
            //}
        }
Exemple #31
0
    protected void listRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
    {
        HtmlInputCheckBox chkbox   = (HtmlInputCheckBox)e.Item.FindControl("chkbox");
        HtmlInputHidden   hdnSeqID = (HtmlInputHidden)e.Item.FindControl("hdnSeqID");

        Label seqID = (Label)e.Item.FindControl("seqID");

        System.Web.UI.WebControls.Image imgType = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgType");
        Label userNm  = (Label)e.Item.FindControl("userNm");
        Label comment = (Label)e.Item.FindControl("comment");
        Label rgDt    = (Label)e.Item.FindControl("rgDt");


        string rank = DataBinder.Eval(e.Item.DataItem, "rank").ToString();

        seqID.Text  = DataBinder.Eval(e.Item.DataItem, "SeqID").ToString();
        userNm.Text = DataBinder.Eval(e.Item.DataItem, "UserNm").ToString();
        userNm.Text = "<a href=\"javascript:fNewWin('" + DataBinder.Eval(e.Item.DataItem, "Uno").ToString() + "', '" + DataBinder.Eval(e.Item.DataItem, "UserID").ToString() + "');\">" + userNm.Text + "</a>";

        comment.Text = NoteUtil.BoldSearchWord(DataBinder.Eval(e.Item.DataItem, "Comment").ToString(), this.searchWord);
        comment.Style.Add("color", DataBinder.Eval(e.Item.DataItem, "FontColor").ToString());
        rgDt.Text = ((DateTime)DataBinder.Eval(e.Item.DataItem, "rgDt")).ToString("yyyy-MM-dd HH:mm:ss");

        string type = DataBinder.Eval(e.Item.DataItem, "MemoType").ToString();

        if (type == "1")
        {
            imgType.ImageUrl = "http://img.imbc.com/mini/UserNote/images/mini_memo_icon_web.gif";
        }
        else if (type == "2")
        {
            imgType.ImageUrl = "http://img.imbc.com/mini/UserNote/images/mini_memo_icon_memo.gif";
        }
        else if (type == "4")
        {
            imgType.ImageUrl = "http://img.imbc.com/mini/UserNote/images/mini_memo_icon_phone.gif";
        }
        else
        {
            imgType.ImageUrl = "http://img.imbc.com/mini/UserNote/images/mini_memo_icon_mini.gif";
        }

        int    uno    = (int)DataBinder.Eval(e.Item.DataItem, "Uno");
        string userID = DataBinder.Eval(e.Item.DataItem, "UserID").ToString();

        chkbox.Value   = uno.ToString() + "│" + userID + "│" + DataBinder.Eval(e.Item.DataItem, "UserNm").ToString();
        hdnSeqID.Value = DataBinder.Eval(e.Item.DataItem, "SeqID").ToString();

        if (rank != "0")
        {
            seqID.Text        = "■";
            userNm.Font.Bold  = true;
            comment.Font.Bold = true;
            comment.ForeColor = Color.DarkBlue;
        }
    }
Exemple #32
0
    public static bool setProfileImage(Image image, DataRowView dataRowView)
    {
        if (!dataRowView.Row.Table.Columns.Contains("Image") || dataRowView["Image"] == DBNull.Value)
        {
            image.Visible = false;
            return(false);
        }

        return(setProfileImage(image, dataRowView["Image"].ToString()));
    }
        protected void dlistImages_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                System.Web.UI.WebControls.Image img = e.Item.FindControl("imgThumbnail") as System.Web.UI.WebControls.Image;
                string path = Server.MapPath("Images//" + img.AlternateText);

                img.ImageUrl = GenerateThumbnail(path);
            }
        }
        protected void gridviewGallery_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                System.Web.UI.WebControls.Image img = e.Row.FindControl("imgThumbnail") as System.Web.UI.WebControls.Image;
                string path = Server.MapPath("Images//" + img.AlternateText);

                img.ImageUrl = GenerateThumbnail(path);
            }
        }
Exemple #35
0
 protected System.Web.UI.WebControls.Image PutImage(string indice)
 {
     System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
     img.ID       = "img_" + indice;
     img.ImageUrl = images + "AMS.Icon.Calendar.gif";
     img.Attributes.Add("onmouseover", "_ctl1_" + "tabcal_" + indice + ".style.display='inline'");
     img.Attributes.Add("onmouseout", "_ctl1_" + "tabcal_" + indice + ".style.display='none'");
     img.BorderWidth = 0;
     return(img);
 }
Exemple #36
0
    protected void ugrdKpiResultList_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
    {
        TemplatedColumn cCol = (TemplatedColumn)e.Row.Band.Columns.FromKey("APP_STATUS");

        System.Web.UI.WebControls.Image objImg = (System.Web.UI.WebControls.Image)((CellItem)cCol.CellItems[e.Row.BandIndex]).FindControl("imgApp");
        string strImg = DataTypeUtility.GetValue(e.Row.Cells.FromKey("APP_STATUS").Value);

        objImg.ImageUrl      = Biz_Com_Approval_Info.GetAppImageUrl(strImg);
        objImg.AlternateText = Biz_Com_Approval_Info.GetAppImageText(strImg);
    }
Exemple #37
0
        /// <summary>
        /// Renders the contents.
        /// </summary>
        /// <param name="output">The output.</param>
        protected override void RenderContents(HtmlTextWriter output)
        {
            System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();

            int height = Convert.ToInt32(this.Height.Value);

            image.ImageUrl = string.Format("image.barcode?Type={0}&Code={1}&Height={2}", Type, Code, height);

            image.RenderControl(output);
        }
Exemple #38
0
        protected override void Render(HtmlTextWriter writer)
        {
            CreateBitmap();

            System.Web.UI.WebControls.Image imgGraph = new System.Web.UI.WebControls.Image();
            imgGraph.ImageUrl = _imageURL;
            imgGraph.RenderControl(writer);

            base.Render(writer);
        }
 /// <summary>
 /// Displays the image
 /// </summary>
 private void DisplayImage(string thumbnail, Store.Image image, out Img.Image drawnImage, out System.Web.UI.WebControls.Image displayImage)
 {
     drawnImage            = Img.Image.FromFile(Server.MapPath(thumbnail));
     displayImage          = new System.Web.UI.WebControls.Image();
     displayImage.ImageUrl = thumbnail;
     displayImage.Attributes.Add("BigImageUrl", Page.ResolveUrl(image.ImageFile));
     displayImage.Attributes.Add("rel", productId.ToString());
     displayImage.Attributes.Add("title", image.Caption);
     imageList.Add(displayImage);
 }
 public void InstantiateIn(System.Web.UI.Control container)
 {
     System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
     img.Width        = Unit.Pixel(16);
     img.Height       = Unit.Pixel(16);
     img.ImageUrl     = "~/layouts/images/accept.gif";
     img.ID           = roleId;
     img.DataBinding += new EventHandler(img_DataBinding);
     container.Controls.Add(img);
 }
		//Addes the image to ImageUP
		protected void showImage(Bitmap img) {
			MemoryStream ms = new MemoryStream();
			img.Save(ms, ImageFormat.Jpeg);
			var base64Data = Convert.ToBase64String(ms.ToArray());

			System.Web.UI.WebControls.Image newImg = new System.Web.UI.WebControls.Image();
			newImg.ImageUrl = "data:image/jpg;base64," + base64Data;
			newImg.Visible = true;
			imageUP.ContentTemplateContainer.Controls.Add(newImg);
		}
        /// <summary>
        /// Outputs the page navigation to the page.
        /// </summary>
        /// <param name="controlCollection">the pages' controls</param>
        /// <param name="path">The path of the current image directory being browsed</param>
        /// <param name="pageSize">The number of items on a page</param>
        /// <param name="maxIndex">The index of the last item on the last page</param>
        /// <param name="currIndex">The index of the first item in this page</param>
        public static void RendenderPageNavigation(System.Web.UI.ControlCollection controlCollection, string path,
                                                   int pageSize, int maxIndex, int currIndex, System.Web.UI.Control ctrl)
        {
            if (maxIndex >= pageSize)
            {
                HyperLink h = null;

                // Previous-Button.
                if (currIndex >= pageSize)
                {
                    h = new HyperLink();
                    int previousPageFirst = ((int)(currIndex / pageSize) - 1) * pageSize;
                    h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + path + ";" + previousPageFirst.ToString());
                    h.Text        = "1";

                    System.Web.UI.WebControls.Image prevImg = new System.Web.UI.WebControls.Image();
                    prevImg.ImageUrl = "NavPreviousSmall.gif";
                    prevImg.Attributes.Add("align", "middle");
                    h.Controls.Add(prevImg);
                    controlCollection.Add(h);
                }

                // List all Pages.
                for (int index = 0; index <= maxIndex; index += pageSize)
                {
                    h = new HyperLink();
                    if ((currIndex < index) || (currIndex >= index + pageSize))
                    {
                        h.Text        = (index / pageSize + 1).ToString() + "  ";
                        h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + path + ";" + index.ToString());
                    }
                    else
                    {
                        h.Text = "[" + (index / pageSize + 1).ToString() + "]  ";
                    }
                    h.Attributes.Add("class", "LinkButton");
                    controlCollection.Add(h);
                }

                // Next Button.
                if (currIndex < ((int)(maxIndex / pageSize)) * pageSize)
                {
                    h = new HyperLink();
                    int nextPageFirst = ((int)(currIndex / pageSize) + 1) * pageSize;
                    h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + path + ";" + nextPageFirst.ToString());
                    h.Text        = "1";

                    System.Web.UI.WebControls.Image nextImg = new System.Web.UI.WebControls.Image();
                    nextImg.ImageUrl = "NavNextSmall.gif";
                    nextImg.Attributes.Add("align", "middle");
                    h.Controls.Add(nextImg);
                    controlCollection.Add(h);
                }
            }
        }
Exemple #43
0
 private System.Web.UI.WebControls.Image scrollImage() {
     System.Web.UI.WebControls.Image functionReturnValue = null;
     functionReturnValue = new System.Web.UI.WebControls.Image();
     functionReturnValue.Width = Unit.Pixel(7);
     functionReturnValue.Height = Unit.Pixel(20);
     functionReturnValue.BorderWidth = Unit.Pixel(0);
     functionReturnValue.Attributes.Add("align", "absMiddle");
     functionReturnValue.CssClass = "editorArrow";
     functionReturnValue.Attributes.Add("onMouseOut", "this.className = 'editorArrow'; scrollStop();");
     return functionReturnValue;
 }
Exemple #44
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        // this is the folder where the uploaded files are saved
        string DefaultFileName = "";

        if (FileUploader.HasFile)
            try
            {
                //FileUploader.SaveAs(Server.MapPath(DefaultFileName) + FileUploader.FileName);

                FileUploader.SaveAs(Server.MapPath("~/Images/" + FileUploader.FileName));
                //string where = (Server.MapPath(DefaultFileName) + FileUploader.FileName);

                double punctX = 10;
                double punctY = 10;

                double spacing = 5;

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

                for (int y = 1; y < 3; y++)
                {
                    System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
                    //image.ID = "testjpg"; // +y.ToString();
                    image.Style["position"] = "absolute";
                    image.Style["left"] = punctX.ToString() + "px";
                    image.Style["top"] = punctY.ToString() + "px";
                    image.Width = 60;
                    //image.Height = 100;
                    //image.ImageUrl = (Server.MapPath(DefaultFileName) + FileUploader.FileName);
                    //image.ImageUrl = "Images/" + image.ID.ToString() + ".jpg";
                    image.ImageUrl = "Images/" + FileUploader.FileName.ToString();
                    //image.ImageUrl = Server.MapPath("~/Images/" + FileUploader.FileName);
                    Panel2.Controls.Add(image);
                    punctX += image.Width.Value + spacing;

                }

             DebugText.Text = "File name: " +
             FileUploader.PostedFile.FileName + "<br>" +
             FileUploader.PostedFile.ContentLength + " kb<br>" +
             "Content type: " +
             FileUploader.PostedFile.ContentType + "<br><b>Uploaded Successfully";

            }
            catch (Exception ex)
            {
                DebugText.Text = "ERROR: " + ex.Message.ToString();
            }
        else
        {
            DebugText.Text = "You have not specified a file.";
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            List<ProductDetailsBLL> lstProductDetails = ProductDetailsBLL.GetDetailByUser(1);
            if (lstProductDetails != null)
            {
                foreach (ProductDetailsBLL objProductDetailsBLL in lstProductDetails)
                {
                    System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
                    using (Bitmap bitMap = new Bitmap(objProductDetailsBLL.BarCodeNumber.Length * 17, 100))
                    {
                        using (Graphics graphics = Graphics.FromImage(bitMap))
                        {
                            Font oFont = new Font("IDAutomationHC39M", 6);
                            Font oFontCalibri = new Font("Calibri",12);

                            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("Size: " + objProductDetailsBLL.SizeName, oFontCalibri, blackBrush, 0, 44);
                            graphics.DrawString("MRP: " + objProductDetailsBLL.MRP, oFontCalibri, blackBrush, 0, 60);
                            graphics.DrawString("Code: " + objProductDetailsBLL.BarCodeNumber, oFontCalibri, blackBrush, 0, 76);
                            graphics.DrawString("*" + objProductDetailsBLL.BarCodeNumber + "*", oFont, blackBrush, point);
                        }
                        using (MemoryStream ms = new MemoryStream())
                        {
                            //PlaceHolder holder = new PlaceHolder();

                            //Label autoLabel = new Label();
                            //autoLabel.Text = "Name: " + objProductDetailsBLL.Name;
                            //holder.Controls.Add(autoLabel);

                            ////TextBox autoTextBox = new TextBox();
                            ////autoTextBox.Text = "" + id.ToString();
                            ////autoTextBox.ID = "TextBox" + id.ToString();
                            ////holder.Controls.Add(autoTextBox);

                            //holder.Controls.Add(new LiteralControl("&lt;br />"));

                            //imgBarCode.Controls.Add(holder);

                            bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                            byte[] byteImage = ms.ToArray();

                            Convert.ToBase64String(byteImage);
                            imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                        }
                        plBarCode.Controls.Add(imgBarCode);
                    }
                }
            }
        }
 /// <summary>Adds an image control to the container.</summary>
 /// <param name="container">The containing control.</param>
 /// <param name="item">The item containing image informatin.</param>
 /// <param name="detailName">The detail name on the item.</param>
 /// <param name="cssClass">The css class to applky to the image element.</param>
 /// <param name="altText">Alt alternative text to apply to the image element.</param>
 /// <returns>An image control.</returns>
 public static Control AddImage(Control container, ContentItem item, string detailName, string preferredSize, string cssClass, string altText)
 {
     string imageUrl = item[detailName] as string;
     if (!string.IsNullOrEmpty(imageUrl))
     {
         Image image = new Image();
         image.ImageUrl = ImagesUtility.GetExistingImagePath(imageUrl, preferredSize);
         image.AlternateText = item.GetDetail(detailName + "_AlternateText", altText);
         image.CssClass = item.GetDetail(detailName + "_CssClass", cssClass);
         container.Controls.Add(image);
         return image;
     }
     return null;
 }
 /// <summary>Adds an image control to the container.</summary>
 /// <param name="container">The containing control.</param>
 /// <param name="item">The item containing image informatin.</param>
 /// <param name="detailName">The detail name on the item.</param>
 /// <param name="cssClass">The css class to applky to the image element.</param>
 /// <param name="altText">Alt alternative text to apply to the image element.</param>
 /// <returns>An image control.</returns>
 public static Control AddImage(Control container, ContentItem item, string detailName, string cssClass, string altText)
 {
     string imageUrl = item[detailName] as string;
     if (!string.IsNullOrEmpty(imageUrl))
     {
         Image image = new Image();
         image.ImageUrl = N2.Web.Url.ToAbsolute(imageUrl);
         image.Attributes["alt"] = altText;
         image.CssClass = cssClass;
         container.Controls.Add(image);
         return image;
     }
     return null;
 }
        private static Table CreateTooltipTable(Control baseControl, string tooltip)
        {
            Table table = new Table();
            table.Rows.Add(new TableRow());
            table.Rows[0].Cells.Add(new TableCell());
            table.Rows[0].Cells[0].Controls.Add(baseControl);

            //string title = string.Format("Description for the '{0}' item", templateContainer.ViewItem.Caption);
            Image image = new Image() { ImageUrl = "/Images/questionmark.png", ToolTip = tooltip, BorderWidth = 0, CssClass = "tooltip-image" };
            //    image.Style["margin"] = "5px";
            table.Rows[0].Cells.Add(new TableCell());
            table.Rows[0].Cells[1].Controls.Add(image);
            return table;
        }
        /// <summary>
        ///   Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            // Resized Image
            _imageResizerImage = new Image();

            // Label
            _imageResizerLabel = new Literal { Text = string.Empty };

            _propertyAlias = new HiddenField();

            Controls.Add(_imageResizerImage);
            Controls.Add(_imageResizerLabel);
            Controls.Add(_propertyAlias);
        }
 protected override void Render(HtmlTextWriter output)
 {
     double num4 = this.TableWidth.Value;
     double num = Math.Round((double) ((70.0 * num4) / 100.0));
     double num2 = Math.Round((double) ((this.RatingPercent * num) / 100.0));
     double num3 = Math.Round((double) (num - num2));
     Table child = new Table();
     TableRow row = new TableRow();
     TableRow row2 = new TableRow();
     TableCell cell = new TableCell();
     TableCell cell2 = new TableCell();
     TableCell cell3 = new TableCell();
     row2.ControlStyle.CopyFrom(this.ItemStyle);
     cell.ColumnSpan = 2;
     if (this.Rating == 0.0)
     {
         cell.Text = string.Format(ResourceManager.GetString("RatingResults"), this.Rating, this.MaxRating);
     }
     else
     {
         cell.Text = string.Format(ResourceManager.GetString("RatingResults"), this.Rating.ToString("##.##"), this.MaxRating);
     }
     row2.Cells.Add(cell);
     child.Rows.Add(row2);
     cell3.ControlStyle.Font.Size = FontUnit.XXSmall;
     cell3.Text = "&nbsp;" + this.MaxRating.ToString();
     child.CellPadding = 0;
     child.CellSpacing = 3;
     child.BorderWidth = 0;
     child.Width = Unit.Pixel((int) num);
     System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
     image.ImageUrl = GlobalConfig.ImagesPath + "PositiveRatingBar.gif";
     image.Width = Unit.Pixel((int) num2);
     image.Height = 12;
     cell2.Controls.Add(image);
     image = new System.Web.UI.WebControls.Image();
     image.ImageUrl = GlobalConfig.ImagesPath + "NegativeRatingBar.gif";
     image.Width = Unit.Pixel((int) num3);
     image.Height = 12;
     cell2.Controls.Add(image);
     row.ControlStyle.CopyFrom(this.ItemStyle);
     row.Cells.Add(cell2);
     row.Cells.Add(cell3);
     child.Controls.Add(row);
     this.Controls.Add(child);
     child.RenderControl(output);
 }
 private Image ImageResult(ResultState resState)
 {
     Image image = new Image();
     if (resState.Equals(ResultState.Success))
     {
         image.ImageUrl = "~/img/passed.png";
     }
     else if (resState.Equals(ResultState.Ignored))
     {
         image.ImageUrl = "~/img/Ignored.png";
     }
     else
     {
         image.ImageUrl = "~/img/failed.png";
     }
     return image;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            List<DataFile> dataFiles = DataFile.SelectDataFileList();

            foreach (var dataFile in dataFiles)
            {
                Image image = new Image();

                byte[] imgArray = dataFile.Data;
                image.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(imgArray);

                plcDataFiles.Controls.Add(image);

                LiteralControl literalControl = new LiteralControl("<br />");
                plcDataFiles.Controls.Add(literalControl);
            }
        }
Exemple #53
0
 public static void AddSortImage(DataControlFieldHeaderCell obj, SortDirection sortDirection)
 {
     // Create the sorting image based on the sort direction.
     System.Web.UI.WebControls.Image sortImage = new System.Web.UI.WebControls.Image();
     if (SortDirection.Ascending == sortDirection)
     {
         sortImage.ImageUrl = "~/assets/images/ascred.gif";
         sortImage.AlternateText = "Ascending Order";
     }
     else
     {
         sortImage.ImageUrl = "~/assets/images/descred.gif";
         sortImage.AlternateText = "Descending Order";
     }
     // Add the image to the appropriate header cell.
     obj.Controls.Add(sortImage);
 }
Exemple #54
0
        protected override void CreateChildControls()
        {
            Panel upanel = new Panel();

            lblHeader = new Label { Text = HEADER_TEXT };
            _imagen = new Image { ImageUrl = IMAGE_URL };
            _imagen.Height = Unit.Pixel(64);
            _imagen.Width = Unit.Pixel(64);
            upanel.Controls.Add(_imagen);
            LiteralControl l = new LiteralControl("</br>");
            upanel.Controls.Add(l);
            lblHeader.Height = Unit.Pixel(15);
            lblHeader.Width = Unit.Percentage(100);
            upanel.Controls.Add(lblHeader);

            //agrego el panel de los controles
            Controls.Add(upanel);
        }
Exemple #55
0
 public static Control CreateErrorPanel(string errorMessage)
 {
     ASPxRoundPanel panel = new ASPxRoundPanel();
     panel.ShowHeader = false;
     panel.Style["margin-bottom"] = "10px";
     Table table = new Table();
     table.Rows.Add(new TableRow());
     table.Rows[0].Cells.Add(new TableCell());
     table.Rows[0].Cells.Add(new TableCell());
     panel.Controls.Add(table);
     Image errorIcon = new Image();
     errorIcon.ImageUrl = "~/Images/Error.gif";
     errorIcon.AlternateText = "Error";
     //errorIcon.Attributes["style"] = "width:32px;height:32px;";
     table.Rows[0].Cells[0].VerticalAlign = VerticalAlign.Top;
     table.Rows[0].Cells[0].Controls.Add(errorIcon);
     table.Rows[0].Cells[1].Text = errorMessage;
     return panel;
 }
 protected void gvCustomers_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.Header)
     {
         foreach (TableCell tc in e.Row.Cells)
         {
             if (tc.HasControls())
             {
                 LinkButton lnk = (LinkButton)tc.Controls[0];
                 if (lnk != null && gvCustomers.SortExpression == lnk.CommandArgument)
                 {
                     System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                     img.ImageUrl = "~/Images/" + (gvCustomers.SortDirection == SortDirection.Ascending ? "Asc" : "Dsc") + ".png";
                     tc.Controls.Add(new LiteralControl(" "));
                     tc.Controls.Add(img);
                 }
             }
         }
     }
 }
        public void InstantiateIn(Image image) {
            if(image==null) {
                return;
            }

            if(string.IsNullOrEmpty(ImageUrl)) {
                image.Visible = false;
                return;
            }

            image.ImageUrl = ImageUrl;
            image.AlternateText = Description;

            if (Width != null) {
                image.Width = (int)Width;
            }
            if (Height != null) {
                image.Height = (int)Height;
            }
        }
Exemple #58
0
    /// <summary>
    /// Adds a column with images depicting the classes to the gridview parameter.
    /// </summary>
    /// <param name="memberDoc"></param>
    /// <param name="memberTypesDoc"></param>
    /// <param name="GridView2"></param>
    /// <param name="width"></param>
    /// <param name="height"></param>
    public static void getTypeColumn(XmlDocument memberDoc, XmlDocument memberTypesDoc, GridView GridView, int width, int height, int nameCell)
    {
        ImageField column = new ImageField();
        column.HeaderText = "Type";
        GridView.Columns.Add(column);

        for (int i = 0; i < GridView.Rows.Count; i++)
        {
            GridViewRow row = GridView.Rows[i];
            TableCell cell = row.Cells[row.Cells.Count - 1];
            string gangerName = row.Cells[nameCell].Text;
            string gangerType = "";
            string imageLink = "";

            foreach (XmlNode memberNode in memberDoc.LastChild.ChildNodes)
            {
                if (memberNode.Attributes["Name"].Value == gangerName)
                {
                    gangerType = memberNode.Name;
                    break;
                }
            }

            foreach (XmlNode typeNode in memberTypesDoc.LastChild.ChildNodes)
            {
                if (typeNode.Attributes["Name"].Value == gangerType)
                {
                    imageLink = typeNode.Attributes["Image"].Value;
                    break;
                }
            }

            System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
            image.Width = width;
            image.Height = height;
            image.ImageUrl = imageLink;
            image.ToolTip = gangerType;
            image.AlternateText = gangerType;
            cell.Controls.Add(image);
        }
    }
        protected void cal_records_DayRender(object sender, DayRenderEventArgs e)
        {
            DataRow[] rows = appts.Select(
                String.Format(

                   "ApptDate >= #{0}# AND ApptDate < #{1}#",
                   e.Day.Date.ToLongDateString(),
                   e.Day.Date.AddDays(1).ToLongDateString()
                )

             );

            foreach (DataRow row in rows)
            {
                System.Web.UI.WebControls.Image image;
                image = new System.Web.UI.WebControls.Image();
                image.ImageUrl = this.ResolveUrl("Dot.jpg");
                image.ToolTip = row["ApptSummary"].ToString();
                e.Cell.BackColor = Color.LightGreen;
            }
        }
        public void ShowMessage(string msg, MerchantTribe.Commerce.Content.DisplayMessageType msgType)
        {
            this.pnlMain.Visible = true;
            HtmlGenericControl li = new HtmlGenericControl("li");
            li.Attributes.Add("class", "errorline");
            HtmlGenericControl icondiv = new HtmlGenericControl("div");
            li.Controls.Add(icondiv);
            icondiv.Attributes.Add("class", "icon");
            Image img = new Image();
            img.ImageUrl = GetIconType(msgType);
            icondiv.Controls.Add(img);

            HtmlGenericControl divMessage = new HtmlGenericControl("div");
            divMessage.Attributes.Add("class", "message");

            Label MessageLabel = new Label();
            MessageLabel.Text = msg;
            divMessage.Controls.Add(MessageLabel);

            li.Controls.Add(divMessage);
            this.MessageList.Controls.Add(li);
        }