protected void ColorBind()
 {
     for (int i = 0; i < this.GridView1.Rows.Count; i++)
     {
         for (int j = 1; j < 0x22; j++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[j].Text, -1) != 0)
             {
                 int num3 = _Convert.StrToInt(this.GridView1.Rows[i].Cells[j].Text, -1);
                 HtmlImage child = new HtmlImage
                 {
                     Src = "../Images/red_" + num3.ToString() + ".gif"
                 };
                 this.GridView1.Rows[i].Cells[j].Controls.Add(child);
             }
             else
             {
                 this.GridView1.Rows[i].Cells[j].Text = "&nbsp;";
             }
         }
         for (int k = 0x22; k < 0x2b; k++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[k].Text, -1) == 0)
             {
                 this.GridView1.Rows[i].Cells[k].Text = "&nbsp;";
             }
         }
     }
 }
Beispiel #2
0
    protected void gdvFiles_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex > -1)
        {
            System.Data.DataRowView dv = (System.Data.DataRowView)(e.Row.DataItem);

            HtmlGenericControl inboxlink = (HtmlGenericControl)e.Row.Cells[2].FindControl("inboxlink");
            inboxlink.InnerText = dv.Row["AcountName"].ToString();

             HtmlImage img = new HtmlImage();

             if (int.Parse(dv.Row["Delete_Flag"].ToString()) == 2)
             {
                 img.Src = "../../Images/OA/Email/email_delete.gif";
                 img.Alt = "收件人已删除";
             }
             else if (dv.Row["Read_Flag"].ToString() =="True")
             {
                 img.Src = "../../Images/OA/Email/email_open.gif";
                 img.Alt = "收件人已读";
             }
             else if (dv.Row["Read_Flag"].ToString() == "False")
             {
                 img.Src = "../../Images/OA/Email/email_close.gif";
                 img.Alt = "收件人未读";

                 HtmlGenericControl spanSend = (HtmlGenericControl)e.Row.Cells[3].FindControl("spanSend");
                 spanSend.Attributes.Add("onclick", "SendEmailAgain(" + dv.Row["body_ID"].ToString() + ",'" +Server.UrlEncode( dv.Row["AcountName"].ToString() )+ "'," + dv.Row["To_ID"].ToString() + ");");
                 //spanEdit.Visible = true;
                 //spanEdit.Attributes.Add("onclick", "Edit('" + dv.Row["body_ID"].ToString() + "');");
             }

             e.Row.Cells[1].Controls.Add(img);
        }
    }
 protected void ColorBind()
 {
     for (int i = 0; i < this.GridView1.Rows.Count; i++)
     {
         for (int j = 1; j < 0x22; j++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[j].Text, -1) == 0)
             {
                 HtmlImage child = new HtmlImage
                 {
                     Src = "../Images/red_" + j.ToString() + ".gif"
                 };
                 this.GridView1.Rows[i].Cells[j].Controls.Add(child);
             }
         }
         if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[0x22].Text, -1) < 10)
         {
             int num3 = _Convert.StrToInt(this.GridView1.Rows[i].Cells[0x22].Text, 0);
             HtmlImage image2 = new HtmlImage
             {
                 Src = "../Images/blue_" + num3.ToString() + ".gif"
             };
             this.GridView1.Rows[i].Cells[0x22].Controls.Add(image2);
         }
     }
 }
Beispiel #4
0
 public void LoadAnhPhu()
 {
     try
     {
         // Load Anh Phu
         Anh anhphu = new Anh();
         DataSet dsAnh = anhphu.SelectBySanPhamID(int.Parse(ViewState["ID"].ToString()));
         if (dsAnh.Tables[0].Rows.Count > 0)
         {
             foreach (DataRow drAnh in dsAnh.Tables[0].Rows)
             {
                 HtmlImage img = new HtmlImage();
                 img.Src = "." + drAnh["DuongDan"];
                 img.Height = 50;
                 img.Width = 50;
                 img.ID = "img" + drAnh["AnhID"];
                 img.Attributes.Add("onclick",
                                    "return XoaAnhPhu('" + drAnh["AnhID"] + "', '" + img.Src + "', this.ID, this);");
                 pnlAnhPhu.Controls.Add(img);
             }
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.ToString());
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            if (fileUpload1.PostedFiles.Count > 0)
            {
                // form the result HTML
                HtmlGenericControl span = new HtmlGenericControl("span");
                result.Controls.Add(span);
                span.Style[HtmlTextWriterStyle.FontWeight] = "bold";
                span.Controls.Add(new LiteralControl(FirstName.Text + " " + LastName.Text));
                result.Controls.Add(new LiteralControl(":<br /><br />"));
                HtmlImage imageElement = new HtmlImage();
                string url = Page.Request.Path;
                url += ((url.IndexOf("?") > 0) ? "&" : "?") + "getimage=true&rnd="+(new Random().Next().ToString());
                imageElement.Src = url;
                // set image's size
                System.Drawing.Bitmap image = new System.Drawing.Bitmap(fileUpload1.PostedFiles[0].InputStream);
                int maxHeight = int.Parse(imageheight.Value) - 35; // max height of the image
                int mWidth = image.Width;
                int mHeight = image.Height;

                if (mHeight > maxHeight)
                {
                    mWidth = (int)((double)mWidth * ((double)maxHeight / (double)mHeight));
                    mHeight = maxHeight;
                }
                if (mHeight == 0) mHeight = 5;
                if (mWidth == 0) mWidth = 5;

                imageElement.Height = mHeight;
                imageElement.Width = mWidth;
                result.Controls.Add(imageElement);

                // save uploaded image to the Session variable
                byte[] imageBytes = new byte[fileUpload1.PostedFiles[0].ContentLength];
                fileUpload1.PostedFiles[0].InputStream.Seek(0L, System.IO.SeekOrigin.Begin);
                fileUpload1.PostedFiles[0].InputStream.Read(imageBytes, 0, fileUpload1.PostedFiles[0].ContentLength);
                Session["image"] = imageBytes;
            }
            else
            {
                result.Controls.Clear();
            }
        }
        else
        {
            // if used as Image's SRC
            if(!String.IsNullOrEmpty(Page.Request.QueryString["getimage"]))
            {
                if (Session["image"] != null)
                {
                    Page.Response.ContentType = "image/gif";
                    Page.Response.BinaryWrite((byte[])Session["image"]);
                    Page.Response.End();
                }
            }
        }
    }
Beispiel #6
0
    private static HtmlGenericControl CreateRowHeader(Guid id, string name, int count)
    {
        HtmlAnchor feed = new HtmlAnchor();
        feed.HRef = Utils.RelativeWebRoot + "category/syndication.axd?category=" + id.ToString();

        HtmlImage img = new HtmlImage();
        img.Src = Utils.RelativeWebRoot + "pics/rssbutton.gif";
        img.Alt = "RSS";

        feed.Controls.Add(img);

        HtmlGenericControl h2 = new HtmlGenericControl("h2");
        h2.Attributes["id"] = Utils.RemoveIllegalCharacters(name);
        h2.Controls.Add(feed);

        Control header = new LiteralControl(name + " (" + count + ")");
        h2.Controls.Add(header);
        return h2;
    }
Beispiel #7
0
    private static HtmlGenericControl CreateRowHeader(Category cat, string name, int count)
    {
        HtmlGenericControl h2 = new HtmlGenericControl("h2");
        h2.Attributes["id"] = "cat-" + Utils.RemoveIllegalCharacters(name);

        if (cat != null)
        {
            HtmlAnchor feed = new HtmlAnchor();
            feed.HRef = cat.FeedRelativeLink;

            HtmlImage img = new HtmlImage();
            img.Src = Utils.RelativeWebRoot + "pics/rssButton.png";
            img.Alt = "RSS";
            feed.Controls.Add(img);
            h2.Controls.Add(feed);
        }

        Control header = new LiteralControl(name + " (" + count + ")");
        h2.Controls.Add(header);
        return h2;
    }
Beispiel #8
0
        public HelloWorld()
        {
            Button b = new Button ();
            b.Text = "Click Me!";
            b.Location = new Point(200, 10);
            b.Size = new Size(100, 30);
            b.Click += (s,e) =>
            {
                var image = new HtmlImage("<html><body><h1 style='color:red;'>Hello World!</h1></body></html>", 400, 400);
                _imgBox.Image = image.Image;
            };

            Controls.Add (b);

            _imgBox = new PictureBox();
            _imgBox.Location = new Point(50,50);
            _imgBox.Size = new Size(400,400);
            _imgBox.BorderStyle = BorderStyle.FixedSingle;
            Controls.Add(_imgBox);

            Width=500;
            Height=500;
        }
 public void generateNews()
 {
     System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
     System.Web.UI.HtmlControls.HtmlGenericControl div1 = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
     System.Web.UI.HtmlControls.HtmlGenericControl a = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
     div.TagName = "div";
        // a.InnerHtml = "PAsha";
     a.TagName = "a";
     a.Attributes["class"] = "hero";
     div.Controls.Add(a);
     div.Attributes["class"] = "pl pl-floathero";
     div.Attributes["id"] = "someid";
     HtmlImage img = new HtmlImage();
     img.Attributes["id"] = "image1";
     img.Attributes["class"] = "lazy";
     img.Attributes["src"] = "images/7.jpg";
     a.Controls.Add(img);
     div1.TagName = "div";
     div1.Attributes["class"] = "block";
     div1.Attributes["id"] = "someid1";
     div.Controls.Add(div1);
     this.Controls.Add(div);
 }
Beispiel #10
0
        void grdOrders_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                CheckBox           chk             = e.Item.FindControl("chkOrderID") as CheckBox;
                HtmlGenericControl spnPalletSpaces = (HtmlGenericControl)e.Item.FindControl("spnPalletSpaces");
                HtmlImage          imgOrderCollectionDeliveryNotes = (HtmlImage)e.Item.FindControl("imgOrderCollectionDeliveryNotes");

                List <int> orders = new List <int>();
                if (Session[C_GRID_NAME] != null)
                {
                    orders = (List <int>)Session[C_GRID_NAME];
                }

                DataRowView drv = (DataRowView)e.Item.DataItem;
                if ((bool)drv["PlannedForCollection"])
                {
                    e.Item.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFDFBF");
                }

                if (orders.Count > 0)
                {
                    if (orders.Contains((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["OrderID"]))
                    {
                        if (chk != null)
                        {
                            chk.Checked     = true;
                            e.Item.Selected = true;
                            NoPallets      += (int)drv["NoPallets"];
                        }
                    }
                }

                if (chk != null)
                {
                    chk.Attributes.Add("onclick",
                                       string.Format("javascript:ChangeList(event, this, {0}, {1}, {2}, {3});",
                                                     drv["OrderID"], drv["NoPallets"], drv["OrderGroupID"],
                                                     drv["OrderGroupGroupedPlanning"].ToString().ToLower()));
                }

                if (spnPalletSpaces != null)
                {
                    switch (spnPalletSpaces.InnerText)
                    {
                    case "0.25":
                        spnPalletSpaces.InnerText = "¼";
                        break;

                    case "0.5":
                        spnPalletSpaces.InnerText = "½";
                        break;

                    default:
                        break;
                    }
                }

                if (imgOrderCollectionDeliveryNotes != null)
                {
                    // if it is the orders 1st collection or orders delivery destination - show the collection / delivery note.
                    if (!string.IsNullOrEmpty(drv["CollectionNotes"].ToString()))
                    {
                        imgOrderCollectionDeliveryNotes.Attributes.Add("onmouseover", "javascript:ShowOrderCollectionDeliveryNotes(this," + drv["OrderID"].ToString() + ",'" + bool.TrueString + "');");
                        imgOrderCollectionDeliveryNotes.Attributes.Add("onmouseout", "javascript:closeToolTip();");
                        imgOrderCollectionDeliveryNotes.Attributes.Add("class", "orchestratorLink");
                    }
                    else
                    {
                        imgOrderCollectionDeliveryNotes.Visible = false;
                    }
                }
            }
            else if (e.Item is GridGroupHeaderItem)
            {
                GridGroupHeaderItem item         = (GridGroupHeaderItem)e.Item;
                DataRowView         groupDataRow = (DataRowView)e.Item.DataItem;
                item.DataCell.Text = string.Format("{0} ({1})", groupDataRow["TrafficAreaShortName"], groupDataRow["Count"]);
            }
        }
Beispiel #11
0
                /// <summary>
                /// Create the header and content panels and place the existing child controls in the content panel.
                /// </summary>
                private Panel CreateContainerControls()
                {
                    Panel header = new Panel();
                    header.ID = "Header";
                    header.CssClass = this.HeaderCss;

                    Panel title = new Panel();

                    //Add title text to title panel.
                    LiteralControl titleText = new LiteralControl(this.Title);
                    title.Controls.Add(titleText);

                    //Place title on left of header panel.
                    title.Style.Add("float", "left");

                    //Only create a close image panel if a close image and cancel control id have been specified.
                    HtmlImage imageButton = null;
                    if (CloseImageUrl != "" && CancelControlID != "")
                    {
                        Panel closeImage = new Panel();

                        //Add image to image panel.
                        imageButton = new HtmlImage();
                        imageButton.ID = "button";
                        imageButton.Border = 0;
                        imageButton.Src = GetCloseImageUrl();
                        imageButton.Style.Add("cursor", "pointer");
                        closeImage.Controls.Add(imageButton);

                        //Place image on right of header panel.
                        closeImage.Style.Add("float", "right");
                        header.Controls.Add(closeImage);
                    }

                    header.Controls.Add(title);

                    Panel content = new Panel();
                    content.CssClass = this.ContentCss;

                    //Move all the children of the base panel to the children of the content panel.
                    //Note as a child control is added to content, it is automatically removed from the base panel.
                    int numChildren = this.Controls.Count;
                    int i = 0;
                    while (i < numChildren)
                    {
                        content.Controls.Add(this.Controls[0]);
                        i++;
                    }

                    //Clear all the children of the base panel and add the header and content panels.
                    Controls.Clear();
                    Controls.Add(header);
                    Controls.Add(content);

                    //Now that all controls are in their proper places, create the cancel javascript for the CancelControlId.
                    if (CloseImageUrl != "" && CancelControlID != "")
                    {
                        imageButton.Attributes.Add("onClick", GetCloseScript());
                    }

                    //Make sure this panel is hidden to begin.
                    this.Style.Add("display", "none");

                    return header;
                }
        private void DoMagicKategorija()
        {
            DataTable dt = new DataTable();

            SqlConnection con = new SqlConnection(conString);

            string     jeilinije = "je";
            SqlCommand com       = new SqlCommand("SELECT [idProizvod], [Naziv], [Opis], [Cijena], [NazFile], [Tezina], [Countity] FROM [Proizvodi] WHERE [Najprodavaniji] LIKE @je", con);

            com.Parameters.AddWithValue("@je", jeilinije);

            con.Open();

            SqlDataAdapter adptr = new SqlDataAdapter(com);

            ViewState["currentCategory"] = dt;

            adptr.Fill(dt);

            con.Close();

            HtmlGenericControl mainDiv = new HtmlGenericControl();

            mainDiv.Attributes["class"] = "row";
            mainDiv.Style.Add("margin-left", "1%");
            mainDiv.Style.Add("margin-right", "1%");
            mainDiv.TagName = "div";

            HtmlGenericControl commerce = new HtmlGenericControl("div");

            commerce.Attributes["class"] = "commerce";

            HtmlGenericControl naAkciji = new HtmlGenericControl("div");

            naAkciji.Attributes["class"] = "col-lg-12";

            HtmlGenericControl paraNaAkc = new HtmlGenericControl("p");

            paraNaAkc.Attributes["class"] = "cart-empty";
            paraNaAkc.InnerText           = "IZ PONUDE";
            paraNaAkc.Style.Add("color", "#764069");

            naAkciji.Controls.Add(paraNaAkc);
            commerce.Controls.Add(naAkciji);
            mainDiv.Controls.Add(commerce);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                HtmlGenericControl itemDiv = new HtmlGenericControl();
                itemDiv.Attributes["class"] = "col-lg-3 col-md-4 col-sm-6";
                itemDiv.TagName             = "div";

                HtmlAnchor itemAnchor = new HtmlAnchor();
                itemAnchor.ID = "anchorAkcija_" + dt.Rows[i].ItemArray[0];
                itemAnchor.Attributes["class"] = "thumbnail";
                itemAnchor.Style.Add("background", "#F2F2F2");
                itemAnchor.Style.Add("border-color", "#F2F2F2");
                itemAnchor.Style.Add("color", "#5E3354");
                itemAnchor.CausesValidation = false;
                itemAnchor.ServerClick     += ItemAnchor_ServerClick;


                HtmlImage itemImage = new HtmlImage();
                itemImage.Src = "Images/" + dt.Rows[i].ItemArray[4];

                HtmlContainerControl para = new HtmlGenericControl("h4");
                para.InnerText = dt.Rows[i].ItemArray[1].ToString().ToUpper();

                HtmlGenericControl Div = new HtmlGenericControl();
                Div.TagName = "div";

                HtmlGenericControl commerce11 = new HtmlGenericControl("div");
                commerce11.Attributes["class"] = "commerce";

                HtmlGenericControl paraNew = new HtmlGenericControl("p");
                paraNew.Attributes["class"] = "return-to-shop";

                HtmlButton btnTbody = new HtmlButton();
                btnTbody.ID = "category_" + i;
                btnTbody.Attributes["class"] = "button glyphicon glyphicon-shopping-cart";
                btnTbody.Attributes.Add("runat", "server");
                btnTbody.Style.Add("color", "#F1C13C");
                btnTbody.Style.Add("border-color", "#F1C13C");
                btnTbody.CausesValidation = false;
                btnTbody.ServerClick     += AddToCart_ServerClick;

                paraNew.Controls.Add(btnTbody);
                commerce11.Controls.Add(paraNew);
                commerce11.Style.Add("float", "left");

                HtmlContainerControl para1 = new HtmlGenericControl("h4");
                para1.Style.Add("float", "right");
                para1.InnerText = dt.Rows[i].ItemArray[3] + " kn";

                Div.Controls.Add(commerce11);
                Div.Controls.Add(para1);

                itemAnchor.Controls.Add(Div);
                itemAnchor.Controls.Add(itemImage);
                itemAnchor.Controls.Add(para);
                itemDiv.Controls.Add(itemAnchor);
                mainDiv.Controls.Add(itemDiv);
            }

            Panel2.Controls.Add(mainDiv);
        }
Beispiel #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String uname1 = Session["uname"].ToString();
        int    c      = 0;

        Panel1.Controls.Add(new LiteralControl("<table style=width:90%> "));
        Panel1.Controls.Add(new LiteralControl("<tr>"));
        Class1 obj = new Class1();

        obj.getconnection();
        SqlCommand cmd2 = new SqlCommand("sp_dealerreg", obj.con);
        SqlCommand cmd1 = new SqlCommand("sp_prduct", obj.con);

        cmd1.CommandType = CommandType.StoredProcedure;
        cmd2.CommandType = CommandType.StoredProcedure;
        cmd1.Parameters.Add("@flag", 2);
        cmd2.Parameters.Add("@flag", 4);
        cmd2.Parameters.Add("@name", uname1);
        DataTable      dt1   = new DataTable();
        DataTable      dt    = new DataTable();
        SqlDataAdapter dtadt = new SqlDataAdapter(cmd2);

        dtadt.Fill(dt);
        int a = Convert.ToInt16(dt.Rows[0][0]);

        cmd1.Parameters.Add("@d_id", a);
        SqlDataAdapter dtadt1 = new SqlDataAdapter(cmd1);

        dtadt1.Fill(dt1);
        for (int i = 0; i < dt1.Rows.Count; i++)
        {
            if (c < 5)
            {
                c++;
            }

            else
            {
                Panel1.Controls.Add(new LiteralControl("</td></tr>"));
                Panel1.Controls.Add(new LiteralControl("<tr>"));
                c = 0;
            }
            HtmlImage img = new HtmlImage();
            img.Attributes.Add("class", "");
            img.Style.Add(HtmlTextWriterStyle.Display, "block");
            img.Style.Add(HtmlTextWriterStyle.Height, "150px");
            img.Style.Add(HtmlTextWriterStyle.Width, "200px");
            img.Src = dt1.Rows[i][6].ToString();
            Panel1.Controls.Add(new LiteralControl("<td><table runat=server>"));
            Panel1.Controls.Add(new LiteralControl("<tr><td>"));
            Panel1.Controls.Add(new LiteralControl("<a href=view.aspx?id=" + dt1.Rows[i][0].ToString() + ">"));
            Panel1.Controls.Add(img);
            Panel1.Controls.Add(new LiteralControl("</a>"));
            Panel1.Controls.Add(new LiteralControl("</td></tr>"));
            Panel1.Controls.Add(new LiteralControl("<tr><td align='center'>" + dt1.Rows[i][1].ToString()));
            Panel1.Controls.Add(new LiteralControl("</td></tr>"));
            Panel1.Controls.Add(new LiteralControl("</table>"));
            Panel1.Controls.Add(new LiteralControl("</td>"));
        }
        Panel1.Controls.Add(new LiteralControl("</tr>"));
        Panel1.Controls.Add(new LiteralControl("</table>"));
    }
        /// <summary>
        /// Get the Followers from Twitter
        /// </summary>
        /// <returns></returns>
        private Table GetFollowers(TwitterResponse <TwitterUserCollection> twitterUsers, TwitterResponse <TwitterStatusCollection> twitterStatus)
        {
            Table     insideTable;
            TableRow  tr;
            TableCell tc;

            insideTable             = new Table();
            insideTable.CellPadding = 0;
            insideTable.CellSpacing = 0;
            insideTable.Width       = Unit.Percentage(100);

            int r = 1;

            tr = new TableRow();
            if (twitterUsers.ResponseObject.Count > 0)
            {
                //Get the total number of followers
                int followersCount = Convert.ToInt32(twitterUsers.ResponseObject.Count);
                int c = 0;

                foreach (TwitterUser followerUsers in twitterUsers.ResponseObject)
                {
                    # region Create a new row if User column count limit exceeds
                    if (this.UsersColumnCount == c)
                    {
                        if (r < this.UsersRowCount)
                        {
                            tr = new TableRow();
                            r++;
                            c = 0;
                        }
                        else
                        {
                            break;
                        }
                    }
                    #endregion

                    //Create a new cell
                    tc = new TableCell();
                    tc.Attributes.Add("valign", "top");

                    //create a new table in a cell
                    Table tb = new Table();
                    tb.Width = Unit.Percentage(100);

                    #region Show Follower Image
                    HtmlImage imgFollower = new HtmlImage();
                    imgFollower.Src    = followerUsers.ProfileImageLocation.ToString();
                    imgFollower.Border = 0;

                    //Show Follower Image
                    TableRow  tr1 = new TableRow();
                    TableCell tc1 = new TableCell();
                    tc1.CssClass = "alignCenter";

                    if (this.ShowImageAsLink)
                    {
                        HyperLink lnkFollower = new HyperLink();
                        lnkFollower.NavigateUrl = "http://twitter.com/" + followerUsers.ScreenName;
                        lnkFollower.Attributes.Add("target", "_blank");
                        lnkFollower.Controls.Add(imgFollower);
                        lnkFollower.ToolTip = followerUsers.Name;
                        tc1.Controls.Add(lnkFollower);
                        tc1.VerticalAlign = VerticalAlign.Top;
                        tc1.Width         = Unit.Percentage(100 / this.UsersColumnCount);
                    }
                    else
                    {
                        tc1.Controls.Add(imgFollower);
                        tc.ToolTip = followerUsers.Name;
                    }
                    #endregion

                    tr1.Controls.Add(tc1);
                    tb.Rows.Add(tr1);

                    #region Show Follower Name
                    //Show Follower Name
                    if (this.ShowFollowerScreenName)
                    {
                        Label lblFollower = new Label();

                        //If the user has entered only first name
                        if (followerUsers.Name.IndexOf(" ") != -1)
                        {
                            lblFollower.Text = followerUsers.Name.Substring(0, followerUsers.Name.IndexOf(" "));      //Get the first name only to display
                        }
                        else
                        {
                            lblFollower.Text = followerUsers.Name;
                        }

                        lblFollower.Font.Size = FontUnit.XXSmall;
                        TableRow  tr2 = new TableRow();
                        TableCell tc2 = new TableCell();
                        tc2.CssClass      = "alignCenter";
                        tc2.VerticalAlign = VerticalAlign.Top;
                        tc2.Width         = Unit.Percentage(100 / this.UsersColumnCount);
                        tc2.Controls.Add(lblFollower);
                        tr2.Controls.Add(tc2);
                        tb.Rows.Add(tr2);
                    }
                    #endregion

                    tc.Controls.Add(tb);
                    tr.Cells.Add(tc);
                    insideTable.Rows.Add(tr);
                    c++;
                }
            }
Beispiel #15
0
    protected void ColorBind()
    {
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            if (GridView1.Rows[i].Cells[1].Text.Length == 5)
            {
                Label lb = new Label();
                lb.Text = GridView1.Rows[i].Cells[1].Text.Substring(0, 2) + "<font color='red'>" + GridView1.Rows[i].Cells[1].Text.Substring(2, 3) + "</font>";

                GridView1.Rows[i].Cells[1].Controls.Add(lb);
            }

            for (int j = 2; j < 12; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();
                    int k = j - 2;

                    img.Src = "../Images/blue_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            for (int j = 12; j < 22; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();
                    int k = j - 12;

                    img.Src = "../Images/orange_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            for (int j = 22; j < 32; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();
                    int k = j - 22;

                    img.Src = "../Images/red_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

        }
    }
Beispiel #16
0
        public static void BuildingMenu(ref HtmlGenericControl myDIV, string category, string userID, string appraisalYear, string appraisalSession, string appraisalPhase, string employeeID, string schoolCode, string role)
        {
            myDIV.InnerHtml = "";
            string Evaluation   = WebConfig.getValuebyKey("EvaluationYear"); // "NE0,NE1,NE2,NE3,NE4";
            int    aYear        = System.Int32.Parse(appraisalYear);
            int    openYear     = System.Int32.Parse(WorkingProfile.OpenSchoolYear);
            string passApprYear = "No";

            if (aYear < openYear)
            {
                passApprYear = "Yes";
            }

            DataSet myDS1      = AppraisalProcess.AppraisalMenuItem("0", userID, appraisalYear, schoolCode, employeeID, appraisalSession, category);
            string  menuEnable = "Yes";

            foreach (DataRow row1 in myDS1.Tables[0].Rows)
            {
                string             areaCode    = row1["Appraisal_Area"].ToString();
                string             areaText    = row1["Appraisal_Text"].ToString();
                HtmlGenericControl myAreaTitle = new HtmlGenericControl("div");
                myAreaTitle.ID = "MenuTitle" + areaCode;


                string rate = "";
                switch (areaText)
                {
                case "Improvement Plan":
                    rate = AppraisalDataAC.AppraisalRate(userID, appraisalYear, schoolCode, employeeID, appraisalSession, category, "SUM", "SUM61");
                    if (rate == "Unsatisfactory")
                    {
                        menuEnable = "Yes";
                    }
                    else
                    {
                        menuEnable = "No";
                    }
                    break;

                case "Enrichment Plan":
                    rate = AppraisalDataAC.AppraisalRate(userID, appraisalYear, schoolCode, employeeID, appraisalSession, category, "SUM", "SUM61");
                    if (rate == "Development Needed")
                    {
                        menuEnable = "Yes";
                    }
                    else
                    {
                        menuEnable = "No";
                    }
                    break;

                case "Evidence Log":
                case "Classroom Observation":
                case "Summative Report":
                case "Performance Plan":
                case "Professional Dialog and Meeting":
                    if (Evaluation.IndexOf(appraisalPhase) == -1)
                    {
                        menuEnable = "No";
                    }
                    break;

                default:
                    menuEnable = "Yes";
                    break;
                }
                string areaLink = "<a href='Loading2.aspx?pID=Summary&aID=" + areaCode + "' target='GoPageiFrame' >" + areaText + "</a>";
                if (menuEnable == "No")
                {
                    myAreaTitle.Disabled = true;
                    myAreaTitle.Attributes.Add("class", "categoryDisable");
                    areaLink = areaText;
                }
                else
                {
                    myAreaTitle.Attributes.Add("class", "category");
                }

                myAreaTitle.InnerHtml = areaLink; // .InnerText = areaText;


                //  myDIV.Controls.Add(alink0);
                myDIV.Controls.Add(myAreaTitle);

                HtmlGenericControl myArea = new HtmlGenericControl("div");
                myArea.ID = "Menu" + areaCode;

                DataSet myDS2 = AppraisalProcess.AppraisalMenuItem("2", userID, appraisalYear, schoolCode, employeeID, appraisalSession, category, areaCode, appraisalPhase);

                HtmlGenericControl myUL = new HtmlGenericControl("ul");
                myUL.Attributes.Add("class", "leafMenu" + areaCode);


                foreach (DataRow row2 in myDS2.Tables[0].Rows)
                {
                    string             pCode       = row2["Appraisal_Code"].ToString();
                    string             aText       = row2["Appraisal_Text"].ToString();
                    string             aImag       = row2["Appraisal_img"].ToString();
                    string             level       = row2["TreeLevel"].ToString();
                    string             contentPage = row2["Content_Page"].ToString();
                    HtmlGenericControl li          = new HtmlGenericControl("li");
                    HtmlImage          aimg        = new HtmlImage();
                    aimg.Src = aImag;

                    HtmlAnchor alink = new HtmlAnchor();
                    alink.HRef      = "Loading2.aspx?pID=" + pCode + "&aID=" + pCode;
                    alink.Target    = "GoPageiFrame";
                    alink.InnerHtml = aText;
                    li.ID           = "li_" + pCode;
                    li.Controls.Add(aimg);
                    li.Controls.Add(alink);

                    if (passApprYear == "Yes")
                    {
                        if (contentPage != "PDFPage")
                        {
                            alink.HRef     = "";
                            alink.Disabled = true;
                            alink.Attributes.Add("class", "itemDisable");
                        }
                    }


                    DataSet myDS3 = AppraisalProcess.AppraisalMenuItem(pCode, userID, appraisalYear, schoolCode, employeeID, appraisalSession, category, areaCode, appraisalPhase);
                    if (myDS3.Tables[0].Rows.Count > 0)
                    {
                        HtmlGenericControl myUL2 = new HtmlGenericControl("ul");
                        myUL2.Attributes.Add("class", "Menulevel2");
                        foreach (DataRow row3 in myDS3.Tables[0].Rows)
                        {
                            pCode = row3["Appraisal_Code"].ToString();
                            aText = row3["Appraisal_Text"].ToString();
                            aImag = row3["Appraisal_img"].ToString();
                            level = row3["TreeLevel"].ToString();
                            HtmlGenericControl li2   = new HtmlGenericControl("li");
                            HtmlImage          aimg2 = new HtmlImage();

                            aimg2.Src = aImag;

                            HtmlAnchor alink2 = new HtmlAnchor();
                            alink2.HRef      = "Loading2.aspx?pID=" + pCode + "&aID=" + pCode;
                            alink2.Target    = "GoPageiFrame";
                            alink2.InnerHtml = aText;
                            li2.ID           = "li_" + pCode;
                            li2.Controls.Add(aimg2);
                            li2.Controls.Add(alink2);
                            myUL2.Controls.Add(li2);

                            if (passApprYear == "Yes")
                            {
                                if (contentPage != "PDFPage")
                                {
                                    alink2.HRef     = "";
                                    alink2.Disabled = true;
                                    alink2.Attributes.Add("class", "itemDisable");
                                }
                            }
                        }
                        li.Controls.Add(myUL2);
                    }
                    myUL.Controls.Add(li);
                    myArea.Controls.Add(myUL);
                }
                myDIV.Controls.Add(myArea);
            }
            // ************* for test postback purpose ************************
            //Button myButton = new Button();
            //myButton.ID = "btnPostBack";
            //myButton.Text = "Postback iFrame ";
            //myDIV.Controls.Add(myButton);
            // ****************************************************************
        }
        public UITestControl SurfaceParameterControl(string SurfaceParameterControl)
        {
            WinClient Client = new WinClient(GetMainWindow());
            Client.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server";
            Client.SearchProperties[WinControl.PropertyNames.Instance] = "3";
            Client.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument Documento = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(Client);
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = "awb_surfaceparams.htm";
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False";
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False";
            Documento.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = null;
            Documento.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            UITestControl ReturnThis= new UITestControl();

            switch (SurfaceParameterControl)
            {
                case "RecalculateCBT":
                    {
                        HtmlButton Button = new HtmlButton(Documento);
                        Button.SearchProperties[HtmlButton.PropertyNames.Id] = "btnRecalcCBT";
                        Button.SearchProperties[HtmlButton.PropertyNames.Name] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.Type] = "button";
                        Button.FilterProperties[HtmlButton.PropertyNames.Title] = "Recalculate CBT";
                        Button.FilterProperties[HtmlButton.PropertyNames.Class] = null;
                        Button.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "style=\"WIDTH: 30px; HEIGHT: 30px\" id=btn";
                        Button.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "5";
                        Button.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

                        HtmlImage CBTImageBut = new HtmlImage(Button);
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Id] = null;
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Name] = null;
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Alt] = null;
                        CBTImageBut.FilterProperties[HtmlImage.PropertyNames.Class] = null;
                        CBTImageBut.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1";
                        CBTImageBut.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = CBTImageBut;
                        break;
                    }
                case "SaveChanges":
                    {
                        HtmlButton Button = new HtmlButton(Documento);
                        Button.SearchProperties[HtmlButton.PropertyNames.Id] = "btnSave";
                        Button.SearchProperties[HtmlButton.PropertyNames.Name] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.Type] = "button";
                        Button.FilterProperties[HtmlButton.PropertyNames.Title] = "Save changes";
                        Button.FilterProperties[HtmlButton.PropertyNames.Class] = null;
                        Button.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "style=\"WIDTH: 30px; HEIGHT: 30px\" id=btn";
                        Button.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "11";
                        Button.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

                        HtmlImage SaveImageBut = new HtmlImage(Button);
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Id] = null;
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Name] = null;
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Alt] = null;
                        SaveImageBut.FilterProperties[HtmlImage.PropertyNames.Class] = null;
                        SaveImageBut.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1";
                        SaveImageBut.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = SaveImageBut;
                        break;
                    }
                case "CBTTxt":
                    {
                        HtmlEdit CBTBox = new HtmlEdit(Documento);
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Id] = "eCCBTRQ";
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Name] = null;
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.LabeledBy] = null;
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Type] = "SINGLELINE";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.Title] = null;
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.Class] = "clsFloatEdit";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "id=eCCBTRQ dataSrc=#eXml class=clsFloatE";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "6";
                        CBTBox.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = CBTBox;
                        break;
                    }
            }
            return ReturnThis;
        }
Beispiel #18
0
        /// <summary>
        /// Applies the block settings.
        /// </summary>
        private void ApplyBlockSettings()
        {
            tbUserName.Label      = GetAttributeValue(AttributeKey.UsernameFieldLabel);
            btnNewAccount.Visible = !GetAttributeValue(AttributeKey.HideNewAccount).AsBoolean();
            btnNewAccount.Text    = this.GetAttributeValue(AttributeKey.NewAccountButtonText) ?? "Register";

            phExternalLogins.Controls.Clear();

            List <AuthenticationComponent> activeAuthProviders = new List <AuthenticationComponent>();

            var selectedGuids = new List <Guid>();

            GetAttributeValue(AttributeKey.RemoteAuthorizationTypes).SplitDelimitedValues()
            .ToList()
            .ForEach(v => selectedGuids.Add(v.AsGuid()));

            lRemoteAuthLoginsHeadingText.Text = this.GetAttributeValue(AttributeKey.RemoteAuthorizationPromptMessage);

            // Look for active external authentication providers
            foreach (var serviceEntry in AuthenticationContainer.Instance.Components)
            {
                var component = serviceEntry.Value.Value;

                if (component.IsActive &&
                    component.RequiresRemoteAuthentication &&
                    selectedGuids.Contains(component.EntityType.Guid))
                {
                    string loginTypeName = component.GetType().Name;

                    // Check if returning from third-party authentication
                    if (!IsPostBack && component.IsReturningFromAuthentication(Request))
                    {
                        string userName           = string.Empty;
                        string returnUrl          = string.Empty;
                        string redirectUrlSetting = LinkedPageUrl(AttributeKey.RedirectPage);
                        if (component.Authenticate(Request, out userName, out returnUrl))
                        {
                            if (!string.IsNullOrWhiteSpace(redirectUrlSetting))
                            {
                                CheckUser(userName, redirectUrlSetting, true);
                                break;
                            }
                            else
                            {
                                CheckUser(userName, returnUrl, true);
                                break;
                            }
                        }
                    }

                    activeAuthProviders.Add(component);

                    LinkButton lbLogin = new LinkButton();
                    phExternalLogins.Controls.Add(lbLogin);
                    lbLogin.AddCssClass("btn btn-authentication " + component.LoginButtonCssClass);
                    lbLogin.ID               = "lb" + loginTypeName + "Login";
                    lbLogin.Click           += lbLogin_Click;
                    lbLogin.CausesValidation = false;

                    if (!string.IsNullOrWhiteSpace(component.ImageUrl()))
                    {
                        HtmlImage img = new HtmlImage();
                        lbLogin.Controls.Add(img);
                        img.Attributes.Add("style", "border:none");
                        img.Src = Page.ResolveUrl(component.ImageUrl());
                    }

                    lbLogin.Text = component.LoginButtonText;
                }
            }

            // adjust the page layout based on the RemoteAuth and InternalLogin options
            pnlRemoteAuthLogins.Visible = activeAuthProviders.Any();
            bool showInternalLogin = this.GetAttributeValue(AttributeKey.ShowInternalLogin).AsBooleanOrNull() ?? true;

            pnlInternalAuthLogin.Visible = showInternalLogin;

            if (activeAuthProviders.Count() == 1 && !showInternalLogin)
            {
                var  singleAuthProvider = activeAuthProviders[0];
                bool redirecttoSingleExternalAuthProvider = this.GetAttributeValue(AttributeKey.RedirecttoSingleExternalAuthProvider).AsBoolean();

                if (redirecttoSingleExternalAuthProvider)
                {
                    Uri remoteAuthLoginUri = singleAuthProvider.GenerateLoginUrl(this.Request);
                    if (remoteAuthLoginUri != null)
                    {
                        if (IsUserAuthorized(Rock.Security.Authorization.ADMINISTRATE))
                        {
                            nbAdminRedirectPrompt.Text    = string.Format("If you did not have Administrate permissions on this block, you would have been redirected to the <a href='{0}'>{1}</a> url.", remoteAuthLoginUri.AbsoluteUri, singleAuthProvider.LoginButtonText);
                            nbAdminRedirectPrompt.Visible = true;
                        }
                        else
                        {
                            Response.Redirect(remoteAuthLoginUri.AbsoluteUri, false);
                            Context.ApplicationInstance.CompleteRequest();
                            return;
                        }
                    }
                }
            }

            if (pnlInternalAuthLogin.Visible && pnlRemoteAuthLogins.Visible)
            {
                // if they are both visible, show in 2 equal columns
                pnlRemoteAuthLogins.CssClass  = "col-sm-6 margin-b-lg";
                pnlInternalAuthLogin.CssClass = "col-sm-6";
            }
            else
            {
                // if only one (or none) is visible, show in one column
                pnlRemoteAuthLogins.CssClass  = "col-sm-12 margin-b-lg";
                pnlInternalAuthLogin.CssClass = "col-sm-12";
            }
        }
Beispiel #19
0
    protected void ColorBind()
    {
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            for (int j = 2; j < 12; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();
                    int k = j - 2;

                    img.Src = "../Images/blue_" + k.ToString() + ".gif";
                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            for (int j = 12; j < 22; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();
                    int k = j - 12;

                    img.Src = "../Images/orange_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            for (int j = 22; j < 32; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();
                    int k = j - 22;

                    img.Src = "../Images/red_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            for (int j = 32; j < 42; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();
                    int k = j - 32;

                    img.Src = "../Images/blue_" + k.ToString() + ".gif";
                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            for (int j = 42; j < 52; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();
                    int k = j - 42;

                    img.Src = "../Images/orange_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }
        }
    }
Beispiel #20
0
    public void SetSavedCarts(List<ISavedCart> savedCarts)
    {
        System.Web.UI.HtmlControls.HtmlTableRow row;
        System.Web.UI.HtmlControls.HtmlTableCell cell;
        //System.Web.UI.HtmlControls.HtmlAnchor anchor;
        System.Web.UI.WebControls.LinkButton linkButton;
        System.Web.UI.HtmlControls.HtmlImage image;
        //System.Web.UI.HtmlControls.HtmlInputText text;
        bool stripe = true;

        SavedCartTableBody.Controls.Clear();
        foreach (ISavedCart savedCart in savedCarts)
        {
            stripe = !stripe;
            row = new HtmlTableRow();
            if (stripe)
                row.Attributes.Add("class", "stripe");

            // column one:
            linkButton = new LinkButton();
            //SelectCartEventArgs args = new SelectCartEventArgs(savedCart.Id);
            //linkButton.Click += delegate(object sender, EventArgs e) { SelectCart_Click(linkButton, args); };
            linkButton.OnClientClick = "document.getElementById('" + ActionCode.ClientID + "').value = 'SelectCart';"
                + "document.getElementById('" + ActionArgument.ClientID + "').value = '" + savedCart.Id + "';";
            linkButton.Attributes.Add("class", "removeCoupon");
            linkButton.Attributes.Add("title", GetResourceString("lbl view cart", "View Cart") + " " + savedCart.Name);
            linkButton.Text = (!String.IsNullOrEmpty(savedCart.Name) ? savedCart.Name : GetResourceString("", "(No Name)"))
                + (IsActiveCart(savedCart.Id) ? " - " + GetResourceString("lbl active cart", "Active Cart") : "");

            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colCartName");
            cell.Controls.Add(linkButton);
            row.Controls.Add(cell);

            // column two:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colLastModified");
            cell.InnerText = savedCart.LastUpdated;
            row.Controls.Add(cell);

            // column three:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colCartItems");
            cell.InnerText = savedCart.Count.ToString();
            row.Controls.Add(cell);

            // column four:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colcartSubtotal");
            cell.InnerText = savedCart.Subtotal;
            row.Controls.Add(cell);

            // column five:
            if (!IsActiveCart(savedCart.Id))
            {
                image = new HtmlImage();
                image.Alt = GetResourceString("lbl delete cart", "Delete Cart");
                image.Src = ApplicationImagePath + "commerce/deleteCart.gif";

                //anchor = new HtmlAnchor();
                //anchor.HRef = "#";
                //anchor.Attributes.Add("onclick", "alert('delete cart: " + savedCart.Id.ToString() + "'); return false;");
                //anchor.Title = GetResourceString("lbl delete cart", "Delete Cart");
                //anchor.Controls.Add(image);

                linkButton = new LinkButton();
                linkButton.OnClientClick = "document.getElementById('" + ActionCode.ClientID + "').value = 'DeleteCart';"
                    + "document.getElementById('" + ActionArgument.ClientID + "').value = '" + savedCart.Id.ToString() + "';";
                linkButton.ToolTip = GetResourceString("lbl delete cart", "Delete Cart");
                linkButton.Controls.Add(image);

                cell = new HtmlTableCell();
                cell.Attributes.Add("class", "colDeleteSavedCart");
                cell.Controls.Add(linkButton);
                row.Controls.Add(cell);
            }
            else
            {
                cell = new HtmlTableCell();
                cell.Attributes.Add("class", "colDeleteSavedCart");
                row.Controls.Add(cell);
            }

            SavedCartTableBody.Controls.Add(row);
        }

        SavedCartContainer.Visible = true;
    }
Beispiel #21
0
    public void SetItems(List<ICartItem> items)
    {
        System.Web.UI.HtmlControls.HtmlTableRow row;
        System.Web.UI.HtmlControls.HtmlTableCell cell;
        System.Web.UI.HtmlControls.HtmlAnchor anchor;
        System.Web.UI.WebControls.LinkButton linkButton;
        System.Web.UI.HtmlControls.HtmlImage image;
        //System.Web.UI.HtmlControls.HtmlInputText text;
        System.Web.UI.HtmlControls.HtmlGenericControl genericCtl;
        bool stripe = true;
        int count = 0;

        CurrentCartTableBody.Controls.Clear();
        foreach (ICartItem item in items)
        {
            stripe = !stripe;

            // column one:
            anchor = new HtmlAnchor();
            anchor.HRef = (!String.IsNullOrEmpty(_productUrl) ? _productUrl + "?id=" + item.ProductId.ToString() : "#");
            anchor.InnerText = item.Name + (item.NameExtended.Length > 0 ? " - " + item.NameExtended : "");
            anchor.Title = item.Name;

            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colItemName");
            cell.Controls.Add(anchor);

            foreach (IKitItem kitItem in item.KitItems)
            {
                genericCtl = new HtmlGenericControl("div");
                genericCtl.Attributes.Add("class", "colItemNameKitNames");
                genericCtl.InnerText = kitItem.Name + ": " + kitItem.OptionName;
                cell.Controls.Add(genericCtl);
            }

            row = new HtmlTableRow();
            row.Controls.Add(cell);
            row.Attributes.Add("class", stripe ? "rowSku stripe" : "rowSku");

            // column two:
            image = new HtmlImage();
            image.Alt = GetResourceString("lbl remove from cart", "Remove From Cart");
            image.Src = ApplicationImagePath + "commerce/removefromcart2.gif";

            linkButton = new LinkButton();
            linkButton.OnClientClick = "document.getElementById('" + ActionCode.ClientID + "').value = 'RemoveItem';"
                + "document.getElementById('" + ActionArgument.ClientID + "').value = '" + item.Id.ToString() + "';";
            linkButton.ToolTip = GetResourceString("lbl remove from cart", "Remove From Cart");
            linkButton.Controls.Add(image);

            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colRemove");
            cell.Controls.Add(linkButton);
            row.Controls.Add(cell);

            // column three:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colProductId");
            cell.InnerText = item.Sku;
            row.Controls.Add(cell);

            // column four:
            System.Web.UI.WebControls.TextBox textBox = new TextBox();
            textBox.Attributes.Add("class", "productQtyText");
            textBox.Text = item.Count.ToString();
            textBox.ID = "CartItems_ProductCount_" + count.ToString();
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colQty");
            cell.Controls.Add(textBox);

            System.Web.UI.WebControls.HiddenField hidden = new HiddenField();
            hidden.ID = "CartItems_ProductCode_" + count.ToString();
            hidden.Value = item.ProductId.ToString();
            cell.Controls.Add(hidden);
            row.Controls.Add(cell);

            // column five:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colItemPrice");
            cell.InnerText = item.ListPrice;
            row.Controls.Add(cell);

            // column six:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colEarlyPrice");
            cell.InnerText = item.SalePrice;
            row.Controls.Add(cell);

            // column seven:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colTotal ieBorderFix");
            cell.InnerText = item.Total;
            row.Controls.Add(cell);

            ++count;
            CurrentCartTableBody.Controls.Add(row);
        }
    }
Beispiel #22
0
    public void SetCoupons(List<ICartCoupon> coupons)
    {
        System.Web.UI.HtmlControls.HtmlTableRow row;
        System.Web.UI.HtmlControls.HtmlTableCell cell;
        System.Web.UI.WebControls.LinkButton linkButton;
        System.Web.UI.HtmlControls.HtmlImage image;
        //System.Web.UI.HtmlControls.HtmlInputText text;
        System.Web.UI.HtmlControls.HtmlGenericControl genericCtl;

        foreach (ICartCoupon coupon in coupons)
        {
            // column one:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colDiscountCoupon");
            cell.Attributes.Add("colspan", "6");
            cell.InnerHtml = GetResourceString("lbl coupon code label", "Coupon Code ") + "<span class='couponCode'>" + coupon.Code + "</span>, " + GetResourceString("lbl discount label", "Discount");
            row = new HtmlTableRow();
            row.Controls.Add(cell);

            // column two:
            cell = new HtmlTableCell();
            cell.Attributes.Add("class", "colTotal ieBorderFix");

            genericCtl = new HtmlGenericControl("span");
            genericCtl.Attributes.Add("class", "couponDiscountAmount");
            genericCtl.InnerText = coupon.Discount;
            cell.Controls.Add(genericCtl);

            image = new HtmlImage();
            image.Alt = GetResourceString("lbl remove coupon", "Remove Coupon");
            image.Src = ApplicationImagePath + "commerce/removefromcart2.gif";
            CouponEventArgs args = new CouponEventArgs(coupon.Code);
            linkButton = new LinkButton();
            //linkButton.Click += delegate { RemoveCoupon_Click(linkButton, args); };
            linkButton.OnClientClick = "document.getElementById('" + ActionCode.ClientID + "').value = 'RemoveCoupon';"
                + "document.getElementById('" + ActionArgument.ClientID + "').value = '" + coupon.Code + "';";
            linkButton.Attributes.Add("class", "removeCoupon");
            linkButton.ToolTip = GetResourceString("lbl remove from cart", "Remove From Cart");
            linkButton.Controls.Add(image);
            cell.Controls.Add(linkButton);

            row.Controls.Add(cell);
            row.Attributes.Add("class", "rowSku");
            row.Controls.Add(cell);

            CurrentCartTableBody.Controls.Add(row);
        }
    }
    private void setGradeInstructions(int gradeindex)
    {
        Table colortable = new Table();
        colortable.CellPadding = 0;
        colortable.CellSpacing = 0;
        colortable.BorderWidth = 0;
        TableRow colorrow = new TableRow();
        TableCell colorcell = new TableCell();
        HtmlImage colorimage = new HtmlImage();
        string imagestyle = "width:30px;height:20px;";
        Label colorlabel = new Label();
        if (gradeindex == 2)
        {
            colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptRed.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 1 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptGreen.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 2";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            colortable.Rows.Add(colorrow);

            tcellColorGrade.Controls.Add(colortable);

        }
        else if (gradeindex == 3)
        {
            colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptRed.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 1 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            //colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptYellowOrange.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 2 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptGreen.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 3";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            colortable.Rows.Add(colorrow);

            tcellColorGrade.Controls.Add(colortable);

        }
        else if (gradeindex == 4)
        {
            colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptRed.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 1 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            //colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptYellowOrange.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 2 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            //colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptGreenYellow.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 3 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptGreen.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 4";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            colortable.Rows.Add(colorrow);

            tcellColorGrade.Controls.Add(colortable);
        }
        else if (gradeindex == 5)
        {
            colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptRed.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 1 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            //colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptRedOrange.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 2 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            //colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptYellowOrange.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 3 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            //colorrow = new TableRow();
            colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptGreenYellow.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 4 &nbsp&nbsp";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            //colortable.Rows.Add(colorrow);

            //colorimage = new HtmlImage();
            colorimage.Src = "~/QuestionAnswerFiles/ReportImages/rptGreen.JPG";
            colorimage.Style.Value = imagestyle;
            colorcell = new TableCell();
            colorcell.Controls.Add(colorimage);
            colorrow.Cells.Add(colorcell);
            colorlabel = new Label();
            colorlabel.Text = "Grade 5";
            colorcell = new TableCell();
            colorcell.Controls.Add(colorlabel);
            colorrow.Cells.Add(colorcell);
            colortable.Rows.Add(colorrow);

            tcellColorGrade.Controls.Add(colortable);
        }
    }
Beispiel #24
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (this.DesignMode)
            {
                return;
            }

            if (this.ProcessCertificateDownloadRequest())
            {
                return;
            }

            string divId = string.Format(CultureInfo.InvariantCulture, "{0}_div", this.ID);

            HtmlGenericControl container = new HtmlGenericControl("div")
            {
                ID = divId
            };

            ClientScriptManager clientScriptManager = this.Page.ClientScript;
            HtmlImage           controlImage        = new HtmlImage
            {
                ID  = string.Format(CultureInfo.CurrentUICulture, "STVC{0}", Guid.NewGuid()),
                Src = clientScriptManager.GetWebResourceUrl(typeof(SecurityTokenVisualizerControl), "Microsoft.Samples.DPE.Identity.Controls.Content.images.icon.png"),
                Alt = Resources.SecurityTokenVisualizer,
            };

            controlImage.Attributes["title"] = Resources.SecurityTokenVisualizer;

            HtmlControl tokenVisualizerHeader = this.CreateCollapsableHeader(controlImage, container, false /* Expanded as Default */);

            if (this.Font == null || string.IsNullOrEmpty(this.Font.Name))
            {
                container.Style["font-family"]             = "Arial, Consolas, Segoe UI";
                tokenVisualizerHeader.Style["font-family"] = "Arial, Consolas, Segoe UI";
            }
            if (this.Font == null || this.Font.Size.IsEmpty)
            {
                container.Style["font-size"]             = "small";
                tokenVisualizerHeader.Style["font-size"] = "small";
            }

            var containerRounded = this.AddContainerRounded(container);

            if (Thread.CurrentPrincipal.Identity.IsAuthenticated && Thread.CurrentPrincipal.Identity is IClaimsIdentity)
            {
                AddClaimsTable(containerRounded);
                containerRounded.Controls.Add(new HtmlGenericControl()
                {
                    InnerHtml = "&nbsp;"
                });
                this.AddSamlTokenTable(containerRounded);
            }
            else
            {
                AddNotAuthenticatedUserTable(containerRounded);
            }

            tokenVisualizerHeader.RenderControl(writer);

            container.RenderControl(writer);

            base.RenderContents(writer);
        }
 protected void ColorBind()
 {
     for (int i = 0; i < this.GridView1.Rows.Count; i++)
     {
         for (int j = 2; j < 12; j++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[j].Text, -1) == 0)
             {
                 HtmlImage child = new HtmlImage();
                 child.Src = "../Images/blue_" + ((j - 2)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[j].Controls.Add(child);
             }
         }
         for (int k = 12; k < 0x16; k++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[k].Text, -1) == 0)
             {
                 HtmlImage image2 = new HtmlImage();
                 image2.Src = "../Images/orange_" + ((k - 12)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[k].Controls.Add(image2);
             }
         }
         for (int m = 0x16; m < 0x20; m++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[m].Text, -1) == 0)
             {
                 HtmlImage image3 = new HtmlImage();
                 image3.Src = "../Images/red_" + ((m - 0x16)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[m].Controls.Add(image3);
             }
         }
         for (int n = 0x20; n < 0x2a; n++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[n].Text, -1) == 0)
             {
                 HtmlImage image4 = new HtmlImage();
                 image4.Src = "../Images/blue_" + ((n - 0x20)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[n].Controls.Add(image4);
             }
         }
         for (int num10 = 0x2a; num10 < 0x34; num10++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[num10].Text, -1) == 0)
             {
                 HtmlImage image5 = new HtmlImage();
                 image5.Src = "../Images/orange_" + ((num10 - 0x2a)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[num10].Controls.Add(image5);
             }
         }
     }
 }
Beispiel #26
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.PostedFile.FileName.Length == 0 || FileUpload1.FileBytes.Length == 0)
        {
            Result.Text = "Please select PDF file at first!";
            return;
        }

        SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
        //this property is necessary only for registered version
        //f.Serial = "XXXXXXXXXXX";

        f.OpenPdf(FileUpload1.FileBytes);

        if (f.PageCount > 0)
        {
            //set image properties
            f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
            f.ImageOptions.Dpi         = 72;

            //Let's convert whole PDF document
            ArrayList pages = f.ToImage();

            //Show images
            if (pages.Count > 0)
            {
                int width    = 3;
                int imgWidth = 300;

                HtmlTable table = new HtmlTable();
                table.Border      = 1;
                table.CellPadding = 3;
                table.CellSpacing = 3;

                HtmlTableRow  row;
                HtmlTableCell cell;
                HtmlImage     img;

                string imagePath = Server.MapPath("~");
                string imageName = "Page";

                row = new HtmlTableRow();
                int count = 0;
                foreach (byte[] page in pages)
                {
                    count++;
                    string src = imageName + count.ToString() + ".png";
                    File.WriteAllBytes(Path.Combine(imagePath, src), page);

                    cell = new HtmlTableCell();
                    cell.Style.Add("vertical-align", "top");
                    img = new HtmlImage();

                    img.Src        = src;
                    img.Width      = imgWidth;
                    cell.InnerHtml = "<div align=\"center\">Page" + count.ToString() + "</div>";

                    cell.Controls.Add(img);
                    row.Cells.Add(cell);

                    if (count % width == 0)
                    {
                        table.Rows.Add(row);
                        row = new HtmlTableRow();
                    }
                }
                table.Rows.Add(row);
                this.Controls.Add(table);
            }
        }
        else
        {
            Result.Text = "Converting failed!";
        }
    }
    private void DisplayIndividualColorGraph()
    {
        goToPrintPage(); return;

        Table tblDisplay = new Table();
        TableCell tblCell = new TableCell();
        TableRow tblRow;
        Label label;
        int i = 0;
        int rowid = 0;
        int totalmarks = 0;
        int sectionid = 0;
        // code to draw section(variable)wise bargraph

        //tblDisplay.Width = 650;
        tblDisplay.CellPadding = 0;
        tblDisplay.CellSpacing = 0;
        tblDisplay.BorderWidth = 1;
        tblDisplay.BorderStyle = BorderStyle.Ridge;
        tblDisplay.BorderColor = Color.Black;
        string mark = "0"; string benchmark = "";
        float totalmark_variablewise = 0;
        int GRADE = 0;
        int gradecount = 0;

        for (int j = 0; j < GridView1.Rows.Count; j++)
        {

            if (GridView1.Rows[j].Cells[1].Text != "&nbsp;")
            {
                totalmark_variablewise = 0;
                string TESTSECTIONID = GridView1.Rows[j].Cells[2].Text;
                //mark = "0";
                if (GridView1.Rows[j].Cells[4].Text != "0" && GridView1.Rows[j].Cells[4].Text != "&nbsp;")
                    totalmark_variablewise = float.Parse(GridView1.Rows[j].Cells[4].Text);
                //mark = GridView1.Rows[j].Cells[4].Text;

                string remarks = ""; string querystring1 = "";
                benchmark = "";

                int secid = GetSectionId(GridView1.Rows[j].Cells[1].Text);

                querystring1 = "SELECT TestID, BenchMark,DisplayName,MarkFrom,MarkTo FROM TestVariableResultBands WHERE TestID = " + testid + " AND TestSectionId = " + TESTSECTIONID;
                querystring1 += " AND VariableId = " + secid + "";

                DataSet ds1 = new DataSet(); bool benchmarkexists = false;
                ds1 = clsClasses.GetValuesFromDB(querystring1);
                if (ds1 != null)
                    if (ds1.Tables.Count > 0)
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            benchmarkexists = true;
                            gradecount = ds1.Tables[0].Rows.Count;
                            for (int g = 0; g < ds1.Tables[0].Rows.Count; g++)
                            {
                                if (totalmark_variablewise >= float.Parse(ds1.Tables[0].Rows[g]["MarkFrom"].ToString()) && totalmark_variablewise <= float.Parse(ds1.Tables[0].Rows[g]["MarkTo"].ToString()))
                                { GRADE = g + 1; break; }

                            }
                        }

                if (benchmarkexists == false)
                {

                    querystring1 = "SELECT TestID, BenchMark,DisplayName,MarkFrom,MarkTo FROM TestSectionResultBands WHERE TestID = " + testid;
                    querystring1 += " AND SectionId = " + TESTSECTIONID;

                    ds1 = new DataSet();
                    ds1 = clsClasses.GetValuesFromDB(querystring1);
                    if (ds1 != null)
                        if (ds1.Tables.Count > 0)
                            if (ds1.Tables[0].Rows.Count > 0)
                            {
                                gradecount = ds1.Tables[0].Rows.Count;
                                for (int g = 0; g < ds1.Tables[0].Rows.Count; g++)
                                {
                                    if (totalmark_variablewise >= float.Parse(ds1.Tables[0].Rows[g]["MarkFrom"].ToString()) && totalmark_variablewise <= float.Parse(ds1.Tables[0].Rows[g]["MarkTo"].ToString()))
                                    { GRADE = g + 1; break; }

                                }

                            }
                }

                if (j == 0)
                {

                    tblRow = new TableRow();
                    tblCell = new TableCell();
                    tblCell.RowSpan = 2;
                    tblCell.Style.Value = "vertical-align:middle;text-align:center;padding-left:10px;padding-right:10px;border: 1px ridge #000000;font-weight: bold";
                    tblCell.Text = "Variable Name";
                    tblRow.Cells.Add(tblCell);
                    tblCell = new TableCell();
                    tblCell.ColumnSpan = gradecount;
                    tblCell.Style.Value = "vertical-align:middle;text-align:center;border: 1px ridge #000000;font-weight: bold";
                    tblCell.Text = "Grade";
                    tblRow.Cells.Add(tblCell);
                    tblDisplay.Rows.Add(tblRow);

                    tblRow = new TableRow();
                    for (int c = 0; c < gradecount; c++)
                    {
                        tblCell = new TableCell();
                        tblCell.Text = (c + 1).ToString();
                        tblCell.Style.Value = "vertical-align:middle;text-align:center;border: 1px ridge #000000;font-weight: bold;width:70px";
                        tblRow.Cells.Add(tblCell);
                    }
                    tblDisplay.Rows.Add(tblRow);
                }

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.Text = GridView1.Rows[j].Cells[1].Text;//"Variable name1";
                tblCell.Style.Value = "vertical-align:middle;text-align:left;padding-left:10px;padding-right:10px;border: 1px ridge #000000;font-weight: bold;font-size: 12px";
                tblRow.Cells.Add(tblCell);
                HtmlImage himage = new HtmlImage();
                for (int n = 0; n < gradecount; n++)
                {
                    tblCell = new TableCell();

                    if (gradecount == 2)
                    {
                        //tblCell.Text=i+1;
                        if (GRADE == n + 1)
                        {
                            if (GRADE == 1)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                                tblCell.Controls.Add(himage);
                            }
                            else if (GRADE == 2)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imggreen.JPG";
                                tblCell.Controls.Add(himage);

                            }
                        }
                    }
                    else if (gradecount == 3)
                    {
                        if (GRADE == n + 1)
                        {
                            if (GRADE == 1)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                                tblCell.Controls.Add(himage);
                            }
                            else if (GRADE == 2)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                tblCell.Controls.Add(himage);

                            }
                            else if (GRADE == 3)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imggreen.JPG";
                                tblCell.Controls.Add(himage);

                            }
                        }
                    }
                    else if (gradecount == 4)
                    {
                        if (GRADE == n + 1)
                        {
                            if (GRADE == 1)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                                tblCell.Controls.Add(himage);
                            }
                            else if (GRADE == 2)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                tblCell.Controls.Add(himage);

                            }
                            else if (GRADE == 3)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                tblCell.Controls.Add(himage);

                            }
                            else if (GRADE == 4)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imggreen.JPG";
                                tblCell.Controls.Add(himage);

                            }
                        }
                    }
                    else if (gradecount == 5)
                    {
                        if (GRADE == n + 1)
                        {
                            if (GRADE == 1)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                                tblCell.Controls.Add(himage);
                            }
                            else if (GRADE == 2)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                tblCell.Controls.Add(himage);

                            }
                            else if (GRADE == 3)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                tblCell.Controls.Add(himage);

                            }
                            else if (GRADE == 4)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                tblCell.Controls.Add(himage);

                            }
                            else if (GRADE == 5)
                            {
                                himage = new HtmlImage();
                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imggreen.JPG";
                                tblCell.Controls.Add(himage);

                            }

                        }
                    }
                    tblCell.Style.Value = "border: 1px ridge #000000;width:70px";
                    tblRow.Cells.Add(tblCell);
                }

                tblDisplay.Rows.Add(tblRow);
                // bipson 13-01-2011
            }
        }

        if (dtEmptySessionList.Rows.Count > 0)
        {
            for (int k = 0; k < dtEmptySessionList.Rows.Count; k++)
            {
                //TestVariableResultBands
                string remarks = "";
                benchmark = "";

                int secid = GetSectionId(dtEmptySessionList.Rows[k][0].ToString());

                string querystring1 = "SELECT TestID, BenchMark,DisplayName,MarkFrom,MarkTo FROM TestVariableResultBands WHERE TestID = " + testid;
                querystring1 += " AND VariableId = " + secid;
                DataSet ds1 = new DataSet();
                ds1 = clsClasses.GetValuesFromDB(querystring1);
                if (ds1 != null)
                    if (ds1.Tables.Count > 0)
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            if (gradecount == 0)
                                gradecount = ds1.Tables[0].Rows.Count;
                            for (int g = 0; g < ds1.Tables[0].Rows.Count; g++)
                            {
                                if (totalmark_variablewise >= int.Parse(ds1.Tables[0].Rows[g]["MarkFrom"].ToString()) && totalmark_variablewise <= int.Parse(ds1.Tables[0].Rows[g]["MarkTo"].ToString()))
                                { GRADE = g + 1; break; }
                            }
                        }

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.Text = dtEmptySessionList.Rows[k][0].ToString();//"Variable name1";
                tblRow.Cells.Add(tblCell);

                for (int m = 0; m < gradecount; m++)
                {
                    tblCell = new TableCell();
                   HtmlImage himage = new HtmlImage();
                    himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                    tblCell.Controls.Add(himage);
                    tblRow.Cells.Add(tblCell);
                }
                tblDisplay.Rows.Add(tblRow);

            }
        }

        // tcellBarGraph.Width = "200";
        tcellBarGraph.Controls.Add(tblDisplay);
        // imgGraph.Visible = false;
    }
Beispiel #28
0
        protected void Repeater1_ItemCommand(object o, RepeaterCommandEventArgs e)
        {
            try
            {
                string currentPatientId  = Convert.ToString(e.CommandArgument);
                string actionItemCommand = Convert.ToString(e.CommandName);

                HtmlImage   DataReceivedImg = (HtmlImage)e.Item.FindControl("DataReceivedImg");
                ImageButton DataReceivedBtn = (ImageButton)e.Item.FindControl("DataReceivedBtn");
                Label       DataReceivedLBL = (Label)e.Item.FindControl("DataReceivedLBL");

                HtmlImage   NeedMD_ContactImg = (HtmlImage)e.Item.FindControl("NeedMD_ContactImg");
                ImageButton NeedMD_ContactBtn = (ImageButton)e.Item.FindControl("NeedMD_ContactBtn");
                Label       NeedMD_ContactLBL = (Label)e.Item.FindControl("NeedMD_ContactLBL");

                UserController userCt        = new UserController();
                int            currentUserId = userCt.GetUserId();
                UserDa         currentUserDa = new UserDa();
                DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());

                if (actionItemCommand == "DataReceived")
                {
                    if (DataReceivedBtn != null && DataReceivedImg != null)
                    {
                        DataReceivedBtn.Style["display"] = "none";
                    }

                    if (!String.IsNullOrEmpty(currentPatientId))
                    {
                        bool actionAlreadyExists = false;

                        ActionDa actionDa = new ActionDa();
                        DataSet  actionDs = actionDa.ValidateActionItem(Int32.Parse(currentPatientId), actionItemCommand);
                        if (actionDs.Tables.Count > 0)
                        {
                            DataView actionDv = new DataView(actionDs.Tables[0]);
                            actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = '" + actionItemCommand + "' ";
                            if (actionDv.Count > 0)
                            {
                                actionAlreadyExists = true;
                            }
                        }

                        // if action item does not already exist for today
                        if (!actionAlreadyExists)
                        {
                            // create ActionItem = 'DataReceived' for patients to check
                            BOL.Action actionObj = new Caisis.BOL.Action();
                            actionObj[BOL.Action.PatientId]      = int.Parse(currentPatientId);
                            actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString();
                            actionObj[BOL.Action.ActionDate]     = DateTime.Today;
                            actionObj[BOL.Action.ActionItem]     = actionItemCommand;

                            actionObj[BOL.Action.EnteredBy]   = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                            actionObj[BOL.Action.EnteredTime] = DateTime.Today;

                            actionObj.Save();
                        }

                        // set patient status to 'NeedDataEntry'
                        Patient ptObj = new Patient();
                        ptObj.Get(Int32.Parse(currentPatientId));
                        if (!ptObj.IsEmpty)
                        {
                            ptObj[Patient.PtContactStatus] = "NeedDataEntry";
                            ptObj[Patient.UpdatedTime]     = DateTime.Today;
                            ptObj[Patient.UpdatedBy]       = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                            ptObj.Save();
                        }

                        if (DataReceivedLBL != null && DataReceivedImg != null)
                        {
                            DataReceivedImg.Style["display"] = "";
                            DataReceivedLBL.Text             = actionItemCommand;
                        }

                        // show "NeedMD_Contact" btn
                        if (NeedMD_ContactBtn != null)
                        {
                            NeedMD_ContactBtn.Style["display"] = "";
                        }

                        if (NeedMD_ContactLBL != null && NeedMD_ContactImg != null)
                        {
                            NeedMD_ContactImg.Style["display"] = "none";
                            NeedMD_ContactLBL.Text             = String.Empty;
                        }
                    }
                }
                else if (actionItemCommand == "NeedMD_Contact")
                {
                    if (NeedMD_ContactBtn != null && NeedMD_ContactImg != null)
                    {
                        NeedMD_ContactBtn.Style["display"] = "none";
                    }

                    if (!String.IsNullOrEmpty(currentPatientId))
                    {
                        // if any action item was created for "DataReceived", delete

                        ActionDa actionDa = new ActionDa();
                        DataSet  actionDs = actionDa.ValidateActionItem(Int32.Parse(currentPatientId), "DataReceived");
                        if (actionDs.Tables.Count > 0)
                        {
                            DataView actionDv = new DataView(actionDs.Tables[0]);
                            actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = 'DataReceived' ";
                            if (actionDv.Count > 0)
                            {
                                BOL.Action actionObj = new Caisis.BOL.Action();
                                actionObj.Get(Int32.Parse(actionDv[0][BOL.Action.ActionId].ToString()));
                                actionObj.Delete();
                            }
                        }


                        // set patient status to 'NeedMD_Contact'
                        Patient ptObj = new Patient();
                        ptObj.Get(Int32.Parse(currentPatientId));
                        if (!ptObj.IsEmpty)
                        {
                            ptObj[Patient.PtContactStatus] = "NeedMD_Contact";
                            ptObj[Patient.UpdatedTime]     = DateTime.Today;
                            ptObj[Patient.UpdatedBy]       = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                            ptObj.Save();
                        }

                        if (NeedMD_ContactLBL != null && NeedMD_ContactImg != null)
                        {
                            NeedMD_ContactImg.Style["display"] = "";
                            NeedMD_ContactLBL.Text             = actionItemCommand;
                        }

                        // show "Data Received" btn
                        if (DataReceivedBtn != null)
                        {
                            DataReceivedBtn.Style["display"] = "";
                        }

                        if (DataReceivedLBL != null && DataReceivedImg != null)
                        {
                            DataReceivedImg.Style["display"] = "none";
                            DataReceivedLBL.Text             = String.Empty;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // publish raw error
                ExceptionHandler.Publish(ex);
            }
        }
    private void DrawBarGraph()
    {
        Table tblDisplay = new Table();
        TableCell tblCell = new TableCell();
        TableRow tblRow;
        Label label;
        int i = 0;
        int rowid = 0;
        int totalmarks = 0;
        int sectionid = 0;
        // code to draw section(variable)wise bargraph

        //tblDisplay.Width = 650;
        tblDisplay.CellPadding = 0;
        tblDisplay.CellSpacing = 0;
        tblDisplay.BorderWidth = 0;
        string mark = "0"; string benchmark = "";

        // lblMessage.Text += " bargrphParts= " + GridView1.Rows.Count.ToString() + " bargrphValues= ";
        string bargrapgimagename="imgReportBarGraph_" + userid + "_" + DateTime.Now.Millisecond.ToString();// + ".jpg"
        for (int j = 0; j < GridView1.Rows.Count; j++)
        {

            if (GridView1.Rows[j].Cells[1].Text != "&nbsp;")
            {
                string TESTSECTIONID = GridView1.Rows[j].Cells[2].Text;
                mark = "0";
                if (GridView1.Rows[j].Cells[4].Text != "0" && GridView1.Rows[j].Cells[4].Text != "&nbsp;")
                    mark = GridView1.Rows[j].Cells[4].Text;
                //  lblMessage.Text += " , " + mark;
                //lblMessage.Text += "," + mark;

                //float totalMarksectionwise = 0, currentmark = 0;
                //totalMarksectionwise = GetSectionwiseTotalQuestionMarks(GridView1.Rows[j].Cells[1].Text);

                //currentmark = (mark / totalMarksectionwise) * 100;
                //currentmark =float.Parse( currentmark.ToString("0.00"));
                ////TestVariableResultBands
                string remarks = ""; string querystring1 = "";
                benchmark = "";
                int secid = GetSectionId(GridView1.Rows[j].Cells[1].Text);
                if (mark == "0")
                {
                    querystring1 = "SELECT TestID, BenchMark,DisplayName FROM TestVariableResultBands WHERE TestID = " + testid + " AND TestSectionId = " + TESTSECTIONID;
                    querystring1 += " AND (0 >= MarkFrom AND  0 <= MarkTo)";//   MarkFrom <= " + mark + " AND  MarkTo >= " + mark;
                    querystring1 += " AND VariableId = " + secid + "";
                }
                else
                {
                    querystring1 = "SELECT TestID, BenchMark,DisplayName FROM TestVariableResultBands WHERE TestID = " + testid + " AND TestSectionId = " + TESTSECTIONID;
                    querystring1 += " AND (" + mark + " > MarkFrom AND  " + mark + " <= MarkTo)";//   MarkFrom <= " + mark + " AND  MarkTo >= " + mark;
                    querystring1 += " AND VariableId = " + secid + "";
                }

                DataSet ds1 = new DataSet(); bool benchmarkexists = false;
                ds1 = clsClasses.GetValuesFromDB(querystring1);
                if (ds1 != null)
                    if (ds1.Tables.Count > 0)
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            if (ds1.Tables[0].Rows[0]["BenchMark"] != "")
                                benchmark = ds1.Tables[0].Rows[0]["BenchMark"].ToString();
                            remarks = ds1.Tables[0].Rows[0]["DisplayName"].ToString();
                            benchmarkexists = true;
                        }
                //mark = ((mark * 100) / 360);

                // lblMessage.Text += querystring1; ////return;//021209 bip

                if (benchmarkexists == false)
                {

                    if (mark == "0")
                    {
                        querystring1 = "SELECT TestID, BenchMark,DisplayName FROM TestSectionResultBands WHERE TestID = " + testid;
                        querystring1 += " AND (0 >= MarkFrom AND 0 <= MarkTo)";
                        querystring1 += " AND SectionId = " + TESTSECTIONID;
                    }
                    else
                    {
                        querystring1 = "SELECT TestID, BenchMark,DisplayName FROM TestSectionResultBands WHERE TestID = " + testid;
                        querystring1 += " AND (" + mark + " > MarkFrom AND  " + mark + " <= MarkTo)";//   MarkFrom <= " + mark + " AND  MarkTo >= " + mark;
                        querystring1 += " AND SectionId = " + TESTSECTIONID;
                    }
                    ds1 = new DataSet();
                    ds1 = clsClasses.GetValuesFromDB(querystring1);
                    if (ds1 != null)
                        if (ds1.Tables.Count > 0)
                            if (ds1.Tables[0].Rows.Count > 0)
                            {
                                if (ds1.Tables[0].Rows[0]["BenchMark"].ToString() != "")
                                    benchmark = ds1.Tables[0].Rows[0]["BenchMark"].ToString();
                                remarks = ds1.Tables[0].Rows[0]["DisplayName"].ToString();

                            }
                }

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 15;
                label.Font.Bold = true;
                label.Text = GridView1.Rows[j].Cells[1].Text;

                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 15;
                label.Font.Bold = true;
                label.Text = "";
                label.Width = 30;
                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                //tblCell.BackColor = Color.LightBlue;

                tblRow = new TableRow();
                tblCell = new TableCell(); //tblCell.ColumnSpan = 2;
                ///////////
                label = new Label();
                //label.BackColor = Color.Green;//.LightBlue;
                ////mark = mark.ToString("0");
                double dblmark = double.Parse(mark);
                dblmark = dblmark * 5;
                label.Width = 10;// int.Parse(dblmark.ToString("0"));
                label.Height = 30;
                //////////////
                HtmlImage imgbargraph = new HtmlImage();

                int grphwidth = int.Parse(dblmark.ToString("0"));
                int grphheight = 30;
                Bitmap objBitmap = new Bitmap(grphheight, grphheight);
                Graphics objGraphic = Graphics.FromImage(objBitmap);
                SolidBrush greenBrush = new SolidBrush(Color.Green);

                objGraphic.SmoothingMode = SmoothingMode.Default;// SmoothingMode.AntiAlias;
                if (dblmark > 0)
                {
                    objBitmap = new Bitmap(grphwidth, grphheight);
                     objGraphic = Graphics.FromImage(objBitmap);
                     greenBrush = new SolidBrush(Color.Green);

                    objGraphic.FillRectangle(greenBrush, 0, 0, grphwidth, grphheight);
                    //objGraphic.FillEllipse(blueBrush1, 5, 5, 340, 340);
                    //objGraphic.DrawEllipse(outerPen, 5, 5, 340, 340);
                    //objGraphic.FillEllipse(blackBrush, 25, 25, 300, 300);
                    objBitmap.Save(Server.MapPath("Images\\graphFiles\\" + bargrapgimagename + "_" + (j * 2).ToString() + ".jpg"), ImageFormat.Jpeg);
                    objGraphic.Dispose();
                    objBitmap.Dispose();
                    imgbargraph.Src = "~/Images/graphFiles/" + bargrapgimagename + "_" + (j * 2).ToString() + ".jpg";
                    tblCell.Controls.Add(imgbargraph);
                }
                else tblCell.Controls.Add(label);
                /////////////
               // tblCell.Controls.Add(label);
                tblCell.Style.Value = "text-align: left; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                tblCell = new TableCell();
                label = new Label();
                label.Text = "Your Score =" + mark;// mark.ToString();
                if (scoretype == "Percentage")
                    if (int.Parse(dblmark.ToString("0")) > 0)
                        label.Text = label.Text + " % ";
                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                tblDisplay.Rows.Add(tblRow);

                //display name
                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Text = "";
                tblCell.Controls.Add(label);
                tblCell.Style.Value = "text-align: left; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                //

                tblRow = new TableRow();
                tblCell = new TableCell();
                ///////
                //tblCell.BackColor = Color.LightBlue;
                label = new Label();
                //label.BackColor = Color.Blue;//.Brown;
                //if (benchmark != "")
                    label.Width = 10;// (int.Parse(benchmark) * 5);
                label.Height = 30;
               // tblCell.Controls.Add(label);

                ////////
                if (benchmark != "")
                {
                    imgbargraph = new HtmlImage();
                    grphwidth = (int.Parse(benchmark) * 5);
                    objBitmap = new Bitmap(grphwidth, grphheight);
                    objGraphic = Graphics.FromImage(objBitmap);
                    SolidBrush blueBrush = new SolidBrush(Color.Blue);

                    objGraphic.SmoothingMode = SmoothingMode.Default;// SmoothingMode.AntiAlias;
                    objGraphic.FillRectangle(blueBrush, 0, 0, grphwidth, grphheight);
                    //objGraphic.FillEllipse(blueBrush1, 5, 5, 340, 340);
                    //objGraphic.DrawEllipse(outerPen, 5, 5, 340, 340);
                    //objGraphic.FillEllipse(blackBrush, 25, 25, 300, 300);
                    objBitmap.Save(Server.MapPath("Images\\graphFiles\\" + bargrapgimagename + "_" + ((j * 2)+1).ToString() + ".jpg"), ImageFormat.Jpeg);
                    objGraphic.Dispose();
                    objBitmap.Dispose();
                    imgbargraph.Src = "~/Images/graphFiles/" + bargrapgimagename + "_" + ((j * 2) + 1).ToString() + ".jpg";
                    tblCell.Controls.Add(imgbargraph);
                }
                else tblCell.Controls.Add(label);
                ///////
                tblCell.Style.Value = "text-align: left; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                tblCell = new TableCell();
                label = new Label();
                if (benchmark != "")
                    label.Text = "Benchmark=" + benchmark;

                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                tblDisplay.Rows.Add(tblRow);

                //ImageUrl = "~/Images/Scale1.jpg";

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                System.Web.UI.WebControls.Image imgScale = new System.Web.UI.WebControls.Image();
                imgScale.ImageUrl = "~/Images/ReportScale.jpg"; //"~/Images/Scale1.jpg";
                tblCell.Controls.Add(imgScale);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 15;
                label.Font.Bold = true;
                if (scoretype == "Percentage")
                    label.Text = "Percentage Score";
                else label.Text = "Percentile Score";

                //label.Width = 30;
                tblCell.Controls.Add(label);
                tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 12;
                //label.Font.Bold = true;
                label.Text = remarks;
                //label.Width = 30;
                tblCell.Controls.Add(label);
                tblCell.Style.Value = "text-align: left; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 15;
                label.Font.Bold = true;
                label.Text = "";
                label.Width = 30;
                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);
            }
        }

        if (dtEmptySessionList.Rows.Count > 0)
        {
            for (int k = 0; k < dtEmptySessionList.Rows.Count; k++)
            {
                //TestVariableResultBands
                string remarks = "";
                benchmark = "";

                int secid = GetSectionId(dtEmptySessionList.Rows[k][0].ToString());

                string querystring1 = "SELECT TestID, BenchMark,DisplayName FROM TestVariableResultBands WHERE TestID = " + testid;
                querystring1 += " AND (0 >= MarkFrom AND 0 <= MarkTo)";
                querystring1 += " AND VariableId = " + secid;
                DataSet ds1 = new DataSet();
                ds1 = clsClasses.GetValuesFromDB(querystring1);
                if (ds1 != null)
                    if (ds1.Tables.Count > 0)
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            if (ds1.Tables[0].Rows[0]["BenchMark"] != "")
                                benchmark = ds1.Tables[0].Rows[0]["BenchMark"].ToString();
                            remarks = ds1.Tables[0].Rows[0]["DisplayName"].ToString();
                        }

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 15;
                label.Font.Bold = true;
                label.Text = dtEmptySessionList.Rows[k][0].ToString();

                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 15;
                label.Font.Bold = true;
                label.Text = "";
                label.Width = 30;
                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                //tblCell.BackColor = Color.LightBlue;

                tblRow = new TableRow();
                tblCell = new TableCell();
                label = new Label();
                label.BackColor = Color.Green;//.LightBlue;
                label.Width = 0;
                label.Height = 30;
                tblCell.Controls.Add(label);
                tblCell.Style.Value = "text-align: left; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                tblCell = new TableCell();
                label = new Label();
                label.Text = "Your Score =0";

                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                tblDisplay.Rows.Add(tblRow);

                tblRow = new TableRow();
                tblCell = new TableCell();
                //tblCell.BackColor = Color.LightBlue;
                label = new Label();
                label.BackColor = Color.Blue;//.Brown;
                if (benchmark != "")
                    label.Width = (int.Parse(benchmark) * 5);
                label.Height = 30;
                tblCell.Controls.Add(label);
                tblCell.Style.Value = "text-align: left; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                tblCell = new TableCell();
                label = new Label();
                if (benchmark != "")
                    label.Text = "Benchmark=" + benchmark;

                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);

                tblDisplay.Rows.Add(tblRow);

                //
                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                System.Web.UI.WebControls.Image imgScale = new System.Web.UI.WebControls.Image();
                imgScale.ImageUrl = "~/Images/ReportScale.jpg";
                tblCell.Controls.Add(imgScale);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);
                //

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 15;
                label.Font.Bold = true;
                if (scoretype == "Percentage")
                    label.Text = "Percentage Score";
                else label.Text = "Percentile Score";
                //label.Width = 30;
                tblCell.Controls.Add(label);
                tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 12;
                // label.Font.Bold = true;
                label.Text = remarks;
                //label.Width = 30;
                tblCell.Controls.Add(label);
                tblCell.Style.Value = "text-align: left; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

                tblRow = new TableRow();
                tblCell = new TableCell();
                tblCell.ColumnSpan = 2;
                label = new Label();
                label.Font.Size = 15;
                label.Font.Bold = true;
                label.Text = "";
                label.Width = 30;
                tblCell.Controls.Add(label);
                //tblCell.Style.Value = "text-align: center; vertical-align: middle";
                tblRow.Cells.Add(tblCell);
                tblDisplay.Rows.Add(tblRow);

            }
        }

        // tcellBarGraph.Width = "200";
        tcellBarGraph.Controls.Add(tblDisplay);
        // imgGraph.Visible = false;
    }
Beispiel #30
0
        /// <summary>
        /// Loops through all users and builds the HTML
        /// presentation.
        /// </summary>
        /// <returns>The authors.</returns>
        private HtmlGenericControl BindAuthors()
        {
            if (Post.Posts.Count == 0)
            {
                var p = new HtmlGenericControl("p")
                {
                    InnerHtml = labels.none
                };
                return(p);
            }

            var ul = new HtmlGenericControl("ul")
            {
                ID = "authorlist"
            };

            ul.Attributes.Add("class", "authorlist");

            IEnumerable <MembershipUser> users = Membership.GetAllUsers()
                                                 .Cast <MembershipUser>()
                                                 .ToList()
                                                 .OrderBy(a => a.UserName);

            int userCnt = 0;

            foreach (MembershipUser user in users)
            {
                if (userCnt >= MaxAuthors && MaxAuthors > 0)
                {
                    break;
                }

                var blog = Post.GetBlogByAuthor(user.UserName);
                if (blog == null)
                {
                    continue;
                }

                var blogName = blog.IsPrimary ? "" : blog.Name + "/";

                var postCount = Post.GetPostsByAuthor(user.UserName).Count;
                if (postCount == 0)
                {
                    continue;
                }

                var li = new HtmlGenericControl("li");

                if (ShowRssIcon)
                {
                    var img = new HtmlImage
                    {
                        Src = string.Format("{0}Content/images/blog/rssButton.png", Utils.RelativeWebRoot),
                        Alt = string.Format("RSS feed for {0}", user.UserName)
                    };
                    img.Attributes["class"] = "rssButton";

                    var feedAnchor = new HtmlAnchor
                    {
                        HRef =
                            string.Format("{0}{1}syndication.axd?author={2}", Utils.ApplicationRelativeWebRoot, blogName, Utils.RemoveIllegalCharacters(user.UserName))
                    };
                    feedAnchor.Attributes["rel"] = "nofollow";
                    feedAnchor.Controls.Add(img);

                    li.Controls.Add(feedAnchor);
                }

                if (ShowAuthorImg)
                {
                    var img = new HtmlImage
                    {
                        Src    = Avatar.GetSrc(user.Email),
                        Alt    = "author avatar",
                        Width  = authorImgSize,
                        Height = authorImgSize
                    };
                    img.Attributes["class"] = "author-avatar";

                    var authorAnchor = new HtmlAnchor
                    {
                        HRef = string.Format("{0}{1}syndication.axd?author={2}",
                                             Utils.ApplicationRelativeWebRoot, blogName, Utils.RemoveIllegalCharacters(user.UserName))
                    };
                    authorAnchor.Attributes["rel"] = "nofollow";
                    authorAnchor.Controls.Add(img);

                    li.Controls.Add(authorAnchor);
                }

                var innerHtml = "";
                try
                {
                    innerHtml = Blog.CurrentInstance.IsSiteAggregation ?
                                string.Format(PatternAggregated, user.UserName, blog.Name, postCount) :
                                string.Format(DisplayPattern, user.UserName, postCount);
                }
                catch (Exception)
                {
                    innerHtml = Blog.CurrentInstance.IsSiteAggregation ?
                                string.Format("{0}@{1} ({2})", user.UserName, blog.Name, postCount) :
                                string.Format("{0} ({1})", user.UserName, postCount);
                }

                var anc = new HtmlAnchor
                {
                    HRef      = string.Format("{0}{1}author/{2}{3}", Utils.ApplicationRelativeWebRoot, blogName, Utils.RemoveIllegalCharacters(user.UserName), BlogConfig.FileExtension),
                    InnerHtml = innerHtml,
                    Title     = string.Format("Author: {0}", user.UserName)
                };
                anc.Attributes.Add("class", "authorlink");

                li.Controls.Add(anc);
                ul.Controls.Add(li);
                userCnt++;
            }

            return(ul);
        }
        /// <summary>
        /// Convert an image into its html representation.
        /// </summary>
        /// <param name="image">Image.</param>
        /// <param name="htmlWriter">XmlTextWriter producing resulting html.</param>
        /// <param name="conversionResult">Conversion result to store error and warning messages. Can be null.</param>
        private static void AddImage(HtmlImage image, XmlTextWriter htmlWriter, ValidationResult conversionResult)
        {
            htmlWriter.WriteStartElement("img");
            htmlWriter.WriteAttributeString("src", image.RelativeSource);

            if (!String.IsNullOrEmpty(image.AlternativeText))
                htmlWriter.WriteAttributeString("alt", image.AlternativeText);

            if (!String.IsNullOrEmpty(image.Id))
                htmlWriter.WriteAttributeString("id", image.Id);

            if (image.ExportHeight != null)
                htmlWriter.WriteAttributeString("height", image.ExportHeight.Value.ToString());
            if (image.ExportWidth != null)
                htmlWriter.WriteAttributeString("width", image.ExportWidth.Value.ToString());

            htmlWriter.WriteEndElement();
        }
Beispiel #32
0
    protected void rptOpMenu_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
        {
            return;
        }

        OperationWithRoleAuth opAuth = (OperationWithRoleAuth)e.Item.DataItem;

        int    opId           = opAuth.OpId;
        string opSubject      = opAuth.OpSubject;
        string englishSubject = opAuth.EnglishSubject;
        bool   isNewWindow    = opAuth.IsNewWindow;
        string encodedUrl     = opAuth.LinkUrl;
        string linkUrl        = c.DecodeUrlOfMenu(encodedUrl);

        if (useEnglishSubject && !string.IsNullOrEmpty(englishSubject))
        {
            opSubject = englishSubject;
        }

        HtmlGenericControl OpHeaderArea = (HtmlGenericControl)e.Item.FindControl("OpHeaderArea");

        OpHeaderArea.Attributes.Add("opId", opId.ToString());

        HtmlAnchor btnOpHeader = (HtmlAnchor)e.Item.FindControl("btnOpHeader");

        btnOpHeader.Title = opSubject;

        if (isNewWindow)
        {
            btnOpHeader.Target = "_blank";
            btnOpHeader.Title += Resources.Lang.HintTail_OpenNewWindow;
        }

        if (linkUrl != "")
        {
            if (linkUrl.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) ||
                linkUrl.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
            {
                //外部網址
                if (!isNewWindow)
                {
                    linkUrl = "~/Embedded-Content.aspx?url=" + Server.UrlEncode(encodedUrl);
                }
            }
            else
            {
                linkUrl = "~/" + linkUrl;
            }

            btnOpHeader.HRef = linkUrl;
        }

        HtmlImage imgOpHeader = (HtmlImage)e.Item.FindControl("imgOpHeader");

        imgOpHeader.Alt = opSubject;
        imgOpHeader.Src = "~/BPimages/icon/data.gif";
        string iconImageFile = opAuth.IconImageFile;

        if (!string.IsNullOrEmpty(iconImageFile))
        {
            imgOpHeader.Src = string.Format("~/BPimages/icon/{0}", iconImageFile);
        }

        Literal ltrOpHeaderSubject = (Literal)e.Item.FindControl("ltrOpHeaderSubject");

        ltrOpHeaderSubject.Text = opSubject;

        if (opIdOfArticleMgmt != 0 && opId == opIdOfArticleMgmt)
        {
            string noticeIconOfHoverToExpand = "<span class='hover-intent-notice float-right' title='hover to expand' style='display:none;'><i class='fa fa-hand-o-up'></i><i class='fa fa-hourglass-start'></i></span>";
            ltrOpHeaderSubject.Text += noticeIconOfHoverToExpand;
        }

        //檢查授權
        bool canRead = opAuth.CanRead;

        OpHeaderArea.Visible = canRead;
        Repeater rptOpItems  = (Repeater)e.Item.FindControl("rptOpItems");
        Repeater rptArticles = (Repeater)e.Item.FindControl("rptArticles");

        if (opIdOfArticleMgmt != 0 && opId == opIdOfArticleMgmt)
        {
            // articles
            rptOpItems.Visible = false;

            List <ArticleMultiLangForOpMenu> subitems = GetSubitemsOfArticle(Guid.Empty);  //Guid.Empty: root articleId

            if (subitems != null)
            {
                rptArticles.Visible    = true;
                rptArticles.DataSource = subitems;
                rptArticles.DataBind();
            }
        }
        else
        {
            // sub-operations
            rptOpItems.DataSource = opAuth.SubItems;
            rptOpItems.DataBind();
        }
    }
Beispiel #33
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            btnNewAccount.Visible = !GetAttributeValue("HideNewAccount").AsBoolean();
            btnNewAccount.Text    = this.GetAttributeValue("NewAccountButtonText") ?? "Register";

            phExternalLogins.Controls.Clear();

            int activeAuthProviders = 0;

            var selectedGuids = new List <Guid>();

            GetAttributeValue("RemoteAuthorizationTypes").SplitDelimitedValues()
            .ToList()
            .ForEach(v => selectedGuids.Add(v.AsGuid()));

            // Look for active external authentication providers
            foreach (var serviceEntry in AuthenticationContainer.Instance.Components)
            {
                var component = serviceEntry.Value.Value;

                if (component.IsActive &&
                    component.RequiresRemoteAuthentication &&
                    selectedGuids.Contains(component.EntityType.Guid))
                {
                    string loginTypeName = component.GetType().Name;

                    // Check if returning from third-party authentication
                    if (!IsPostBack && component.IsReturningFromAuthentication(Request))
                    {
                        string userName           = string.Empty;
                        string returnUrl          = string.Empty;
                        string redirectUrlSetting = LinkedPageUrl("RedirectPage");
                        if (component.Authenticate(Request, out userName, out returnUrl))
                        {
                            if (!string.IsNullOrWhiteSpace(redirectUrlSetting))
                            {
                                LoginUser(userName, redirectUrlSetting, false);
                                break;
                            }
                            else
                            {
                                LoginUser(userName, returnUrl, false);
                                break;
                            }
                        }
                    }

                    activeAuthProviders++;

                    LinkButton lbLogin = new LinkButton();
                    phExternalLogins.Controls.Add(lbLogin);
                    lbLogin.AddCssClass("btn btn-authentication " + loginTypeName.ToLower());
                    lbLogin.ID               = "lb" + loginTypeName + "Login";
                    lbLogin.Click           += lbLogin_Click;
                    lbLogin.CausesValidation = false;

                    if (!string.IsNullOrWhiteSpace(component.ImageUrl()))
                    {
                        HtmlImage img = new HtmlImage();
                        lbLogin.Controls.Add(img);
                        img.Attributes.Add("style", "border:none");
                        img.Src = Page.ResolveUrl(component.ImageUrl());
                    }
                    else
                    {
                        lbLogin.Text = loginTypeName;
                    }
                }
            }

            // adjust the page if there are no social auth providers
            if (activeAuthProviders == 0)
            {
                divSocialLogin.Visible = false;
                divOrgLogin.RemoveCssClass("col-sm-6");
                divOrgLogin.AddCssClass("col-sm-12");
            }
        }
Beispiel #34
0
        private void dgJobsToBookIn_ItemContentCreated(object sender, GridItemContentCreatedEventArgs e)
        {
            try
            {
                int jobId = Convert.ToInt32(((HtmlInputHidden)e.Content.FindControl("hidJobId")).Value);

                if (jobId > 0)
                {
                    DataView dvJobRow = new DataView(m_dsJobsData.Tables[0]);
                    dvJobRow.RowFilter = "JobId = " + jobId.ToString();
                    eJobState jobState = (eJobState)Enum.Parse(typeof(eJobState), ((string)dvJobRow.Table.Rows[0]["JobState"]).Replace(" ", ""), true);

                    HtmlInputHidden hidJobState = (HtmlInputHidden)e.Content.FindControl("hidJobState");
                    HtmlInputHidden hidJobType  = (HtmlInputHidden)e.Content.FindControl("hidJobType");

                    if (hidJobState != null && hidJobType != null)
                    {
                        eJobType jobType = (eJobType)Enum.Parse(typeof(eJobType), ((string)dvJobRow.Table.Rows[0]["JobType"]).Replace(" ", ""), true);

                        GridServerTemplateContainer container = (GridServerTemplateContainer)e.Content;

                        if (jobState == eJobState.Booked || jobState == eJobState.Planned || jobState == eJobState.InProgress)
                        {
                            Facade.IJob facJob = new Facade.Job();
                            ((HtmlImage)e.Content.FindControl("imgRequiresCallIn")).Visible = facJob.RequiresCallIn(jobId);
                        }
                        else
                        {
                            ((HtmlImage)e.Content.FindControl("imgRequiresCallIn")).Visible = false;
                        }

                        HtmlImage imgHasRequests = (HtmlImage)e.Content.FindControl("imgHasRequests");
                        if (((int)dvJobRow[0]["Requests"]) == 0)
                        {
                            imgHasRequests.Visible = false;
                        }
                        else
                        {
                            imgHasRequests.Visible = true;
                            imgHasRequests.Attributes.Add("onClick", "javascript:ShowPlannerRequests('" + jobId.ToString() + "');");
                        }

                        HtmlAnchor lnkEditJob = (HtmlAnchor)e.Content.FindControl("lnkEditJob");
                        switch (jobType)
                        {
                        case eJobType.Normal:
                            lnkEditJob.HRef = "javascript:openResizableDialogWithScrollbars('../job/wizard/wizard.aspx?jobId=" + jobId.ToString() + "', '623', '508');";
                            break;

                        case eJobType.PalletReturn:
                            lnkEditJob.HRef = "../job/addupdatepalletreturnjob.aspx?jobId=" + jobId.ToString();
                            break;

                        case eJobType.Return:
                            lnkEditJob.HRef = "../job/addupdategoodsreturnjob.aspx?jobId=" + jobId.ToString();
                            break;

                        default:
                            lnkEditJob.Visible = false;
                            break;
                        }
                    }

                    Table tblCollections = (Table)e.Content.FindControl("tblCollections");
                    if (tblCollections != null)
                    {
                        tblCollections.BackColor = Utilities.GetJobStateColour(jobState);
                        DataView dvCollections = new DataView(m_dsJobsData.Tables[1]);
                        foreach (DataRow collection in dvCollections.Table.Rows)
                        {
                            if ((int)collection["JobId"] == jobId)
                            {
                                // This is a collection for the current job
                                ArrayList rows = CreateTableRows(collection);
                                foreach (TableRow row in rows)
                                {
                                    tblCollections.Rows.Add(row);
                                }
                            }
                        }
                    }

                    Table tblDeliveries = (Table)e.Content.FindControl("tblDeliveries");
                    if (tblDeliveries != null)
                    {
                        tblDeliveries.BackColor = Utilities.GetJobStateColour(jobState);
                        DataView dvDeliveries = new DataView(m_dsJobsData.Tables[2]);
                        foreach (DataRow delivery in dvDeliveries.Table.Rows)
                        {
                            if ((int)delivery["JobId"] == jobId)
                            {
                                // This is a delivery for the current job
                                ArrayList rows = CreateTableRows(delivery);
                                foreach (TableRow row in rows)
                                {
                                    tblDeliveries.Rows.Add(row);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                string error = exc.Message;
            }
        }
Beispiel #35
0
        public static void createSummaryReport(string uftWorkingFolder, ref List <ReportMetaData> reportList)
        {
            HtmlTable     table  = new HtmlTable();
            HtmlTableRow  header = new HtmlTableRow();
            HtmlTableCell h1     = new HtmlTableCell();

            h1.InnerText = "Test name";
            h1.Width     = "100";
            h1.Align     = "center";
            header.Cells.Add(h1);

            HtmlTableCell h2 = new HtmlTableCell();

            h2.InnerText = "Timestamp";
            h2.Width     = "150";
            h2.Align     = "center";
            header.Cells.Add(h2);

            HtmlTableCell h3 = new HtmlTableCell();

            h3.InnerText = "Status";
            h3.Width     = "50";
            h3.Align     = "center";
            header.Cells.Add(h3);

            /*HtmlTableCell h4 = new HtmlTableCell();
             * h4.InnerText = "HTML report";
             * h4.Width = "100";
             * h4.Align = "center";
             * header.Cells.Add(h4);*/

            header.BgColor = KnownColor.Azure.ToString();
            table.Rows.Add(header);

            //create table content
            foreach (ReportMetaData report in reportList)
            {
                HtmlTableRow row = new HtmlTableRow();

                HtmlTableCell cell1 = new HtmlTableCell();
                cell1.InnerText = getTestName(report.getDisplayName());
                cell1.Align     = "center";
                row.Cells.Add(cell1);

                HtmlTableCell cell2 = new HtmlTableCell();
                cell2.InnerText = report.getDateTime();
                cell2.Align     = "center";
                row.Cells.Add(cell2);

                HtmlTableCell cell3       = new HtmlTableCell();
                HtmlImage     statusImage = new HtmlImage();

                if (report.getStatus().Equals("pass"))
                {
                    statusImage.Src = "https://extensionado.blob.core.windows.net/uft-extension-images/passed.png";
                }
                else
                {
                    statusImage.Src = "https://extensionado.blob.core.windows.net/uft-extension-images/failed.png";
                }


                cell3.Align = "center";
                cell3.Controls.Add(statusImage);
                row.Cells.Add(cell3);

                /*HtmlTableCell cell4 = new HtmlTableCell();
                 * HtmlAnchor reportLink = new HtmlAnchor();
                 *
                 * reportLink.HRef = "C:\\Users\\laakso.CORPDOM\\TFS\\TFS_project\\UFTWorking\\res\\run_results.html"; //Path.GetFullPath(Resources.run_results);
                 * reportLink.InnerText = "report";
                 *
                 * cell4.Controls.Add(reportLink);
                 * cell4.Align = "center";
                 * row.Cells.Add(cell4);*/

                table.Rows.Add(row);
            }

            //add table to file
            string html;
            var    reportMessage = new System.Text.StringBuilder();

            using (var sw = new StringWriter())
            {
                table.RenderControl(new System.Web.UI.HtmlTextWriter(sw));
                html = sw.ToString();
            }

            reportMessage.AppendFormat(html);

            System.IO.File.WriteAllText(uftWorkingFolder + @"\res\UFT Report", reportMessage.ToString());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            getTaskName = Request.QueryString["taskname"];
            Response response = AmazonDynamoDBIdentityTable.Instance.GetAllDataInDynamoDb();
            List <IdentityDataModel> Identities = response.IdentityDataModel;

            if (null != Identities)
            {
                foreach (IdentityDataModel Identity in Identities)
                {
                    IdentityDataModel identity = Identity;
                    identity = AmazonDynamoDBIdentityTable.Instance.ConvertToTitleCase(identity);
                    var tr = new HtmlTableRow();
                    tr.ID = identity.Email;
                    HtmlTableCell      checkbox = new HtmlTableCell();
                    HtmlGenericControl element  = new HtmlGenericControl("input");
                    element.Attributes.Add("type", "checkbox");
                    element.Attributes.Add("name", "chkbox[]");
                    element.Attributes.Add("runat", "server");
                    element.Attributes.Add("id", identity.Email + "checkbox");
                    element.Attributes.Add("onchange", "checkAll(this,'" + identity.Email + "')");
                    checkbox.Controls.Add(element);
                    checkbox.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(checkbox);


                    HtmlTableCell name = new HtmlTableCell();
                    name.InnerText = identity.FirstName + " " + identity.LastName;
                    name.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(name);
                    HtmlTableCell email = new HtmlTableCell();
                    email.InnerText = identity.Email;
                    email.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(email);
                    HtmlTableCell country = new HtmlTableCell();
                    country.InnerText = identity.CountryOfResidence;
                    country.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(country);
                    HtmlTableCell assignedGame = new HtmlTableCell();
                    assignedGame.InnerText = "";
                    assignedGame.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(assignedGame);

                    HtmlAnchor _edit = new HtmlAnchor();
                    _edit.HRef = "#";
                    _edit.Attributes.CssStyle.Add("margin-left", "0px");
                    HtmlImage editimage = new HtmlImage();
                    editimage.Attributes.Add("src", "../Images/edit.png");
                    editimage.Attributes.CssStyle.Add("width", "15px");
                    _edit.Controls.Add(editimage);
                    _edit.Attributes.Add("onclick", "editCustomTaskValue('" + email.InnerText + "')");
                    _edit.Attributes.Add("id", "edit" + email.InnerText);
                    HtmlAnchor _delete = new HtmlAnchor();
                    _delete.HRef = "#";
                    _delete.Attributes.CssStyle.Add("margin-left", "30%");
                    HtmlImage deleteimage = new HtmlImage();
                    deleteimage.Attributes.Add("src", "../Images/delete.png");
                    deleteimage.Attributes.CssStyle.Add("width", "30px");
                    _delete.Attributes.Add("onclick", "deleteCustomTaskValue('" + email.InnerText + "')");
                    _delete.Attributes.Add("id", "delete" + email.InnerText);
                    _delete.Controls.Add(deleteimage);
                    HtmlTableCell actioncell = new HtmlTableCell();
                    actioncell.Controls.Add(_edit);
                    actioncell.Controls.Add(_delete);
                    actioncell.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(actioncell);

                    taskIdentities.Rows.Add(tr);
                    foreach (WebsiteDataModel website in identity.WebsiteDataModel)
                    {
                        var item = selectwebsite.Items.FindByText(website.WebsiteName);
                        if (null == item)
                        {
                            selectwebsite.Items.Add(website.WebsiteName);
                        }
                    }
                }

                if (null != getTaskName)
                {
                    response = AmazonDynamoDBTaskTable.Instance.GetDataInDynamoDb(getTaskName.ToLower());
                    if (null != (response.IdentityTaskData))
                    {
                        identityTaskData = response.IdentityTaskData.FirstOrDefault();
                        identityTaskData = AmazonDynamoDBTaskTable.Instance.ConvertToTitleCase(identityTaskData);
                        //find identity from azure table and render content in fields.
                        ListItem selectedtask = selecttask.Items.FindByText(identityTaskData.SelectTask);
                        selectedtask.Selected = true;
                        task_name.Value       = identityTaskData.TaskName;
                        section.Value         = identityTaskData.Section;
                        wageramount.Value     = identityTaskData.WagerAmount;
                        balancetarget.Value   = identityTaskData.BalanceTarget;
                        balancelimit.Value    = identityTaskData.BalanceLimit;
                        stoploss.Value        = identityTaskData.StopLoss;
                        ListItem Selectedwebsite = selectwebsite.Items.FindByText(identityTaskData.TaskWebsite);
                        if (null == Selectedwebsite)
                        {
                            selectwebsite.Items.Add(identityTaskData.TaskWebsite);
                            Selectedwebsite = selectwebsite.Items.FindByText(identityTaskData.TaskWebsite);
                        }

                        Selectedwebsite.Selected = true;
                        ListItem selectedBrowser = selectbrowser.Items.FindByText(identityTaskData.SelectBrowser);
                        selectedBrowser.Selected = true;
                        ListItem selectedMode = selectmode.Items.FindByText(identityTaskData.SelectMode);
                        selectedMode.Selected = true;
                        ListItem selectedBetSizeOption = betsizeoption.Items.FindByText(identityTaskData.BetSizeOption);
                        selectedBetSizeOption.Selected = true;
                        betsize.Value    = identityTaskData.BetSize;
                        maxbetsize.Value = identityTaskData.MaxBetSize;
                        List <string> selectedIdentities = new List <string>();
                        int           i = 0;
                        for (var j = 1; j < taskIdentities.Rows.Count; j++)
                        {
                            foreach (var identityEmail in identityTaskData.SelectedIdentities)
                            {
                                var row = taskIdentities.Rows[j];
                                if (row.ID == identityEmail)
                                {
                                    var htmlcontrol = row.Cells[0];
                                    //foreach ( HtmlTableCell item in row.Cells )
                                    //    {
                                    HtmlControl object1 = (HtmlControl)row.Cells[0].Controls[0];
                                    if (null != object1)
                                    {
                                        object1.Attributes.Add("checked", "checked");
                                        if (!(selectedIdentities.Contains(identityEmail)))
                                        {
                                            selectedIdentities.Add(identityEmail);
                                            i++;
                                            break;
                                        }
                                    }
                                    //}
                                }
                            }    //foreach 2nd
                        }
                        foreach (var identity in identityTaskData.SelectedGames)
                        {
                            if (identity != null && !(gamesContainer.InnerHtml.Contains(identity)))
                            {
                                gamesContainer.InnerHtml          += identity;
                                gamesContainer.InnerHtml          += "<br />";
                                gamesContainer.Style["visibility"] = "visible";
                            }
                        }
                        hiddenselectedIdentities.Value = string.Join(",", identityTaskData.SelectedIdentities);
                        hiddenselectedGames.Value      = string.Join(",", identityTaskData.SelectedGames);
                    }
                    Count = Identities.Count;

                    //taskcount.InnerText = (response.IdentityTaskData.Count).ToString();
                }
                countDiv.InnerText = DashBoard.Count.ToString();
            }
        }
Beispiel #37
0
        /// <summary>
        /// Get the following users
        /// </summary>
        /// <returns></returns>
        private Table GetFollowing(TwitterResponse <TwitterUserCollection> twitterUsers, TwitterResponse <TwitterStatusCollection> twitterStatus)
        {
            Table     insideTable;
            TableRow  tr = null;
            TableCell tc;

            insideTable             = new Table();
            insideTable.CellPadding = 0;
            insideTable.CellSpacing = 0;
            insideTable.Width       = Unit.Percentage(100);

            int r = 1;

            tr = new TableRow();

            if (twitterUsers.ResponseObject.Count > 0)
            {
                //Get the total number of followers
                int followersCount = Convert.ToInt32(twitterUsers.ResponseObject.Count);
                int c = 0;

                foreach (TwitterUser followingUsers in twitterUsers.ResponseObject)
                {
                    //Create a new row if Usercount limit exceeds
                    if (this.UsersColumnCount == c)
                    {
                        if (r < this.UsersRowCount)
                        {
                            tr = new TableRow();
                            r++;
                            c = 0;
                        }
                        else
                        {
                            break;
                        }
                    }

                    //Create a new cell
                    tc = new TableCell();
                    tc.Attributes.Add("valign", "top");

                    //create a new table in a cell
                    Table tb = new Table();
                    tb.Width = Unit.Percentage(100);

                    //Show Friend Image
                    HtmlImage imgFollower = new HtmlImage();
                    imgFollower.Src    = followingUsers.ProfileImageLocation.ToString();
                    imgFollower.Border = 0;

                    TableRow  tr1 = new TableRow();
                    TableCell tc1 = new TableCell();
                    tc1.CssClass = "alignCenter";


                    if (this.ShowImageAsLink)
                    {
                        HyperLink lnkFollower = new HyperLink();
                        lnkFollower.NavigateUrl = "http://twitter.com/" + followingUsers.ScreenName;
                        lnkFollower.Attributes.Add("target", "_blank");
                        lnkFollower.Controls.Add(imgFollower);
                        lnkFollower.ToolTip = followingUsers.Name;
                        tc1.Controls.Add(lnkFollower);
                        tc1.VerticalAlign = VerticalAlign.Top;
                        tc1.Width         = Unit.Percentage(100 / this.UsersColumnCount);
                    }
                    else
                    {
                        tc1.Controls.Add(imgFollower);
                    }

                    tr1.Controls.Add(tc1);
                    tb.Rows.Add(tr1);

                    //Show Follower Name
                    if (this.ShowFollowingScreenName)
                    {
                        Label lblFollower = new Label();

                        if (followingUsers.Name.IndexOf(" ") != -1)
                        {
                            lblFollower.Text = followingUsers.Name.Substring(0, followingUsers.Name.IndexOf(" "));      //Get the first name only to display
                        }
                        else
                        {
                            lblFollower.Text = followingUsers.Name;
                        }

                        lblFollower.Font.Size = FontUnit.XXSmall;
                        TableRow  tr2 = new TableRow();
                        TableCell tc2 = new TableCell();
                        tc2.CssClass = "alignCenter";
                        tc2.Width    = Unit.Percentage(100 / this.UsersColumnCount);
                        tc2.Controls.Add(lblFollower);
                        tr2.Controls.Add(tc2);
                        tb.Rows.Add(tr2);
                    }

                    tc.Controls.Add(tb);
                    tr.Cells.Add(tc);
                    insideTable.Rows.Add(tr);
                    c++;
                }
            }
            else
            {
                // If there are no Friends

                insideTable             = new Table();
                tr                      = new TableRow();
                tc                      = new TableCell();
                insideTable.Width       = Unit.Percentage(100);
                insideTable.CellPadding = 5;

                //display grey tweet image
                HtmlImage imgGreyTweet = new HtmlImage();
                imgGreyTweet.Src    = SPContext.Current.Web.Url + "/_layouts/Brickred.OpenSource.Twitter/Greytweet.png";
                imgGreyTweet.Border = 0;
                tc.Controls.Add(imgGreyTweet);
                tc.CssClass      = "alignCenter";
                tc.VerticalAlign = VerticalAlign.Middle;
                tr.Cells.Add(tc);
                insideTable.Rows.Add(tr);

                //display message
                tr = new TableRow();
                tc = new TableCell();
                Label lblScreenName = new Label();
                lblScreenName.Text      = "@" + twitterStatus.ResponseObject[0].User.Name;
                lblScreenName.Font.Size = FontUnit.Large;
                lblScreenName.ForeColor = Color.Gray;
                Label lblMessage = new Label();
                lblMessage.Text         = " is not following anyone yet.";
                lblMessage.ForeColor    = Color.Gray;
                lblScreenName.ForeColor = Color.Gray;
                tc.Controls.Add(lblScreenName);
                tc.Controls.Add(lblMessage);
                tc.CssClass = "alignCenter";
                tr.Cells.Add(tc);
                insideTable.Rows.Add(tr);
            }

            return(insideTable);
        }
Beispiel #38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["PhiPortalUserDB"].ConnectionString);

        con.Open();
        SqlCommand     cmd = new SqlCommand("SELECT * FROM GalleryImagePaths", con);
        SqlDataAdapter da  = new SqlDataAdapter(cmd);
        DataTable      dt  = new DataTable();

        da.Fill(dt);
        if (dt.Rows.Count == 0)
        {
            System.Diagnostics.Debug.WriteLine("ERROR: datatable not filled from GalleryImagePaths table in DB PhiPortalUserDB");
        }

        //Set the counter to 1
        int counter = 1;

        //Create a panel called pnlWrapper for the rows of images
        Panel pnlWrapper = new Panel();

        pnlWrapper.Attributes["class"] = "gal_wrapper";

        //Create four columns for the gallery
        Panel pnlImgCol1 = new Panel();

        pnlImgCol1.Attributes["class"] = "gal_column col-3";
        Panel pnlImgCol2 = new Panel();

        pnlImgCol2.Attributes["class"] = "gal_column col-3";
        Panel pnlImgCol3 = new Panel();

        pnlImgCol3.Attributes["class"] = "gal_column col-3";
        Panel pnlImgCol4 = new Panel();

        pnlImgCol4.Attributes["class"] = "gal_column col-3";

        //Create an image object called imgGalleryImage
        HtmlImage imgGalleryImage;

        foreach (DataRow imageInfo in dt.Rows)
        {
            string fileName = imageInfo[1].ToString();

            string idName = imageInfo[1].ToString();
            idName = idName.Substring(0, idName.IndexOf('.'));

            if (counter % 4 == 1)
            {
                imgGalleryImage = new HtmlImage();
                imgGalleryImage.Attributes["id"]      = idName;
                imgGalleryImage.Attributes["class"]   = "modal_img";
                imgGalleryImage.Attributes["onclick"] = "return img_click('" + idName + "')";
                imgGalleryImage.Attributes["src"]     = "http://127.0.0.1:8887/Gallery/" + fileName;
                imgGalleryImage.Attributes["alt"]     = imageInfo[2].ToString();
                pnlImgCol1.Controls.Add(imgGalleryImage);
            }
            else if (counter % 4 == 2)
            {
                imgGalleryImage = new HtmlImage();
                imgGalleryImage.Attributes["id"]      = idName;
                imgGalleryImage.Attributes["class"]   = "modal_img";
                imgGalleryImage.Attributes["onclick"] = "return img_click('" + idName + "')";
                imgGalleryImage.Attributes["src"]     = "http://127.0.0.1:8887/Gallery/" + fileName;
                imgGalleryImage.Attributes["alt"]     = imageInfo[2].ToString();
                pnlImgCol2.Controls.Add(imgGalleryImage);
            }
            else if (counter % 4 == 3)
            {
                imgGalleryImage = new HtmlImage();
                imgGalleryImage.Attributes["id"]      = idName;
                imgGalleryImage.Attributes["class"]   = "modal_img";
                imgGalleryImage.Attributes["onclick"] = "return img_click('" + idName + "')";
                imgGalleryImage.Attributes["src"]     = "http://127.0.0.1:8887/Gallery/" + fileName;
                imgGalleryImage.Attributes["alt"]     = imageInfo[2].ToString();
                pnlImgCol3.Controls.Add(imgGalleryImage);
            }
            else
            {
                imgGalleryImage = new HtmlImage();
                imgGalleryImage.Attributes["id"]      = idName;
                imgGalleryImage.Attributes["class"]   = "modal_img";
                imgGalleryImage.Attributes["onclick"] = "return img_click('" + idName + "')";
                imgGalleryImage.Attributes["src"]     = "http://127.0.0.1:8887/Gallery/" + fileName;
                imgGalleryImage.Attributes["alt"]     = imageInfo[2].ToString();
                pnlImgCol4.Controls.Add(imgGalleryImage);
            }

            counter++;
        }
        pnlWrapper.Controls.Add(pnlImgCol1);
        pnlWrapper.Controls.Add(pnlImgCol2);
        pnlWrapper.Controls.Add(pnlImgCol3);
        pnlWrapper.Controls.Add(pnlImgCol4);

        plhGallery.Controls.Add(pnlWrapper);
        con.Close();
    }
Beispiel #39
0
        public void Draw(SpriteBatchUI sb, Rectangle destRectangle, int xScroll, int yScroll, Vector3?hueVector = null)
        {
            if (Text == null)
            {
                return;
            }

            Rectangle sourceRectangle;

            if (xScroll > Width)
            {
                return;
            }
            else if (xScroll < -MaxWidth)
            {
                return;
            }
            else
            {
                sourceRectangle.X = xScroll;
            }

            if (yScroll > Height)
            {
                return;
            }
            else if (yScroll < -Height)
            {
                return;
            }
            else
            {
                sourceRectangle.Y = yScroll;
            }

            int maxX = sourceRectangle.X + destRectangle.Width;

            if (maxX <= Width)
            {
                sourceRectangle.Width = destRectangle.Width;
            }
            else
            {
                sourceRectangle.Width = Width - sourceRectangle.X;
                destRectangle.Width   = sourceRectangle.Width;
            }

            int maxY = sourceRectangle.Y + destRectangle.Height;

            if (maxY <= Height)
            {
                sourceRectangle.Height = destRectangle.Height;
            }
            else
            {
                sourceRectangle.Height = Height - sourceRectangle.Y;
                destRectangle.Height   = sourceRectangle.Height;
            }

            sb.Draw2D(m_Document.Texture, destRectangle, sourceRectangle, hueVector.HasValue ? hueVector.Value : Vector3.Zero);

            for (int i = 0; i < m_Document.Links.Count; i++)
            {
                HtmlLink  link = m_Document.Links[i];
                Point     position;
                Rectangle sourceRect;
                if (ClipRectangle(new Point(xScroll, yScroll), link.Area, destRectangle, out position, out sourceRect))
                {
                    // only draw the font in a different color if this is a HREF region.
                    // otherwise it is a dummy region used to notify images that they are
                    // being mouse overed.
                    if (link.HREF != null)
                    {
                        int linkHue = 0;
                        if (link.Index == MouseOverRegionID)
                        {
                            if (IsMouseDown)
                            {
                                linkHue = link.Style.ActiveColorHue;
                            }
                            else
                            {
                                linkHue = link.Style.HoverColorHue;
                            }
                        }
                        else
                        {
                            linkHue = link.Style.ColorHue;
                        }

                        sb.Draw2D(m_Document.Texture, new Vector3(position.X, position.Y, 0),
                                  sourceRect, Utility.GetHueVector(linkHue));
                    }
                }
            }

            for (int i = 0; i < m_Document.Images.Count; i++)
            {
                HtmlImage image = m_Document.Images[i];
                Point     position;
                Rectangle sourceRect;
                if (ClipRectangle(new Point(xScroll, yScroll), image.Area, destRectangle, out position, out sourceRect))
                {
                    Rectangle srcImage = new Rectangle(
                        sourceRect.X - image.Area.X, sourceRect.Y - image.Area.Y,
                        sourceRect.Width, sourceRect.Height);
                    Texture2D texture = null;

                    // is the mouse over this image?
                    if (image.LinkIndex != -1 && image.LinkIndex == MouseOverRegionID)
                    {
                        if (IsMouseDown)
                        {
                            texture = image.TextureDown;
                        }
                        if (texture == null)
                        {
                            texture = image.TextureOver;
                        }
                        if (texture == null)
                        {
                            texture = image.Texture;
                        }
                    }

                    if (texture == null)
                    {
                        texture = image.Texture;
                    }

                    if (srcImage.Width > texture.Width)
                    {
                        srcImage.Width = texture.Width;
                    }
                    if (srcImage.Height > texture.Height)
                    {
                        srcImage.Height = texture.Height;
                    }

                    sb.Draw2D(texture, new Vector3(position.X, position.Y, 0),
                              srcImage, Utility.GetHueVector(0, false, false, true));
                }
            }
        }
Beispiel #40
0
        // Changed for Ref:Task no:85
        private TableRow GenerateSubRows(DataRow dr, string PharmacyId, string PharmacyName, string Active, string Address, string Phone, string Fax, string SureScriptsIdentifier, string PreferredPharmacy, string tableId, ref string myscript, bool IsSearchPage, string City, string State, string Zip, string Specialty, Int32 rowCount)
        {
            try
            {
                CommonFunctions.Event_Trap(this);
                string newId = System.Guid.NewGuid().ToString();
                string tblId = this.ClientID + this.ClientIDSeparator + tableId;

                TableRow tblRow = new TableRow();
                tblRow.ID = "Tr_" + newId;
                TableCell tdPharmacyId = new TableCell();
                tdPharmacyId.Text = PharmacyId.ToString();

                TableCell tdActive = new TableCell();
                tdActive.Text = Active;
                //Added By Priya to add new Field for Pharmacy Search Page Date 15th Feb 2010
                TableCell tdPreferredPharmacy     = new TableCell();
                TableCell tdSureScriptsIdentifier = new TableCell();
                if (IsSearchPage)
                {
                    tdPreferredPharmacy.Text     = PreferredPharmacy.ToString();
                    tdSureScriptsIdentifier.Text = SureScriptsIdentifier.ToString();
                }

                TableCell tdPharmacyName = new TableCell();
                tdPharmacyName.Text = PharmacyName;

                TableCell tdAddress = new TableCell();
                tdAddress.Text = Address;

                TableCell tdCity = new TableCell();
                tdCity.Text = City;

                TableCell tdState = new TableCell();
                tdState.Text = State;

                TableCell tdZip = new TableCell();
                tdZip.Text = Zip;

                TableCell tdPhone = new TableCell();
                tdPhone.Text = Phone;

                TableCell tdFax = new TableCell();
                tdFax.Text = Fax;

                TableCell tdSpecialty = new TableCell();
                tdSpecialty.Text = Specialty;

                string Faxno = Fax;
                string pharmacynameaddress = PharmacyName + ',' + Address;
                pharmacynameaddress = pharmacynameaddress.Replace("'", "~");
                string    GetActive     = Active;
                TableCell tdRadioButton = new TableCell();
                string    rowId         = this.ClientID + this.ClientIDSeparator + tblRow.ClientID;

                HtmlInputRadioButton rbTemp = new HtmlInputRadioButton();
                if (dr != null)
                {
                    rbTemp.Attributes.Add("PharmacyId", dr["PharmacyId"].ToString());
                    rbTemp.ID = "Rb_" + PharmacyId.ToString();
                    //rbTemp.Checked = true;
                    if (IsSearchPage)
                    {
                        rbTemp.Checked = false;
                    }
                    tdRadioButton.Controls.Add(rbTemp);
                    if (!IsSearchPage)
                    {
                        myscript += "var Radiocontext" + PharmacyId + "={PharmacyId:" + PharmacyId + ",TableId:'" + tblId + "',RowId:'" + rowId + "'};";
                        myscript += "var RadioclickCallback" + PharmacyId + " =";
                        myscript += " Function.createCallback(" + this._onRadioClickEventHandler + ", Radiocontext" + PharmacyId + ");";
                        myscript += "$addHandler($get('" + this.ClientID + this.ClientIDSeparator + rbTemp.ClientID + "'), 'click', RadioclickCallback" + PharmacyId + ");";
                    }
                    else
                    {
                        myscript += "var Radiocontext" + PharmacyId + "={PharmacyId:" + PharmacyId + ",TableId:'" + tblId + "',RowId:'" + rowId + "',FaxNo:'" + Faxno + "',Active:'" + GetActive + "',PharmacyName:'" + pharmacynameaddress + "',ExternalReferenceId:'" + Convert.ToString(dr["ExternalReferenceId"]) + "',SureScriptsPharmacyIdentifier:'" + Convert.ToString(dr["SureScriptsPharmacyIdentifier"]) + "'};";
                        myscript += "var RadioclickCallback" + PharmacyId + " =";
                        myscript += " Function.createCallback(" + this._onRadioClickForSearchEventHandler + ", Radiocontext" + PharmacyId + ");";
                        myscript += "$addHandler($get('" + this.ClientID + this.ClientIDSeparator + rbTemp.ClientID + "'), 'click', RadioclickCallback" + PharmacyId + ");";
                    }
                }
                else
                {
                    Label lblRadio = new Label();
                    tdRadioButton.Controls.Add(lblRadio);
                }


                TableCell tdDelete = new TableCell();
                TableCell tdEmpty  = new TableCell();
                if (dr != null)
                {
                    HtmlImage imgTemp = new HtmlImage();
                    imgTemp.ID = "Img_" + PharmacyId.ToString();


                    imgTemp.Attributes.Add("PharmacyId", dr["PharmacyId"].ToString());
                    imgTemp.Src = "~/App_Themes/Includes/Images/deleteIcon.gif";
                    imgTemp.Attributes.Add("class", "handStyle");
                    tdDelete.Controls.Add(imgTemp);
                    //Modified the condition in ref to Task#3215 Delete icon only available if SurescriptsIdentifier is null.
                    //if (!IsSearchPage && SureScriptsIdentifier == "")//Comented by Pradeep as per task#3346 on 17 march 2011
                    //{
                    myscript += "var Imagecontext" + PharmacyId + "={PharmacyId:" + PharmacyId + ",TableId:'" + tblId + "',RowId:'" + rowId + "'};";
                    myscript += "var ImageclickCallback" + PharmacyId + " =";
                    myscript += " Function.createCallback($deleteRecord, Imagecontext" + PharmacyId + ");";
                    myscript += "$addHandler($get('" + this.ClientID + this.ClientIDSeparator + imgTemp.ClientID + "'), 'click', ImageclickCallback" + PharmacyId + ");";
                    //}
                }
                tblRow.Cells.Add(tdRadioButton);
                //Modified the condition in ref to Task#3215 Delete icon only available if SurescriptsIdentifier is null.
                #region --Code comented by Pradeep as per task#3346 on 17 March 2011
                //if (!IsSearchPage && SureScriptsIdentifier == "")
                //    tblRow.Cells.Add(tdDelete);
                //else
                //    tblRow.Cells.Add(tdEmpty);
                tblRow.Cells.Add(tdDelete);
                #endregion
                tblRow.Cells.Add(tdPharmacyId);
                tblRow.Cells.Add(tdActive);
                //Added By Priya
                if (IsSearchPage)
                {
                    tblRow.Cells.Add(tdPreferredPharmacy);
                }

                tblRow.Cells.Add(tdPharmacyName);
                tblRow.Cells.Add(tdAddress);
                tblRow.Cells.Add(tdCity);
                tblRow.Cells.Add(tdState);
                tblRow.Cells.Add(tdZip);
                tblRow.Cells.Add(tdPhone);
                tblRow.Cells.Add(tdFax);
                tblRow.Cells.Add(tdSpecialty);
                //Added By Priya
                if (IsSearchPage)
                {
                    tblRow.Cells.Add(tdSureScriptsIdentifier);
                }

                if (rowCount % 2 == 0)
                {
                    tblRow.CssClass = "GridViewRowStyle ListPageHLRow ListPageAltRow";
                }
                else
                {
                    tblRow.CssClass = "GridViewRowStyle ListPageHLRow";
                }
                return(tblRow);
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }
                else
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }
                if (ex.Data["DatasetInfo"] == null)
                {
                    ex.Data["DatasetInfo"] = null;
                }
                throw (ex);
            }
        }
        protected override void AttachChildControls()
        {
            string activityId = "";
            string str2       = Globals.RequestQueryStr("Pid");

            if (string.IsNullOrEmpty(str2))
            {
                base.GotoResourceNotFound("");
            }
            OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, str2, "");

            if (info == null)
            {
                base.GotoResourceNotFound("");
            }
            activityId = info.ActivityId;
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(activityId);

            if (oneyuanTaoInfoById == null)
            {
                base.GotoResourceNotFound("");
            }
            this.litProdcutName      = (Literal)this.FindControl("litProdcutName");
            this.litProdcutAttr      = (Literal)this.FindControl("litProdcutAttr");
            this.litActivityID       = (Literal)this.FindControl("litActivityID");
            this.litReachType        = (Literal)this.FindControl("litReachType");
            this.litPrice            = (Literal)this.FindControl("litPrice");
            this.litBuyNum           = (Literal)this.FindControl("litBuyNum");
            this.litPayPrice         = (Literal)this.FindControl("litPayPrice");
            this.ProductImg          = (HtmlImage)this.FindControl("ProductImg");
            this.PayWaytxt           = (HtmlContainerControl)this.FindControl("PayWaytxt");
            this.PayBtn              = (HtmlContainerControl)this.FindControl("PayBtn");
            this.litProdcutName.Text = oneyuanTaoInfoById.ProductTitle;
            this.litProdcutAttr.Text = info.SkuIdStr;
            this.litActivityID.Text  = activityId;
            this.litReachType.Text   = "";
            this.litPrice.Text       = oneyuanTaoInfoById.EachPrice.ToString("F2");
            this.litBuyNum.Text      = info.BuyNum.ToString();
            this.litPayPrice.Text    = info.TotalPrice.ToString("F2");
            this.ProductImg.Src      = oneyuanTaoInfoById.ProductImg;
            if (oneyuanTaoInfoById.ReachType == 1)
            {
                this.litReachType.Text = "满足参与人数自动开奖";
            }
            else if (oneyuanTaoInfoById.ReachType == 2)
            {
                this.litReachType.Text = "活动到期自动开奖";
            }
            else
            {
                this.litReachType.Text = "活动到期时且满足参与人数自动开奖";
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       str3           = "商家尚未开启网上支付功能!";

            this.PayBtn.Visible = false;
            if (!this.Page.Request.UserAgent.ToLower().Contains("micromessenger") && masterSettings.EnableAlipayRequest)
            {
                str3 = "支付宝手机支付";
                this.PayBtn.Visible = true;
            }
            else if (masterSettings.EnableWeiXinRequest && this.Page.Request.UserAgent.ToLower().Contains("micromessenger"))
            {
                str3 = "微信支付";
                this.PayBtn.Visible = true;
            }
            this.PayWaytxt.InnerText = "当前可用支付方式:" + str3;
            this.PayWaytxt.Attributes.Add("Pid", str2);
            PageTitle.AddSiteNameTitle("结算支付");
        }
        /// <summary>
        /// ItemDataBound
        /// </summary>
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string        img, alt, publishedTask;
                HtmlTableRow  tr  = (HtmlTableRow)e.Item.FindControl("trList");
                HtmlInputText txt = null;
                if (e.Item.ItemIndex % 2 == 0)
                {
                    tr.Attributes.Add("class", "even");
                }
                else
                {
                    tr.Attributes.Add("class", "old");
                }

                try
                {
                    PNK_FengShui data = (PNK_FengShui)e.Item.DataItem;

                    //Role
                    Literal ltr = null;
                    ltr      = (Literal)e.Item.FindControl("ltrchk");
                    ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >",
                                             e.Item.ItemIndex, data.Id);

                    //ltrNewsCategory
                    ltr = (Literal)e.Item.FindControl("ltrNewsCategory");


                    //image
                    if (data.Published == "1")
                    {
                        img           = "tick.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "unpublish";
                    }
                    else
                    {
                        img           = "publish_x.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "publish";
                    }

                    //Order
                    txt       = (HtmlInputText)e.Item.FindControl("txtOrder");
                    txt.Value = DBConvert.ParseString(data.Ordering);

                    //Id
                    HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId");
                    btId.Value = DBConvert.ParseString(data.Id);

                    //Base img
                    HtmlImage Image = (HtmlImage)e.Item.FindControl("Image");
                    Image.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["FengShuiUpload"], data.Image);
                    HtmlAnchor hypImage = (HtmlAnchor)e.Item.FindControl("hypImage");

                    //set link
                    HyperLink hdflink = new HyperLink();
                    hdflink       = (HyperLink)e.Item.FindControl("hdflink");
                    hypImage.HRef = hdflink.NavigateUrl = template_path + LinkHelper.GetAdminLink("edit_fengshui", data.Id);
                    ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish");
                    imgctr.ImageUrl = string.Format("/Admin/images/{0}", img);
                    imgctr.Attributes.Add("alt", alt);
                    HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn");
                    btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask));

                    //Name
                    ltr            = (Literal)e.Item.FindControl("ltrName");
                    hypImage.Title = ltr.Text = data.FengShuiDesc.Title;
                }
                catch { }
            }
        }
Beispiel #43
0
    protected void rptOpItems_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
        {
            return;
        }

        OperationWithRoleAuth opAuth = (OperationWithRoleAuth)e.Item.DataItem;

        int    opId           = opAuth.OpId;
        string opSubject      = opAuth.OpSubject;
        string englishSubject = opAuth.EnglishSubject;
        bool   isNewWindow    = opAuth.IsNewWindow;
        string encodedUrl     = opAuth.LinkUrl;
        string linkUrl        = c.DecodeUrlOfMenu(encodedUrl);

        if (useEnglishSubject && !string.IsNullOrEmpty(englishSubject))
        {
            opSubject = englishSubject;
        }

        HtmlGenericControl OpItemArea = (HtmlGenericControl)e.Item.FindControl("OpItemArea");

        OpItemArea.Attributes.Add("opId", opId.ToString());

        HtmlAnchor btnOpItem = (HtmlAnchor)e.Item.FindControl("btnOpItem");

        btnOpItem.Title = opSubject;

        if (isNewWindow)
        {
            btnOpItem.Target = "_blank";
            btnOpItem.Title += Resources.Lang.HintTail_OpenNewWindow;
        }

        if (linkUrl != "")
        {
            if (linkUrl.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) ||
                linkUrl.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))
            {
                //外部網址
                if (!isNewWindow)
                {
                    linkUrl = "~/Embedded-Content.aspx?url=" + Server.UrlEncode(encodedUrl);
                }
            }
            else
            {
                linkUrl = "~/" + linkUrl;
            }

            btnOpItem.HRef = linkUrl;
        }

        HtmlImage imgOpItem = (HtmlImage)e.Item.FindControl("imgOpItem");

        imgOpItem.Alt = opSubject;
        imgOpItem.Src = "~/BPimages/icon/data.gif";
        string iconImageFile = opAuth.IconImageFile;

        if (!string.IsNullOrEmpty(iconImageFile))
        {
            imgOpItem.Src = string.Format("~/BPimages/icon/{0}", iconImageFile);
        }

        Literal ltrOpItemSubject = (Literal)e.Item.FindControl("ltrOpItemSubject");

        ltrOpItemSubject.Text = opSubject;

        //檢查授權
        bool canRead = opAuth.CanRead;

        OpItemArea.Visible = canRead;
    }
Beispiel #44
0
 /// <summary>
 /// Select image in dropdown list and sets appropriate preview.
 /// </summary>
 /// <param name="list">
 /// DropDownList where to search.
 /// </param>
 /// <param name="preview">
 /// Preview image.
 /// </param>
 /// <param name="imageURL">
 /// URL to search for.
 /// </param>
 private void SelectImage([NotNull] DropDownList list, [NotNull] HtmlImage preview, [NotNull] object imageURL)
 {
     this.SelectImage(list, preview, imageURL.ToString());
 }
        private void chargeData()
        {
            albums = daoAlbum.obtenerTodos();
            HtmlGenericControl div;
            HtmlImage          image;
            HtmlGenericControl h4;
            HtmlGenericControl span;
            HtmlAnchor         buttonEdit;
            HtmlAnchor         buttonDelete;
            HtmlGenericControl iControl;

            for (int i = 0; i < albums.Count; i++)
            {
                div    = new HtmlGenericControl("DIV");
                div.ID = "card" + albums[i].idAlbum;
                div.Attributes["class"] = "card";

                image     = new HtmlImage();
                image.Src = "../../Recursos/Imagenes/Portadas/" + albums[i].Portada;
                div.Controls.Add(image);

                h4           = new HtmlGenericControl("H4");
                h4.InnerText = albums[i].Titulo;
                div.Controls.Add(h4);

                canciones = daoCancion.MostrarCancionesPorAlbum(albums[i].idAlbum);

                for (int j = 0; j < canciones.Count; j++)
                {
                    span           = new HtmlGenericControl("SPAN");
                    span.InnerText = canciones[j].Nombre;
                    div.Controls.Add(span);
                }

                buttonEdit                             = new HtmlAnchor();
                buttonEdit.ID                          = "btnEdit" + albums[i].idAlbum;
                buttonEdit.ServerClick                += new System.EventHandler(this.buttonsCard_click);
                buttonEdit.Attributes["runat"]         = "server";
                buttonEdit.Attributes["onserverclick"] = "buttonsCard_click";
                buttonEdit.Attributes["class"]         = "edit";

                iControl = new HtmlGenericControl("I");
                iControl.Attributes["class"] = "material-icons";
                iControl.InnerText           = "create";
                buttonEdit.Controls.Add(iControl);
                div.Controls.Add(buttonEdit);

                buttonDelete                             = new HtmlAnchor();
                buttonDelete.ServerClick                += new System.EventHandler(this.buttonsCard_click);
                buttonDelete.ID                          = "btnDelete" + albums[i].idAlbum;
                buttonDelete.Attributes["runat"]         = "server";
                buttonDelete.Attributes["onserverclick"] = "buttonsCard_click";
                buttonDelete.Attributes["class"]         = "delete";

                iControl = new HtmlGenericControl("I");
                iControl.Attributes["class"] = "material-icons";
                iControl.InnerText           = "delete";
                buttonDelete.Controls.Add(iControl);
                div.Controls.Add(buttonDelete);

                albumContainer.Controls.Add(div);
            }
        }
Beispiel #46
0
        public void CreateCompareTable()
        {
            this.tblCompareProducts.Rows.Clear();
            this.tblCompareProducts.Width = "100%";
            ProductCollection compareProducts = ProductManager.GetCompareProducts();

            if (compareProducts.Count > 0)
            {
                HtmlTableRow headerRow = new HtmlTableRow();
                this.AddCell(headerRow, "&nbsp;");
                HtmlTableRow productNameRow = new HtmlTableRow();
                this.AddCell(productNameRow, "&nbsp;");
                HtmlTableRow  priceRow = new HtmlTableRow();
                HtmlTableCell cell     = new HtmlTableCell();
                cell.InnerText = GetLocaleResourceString("Products.CompareProductsPrice");
                cell.Align     = "center";
                priceRow.Cells.Add(cell);

                List <int> allAttributeIDs = new List <int>();
                foreach (Product product in compareProducts)
                {
                    ProductSpecificationAttributeCollection productSpecificationAttributes = SpecificationAttributeManager.GetProductSpecificationAttributesByProductID(product.ProductID, null, true);
                    foreach (ProductSpecificationAttribute attribute in productSpecificationAttributes)
                    {
                        if (!allAttributeIDs.Contains(attribute.SpecificationAttributeOptionID))
                        {
                            allAttributeIDs.Add(attribute.SpecificationAttributeOptionID);
                        }
                    }
                }

                foreach (Product product in compareProducts)
                {
                    HtmlTableCell      headerCell        = new HtmlTableCell();
                    HtmlGenericControl headerCellDiv     = new HtmlGenericControl("div");
                    Button             btnRemoveFromList = new Button();
                    btnRemoveFromList.ToolTip          = GetLocaleResourceString("Products.CompareProductsRemoveFromList");
                    btnRemoveFromList.Text             = GetLocaleResourceString("Products.CompareProductsRemoveFromList");
                    btnRemoveFromList.CommandName      = "Remove";
                    btnRemoveFromList.Command         += new CommandEventHandler(this.btnRemoveFromList_Command);
                    btnRemoveFromList.CommandArgument  = product.ProductID.ToString();
                    btnRemoveFromList.CausesValidation = false;
                    btnRemoveFromList.CssClass         = "removeButton";
                    btnRemoveFromList.ID = "btnRemoveFromList" + product.ProductID.ToString();
                    headerCellDiv.Controls.Add(btnRemoveFromList);

                    HtmlGenericControl productImagePanel = new HtmlGenericControl("p");
                    productImagePanel.Attributes.Add("align", "center");

                    HtmlImage productImage = new HtmlImage();
                    productImage.Border = 0;
                    //productImage.Align = "center";
                    productImage.Alt = "Product image";
                    ProductPictureCollection productPictures = product.ProductPictures;
                    if (productPictures.Count > 0)
                    {
                        productImage.Src = PictureManager.GetPictureUrl(productPictures[0].Picture, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125), true);
                    }
                    else
                    {
                        productImage.Src = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125));
                    }
                    productImagePanel.Controls.Add(productImage);

                    headerCellDiv.Controls.Add(productImagePanel);



                    headerCell.Controls.Add(headerCellDiv);
                    headerRow.Cells.Add(headerCell);
                    HtmlTableCell productNameCell = new HtmlTableCell();
                    HyperLink     productLink     = new HyperLink();
                    productLink.Text        = Server.HtmlEncode(product.Name);
                    productLink.NavigateUrl = SEOHelper.GetProductURL(product);
                    productLink.Attributes.Add("class", "link");
                    productNameCell.Align = "center";
                    productNameCell.Controls.Add(productLink);
                    productNameRow.Cells.Add(productNameCell);
                    HtmlTableCell priceCell = new HtmlTableCell();
                    priceCell.Align = "center";
                    ProductVariantCollection productVariantCollection = product.ProductVariants;
                    if (productVariantCollection.Count > 0)
                    {
                        ProductVariant productVariant = productVariantCollection[0];

                        //decimal oldPrice = productVariant.OldPrice;
                        //decimal oldPriceConverted = CurrencyManager.ConvertCurrency(oldPrice, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                        decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                        decimal finalPriceWithoutDiscount     = CurrencyManager.ConvertCurrency(finalPriceWithoutDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                        priceCell.InnerText = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                    }
                    priceRow.Cells.Add(priceCell);
                }
                productNameRow.Attributes.Add("class", "productName");
                priceRow.Attributes.Add("class", "productPrice");
                this.tblCompareProducts.Rows.Add(headerRow);
                this.tblCompareProducts.Rows.Add(productNameRow);
                this.tblCompareProducts.Rows.Add(priceRow);

                if (allAttributeIDs.Count > 0)
                {
                    foreach (int specificationAttributeID in allAttributeIDs)
                    {
                        //SpecificationAttribute attribute = SpecificationAttributeManager.GetSpecificationAttributeByID(specificationAttributeID);
                        SpecificationAttributeOption attributeOption = SpecificationAttributeManager.GetSpecificationAttributeOptionByID(specificationAttributeID);
                        HtmlTableRow productRow = new HtmlTableRow();
                        this.AddCell(productRow, Server.HtmlEncode(attributeOption.SpecificationAttribute.Name)).Align = "left";

                        foreach (Product product2 in compareProducts)
                        {
                            HtmlTableCell productCell = new HtmlTableCell();
                            {
                                ProductSpecificationAttributeCollection productSpecificationAttributes2 = SpecificationAttributeManager.GetProductSpecificationAttributesByProductID(product2.ProductID, null, true);
                                foreach (ProductSpecificationAttribute attribute2 in productSpecificationAttributes2)
                                {
                                    if (attributeOption.SpecificationAttributeOptionID == attribute2.SpecificationAttributeOptionID)
                                    {
                                        productCell.InnerHtml = (!String.IsNullOrEmpty(attribute2.SpecificationAttributeOption.Name)) ? Server.HtmlEncode(attribute2.SpecificationAttributeOption.Name) : "&nbsp;";
                                    }
                                }
                            }
                            productCell.Align  = "center";
                            productCell.VAlign = "top";
                            productRow.Cells.Add(productCell);
                        }
                        this.tblCompareProducts.Rows.Add(productRow);
                    }
                }
                string width = Math.Round((decimal)(90M / compareProducts.Count), 0).ToString() + "%";
                for (int i = 0; i < this.tblCompareProducts.Rows.Count; i++)
                {
                    HtmlTableRow row = this.tblCompareProducts.Rows[i];
                    for (int j = 1; j < row.Cells.Count; j++)
                    {
                        if (j == (row.Cells.Count - 1))
                        {
                            row.Cells[j].Style.Add("width", width);
                            row.Cells[j].Style.Add("text-align", "center");
                        }
                        else
                        {
                            row.Cells[j].Style.Add("width", width);
                            row.Cells[j].Style.Add("text-align", "center");
                        }
                    }
                }
            }
            else
            {
                btnClearCompareProductsList.Visible = false;
                tblCompareProducts.Visible          = false;
            }
        }
Beispiel #47
0
    private void LoadDanhMuc(int NhomChaID, int loaddm)
    {
        loaddm++;
        string sign = "";
        switch (loaddm)
        {
            case 1:
                sign = "";
                break;
            case 2:
                sign = "++";
                break;
            case 3:
                sign = "-----";
                break;
            case 4:
                sign = "........";
                break;
        }
        try
        {
            NhomSanPham nhomsanpham = new NhomSanPham();
            DataSet ds = nhomsanpham.SelectNhomSanPhamByNhomChaID(NhomChaID);
            ds.Tables[0].DefaultView.Sort = "SapXep ASC";

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //if (dr["NhomChaID"].ToString() == "" || dr["NhomChaID"].ToString() == "0")
                    //{
                    HtmlTableRow tbr = new HtmlTableRow();
                    tbr.Style.Add("padding-left", (loaddm*15) + "px");
                    HtmlTableCell tbc1 = new HtmlTableCell();
                    HtmlTableCell tbc2 = new HtmlTableCell();
                    //image cells
                    HtmlTableCell tbc3 = new HtmlTableCell();
                    HtmlTableCell tbc4 = new HtmlTableCell();
                    HtmlTableCell tbc5 = new HtmlTableCell();

                    //tbc1.Style.Add("width", "1px");
                    tbc2.InnerText = sign + " " + dr["SapXep"] + "." + dr["TenNhomSanPham"];
                    tbc2.ColSpan = 2;
                    tbc3.Style.Add("width", "16px");
                    tbc4.Style.Add("width", "16px");
                    tbc5.Style.Add("width", "16px");
                    tbc3.Style.Add("padding", "0");
                    tbc3.Style.Add("margin", "0");
                    tbc3.Style.Add("cursor", "hand");
                    tbc4.Style.Add("padding", "0");
                    tbc4.Style.Add("margin", "0");
                    tbc4.Style.Add("cursor", "hand");
                    tbc5.Style.Add("padding", "0");
                    tbc5.Style.Add("margin", "0");
                    tbc5.Style.Add("cursor", "hand");

                    HtmlImage img1 = new HtmlImage();
                    HtmlImage img2 = new HtmlImage();
                    HtmlImage img3 = new HtmlImage();

                    img1.Src = "../images/edit.gif";
                    img2.Src = "../images/delete.gif";
                    img3.Src = "../images/add.gif";
                    img1.Alt = "Sửa danh mục cha";
                    img2.Alt = "Xóa danh mục cha";
                    img3.Alt = "Thêm danh mục con";
                    img1.Attributes.Add("onclick", "Edit(" + dr["NhomSanPhamID"] + ");");
                    img2.Attributes.Add("onclick", "Delete(" + dr["NhomSanPhamID"] + ");");
                    img3.Attributes.Add("onclick", "AddSub(" + dr["NhomSanPhamID"] + ",'" +
                                                   dr["TenNhomSanPham"] + "');");

                    tbc3.Controls.Add(img1);
                    tbc4.Controls.Add(img2);
                    if (loaddm < 3)
                        tbc5.Controls.Add(img3);

                    //tbr.Cells.Add(tbc1);
                    tbr.Cells.Add(tbc2);
                    tbr.Cells.Add(tbc3);
                    tbr.Cells.Add(tbc4);
                    tbr.Cells.Add(tbc5);
                    tblDanhMuc.Rows.Add(tbr);

                    LoadDanhMuc(int.Parse(dr["NhomSanPhamID"].ToString()), loaddm);
                    // }
                }
            }
        //            tblDanhMuc.Controls.Add(tbl);
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Beispiel #48
0
        protected void gvPlayerResults_RowCreated(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)
                        {
                            lnk.CssClass = "sortingHeader";
                            lnk.ToolTip  = "Posortuj po polu: " + lnk.Text;
                            HtmlGenericControl span = new HtmlGenericControl("span");
                            span.InnerText = lnk.Text;
                            lnk.Controls.Add(span);

                            HtmlImage img = new HtmlImage();

                            object oSortDirection  = Session["defaultSortDirection"];
                            object oSortExpression = Session["defaultSortExpression"];

                            if (oSortExpression == null)
                            {
                                if (lnk.Text == "#")
                                {
                                    img.Src = Page.ResolveUrl("~/Assets/arrow_asc.png");
                                }
                                else
                                {
                                    img.Src = Page.ResolveUrl("~/Assets/arrow_Sorting.png");
                                }
                            }
                            else
                            {
                                string sortExpression = oSortExpression.ToString();
                                string sortDirection  = oSortDirection.ToString();
                                if (string.Compare(sortExpression, lnk.Text) == 0)
                                {
                                    if (sortDirection == SortDirection.Ascending.ToString())
                                    {
                                        img.Src = Page.ResolveUrl("~/Assets/arrow_asc.png");
                                    }
                                    else
                                    {
                                        img.Src = Page.ResolveUrl("~/Assets/arrow_desc.png");
                                    }
                                }
                                else
                                {
                                    img.Src = Page.ResolveUrl("~/Assets/arrow_Sorting.png");
                                }
                            }

                            img.Alt    = "Posortuj po polu: " + lnk.Text;
                            img.Width  = 14;
                            img.Height = 14;
                            lnk.Controls.Add(img);
                        }
                    }
                }
            }
        }
        private bool GetDocument(Element element, ref Lead lead)
        {
            try
            {
                _main.Actions.Click(element);
                //moves forward once
                var imageel =_find.ByAttributes("src=~https://www.sos.state.co.us/tmpdocs");
                var image = new HtmlImage(imageel);
                if (image != null)
                {
                    _main.Actions.ScrollToVisible(imageel);
                    _imagelocation = Path.Combine(Properties.Settings.Default.pdfstore, lead.GetHashCode() + Path.GetExtension(image.Src));

                    WebRequest req = WebRequest.Create(image.Src);
                    WebResponse response = req.GetResponse();
                    Image.FromStream(response.GetResponseStream()).Save(_imagelocation);

                    return true;

                }
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
                lead.Messages.Add(new Message() { Content = e.Message, Messagetype = MessageType.Error });
            }
            finally
            {
                _main.GoBack();
            }
            return false;
        }
Beispiel #50
0
    protected void lstAllReplies_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        Panel       pnlAttachFile        = (Panel)e.Item.FindControl("pnlAttachFile");
        Label       lblAttachDocs        = (Label)e.Item.FindControl("lblAttachDocs");
        LinkButton  lnkClose             = (LinkButton)e.Item.FindControl("lnkClose");
        Label       lblReplyComment      = (Label)e.Item.FindControl("lblReplyComment");
        HiddenField hdnintAddedBy        = (HiddenField)e.Item.FindControl("hdnintAddedBy");
        HiddenField hdnintPrivateMessage = (HiddenField)e.Item.FindControl("hdnintPrivateMessage");
        HtmlControl QArep         = (HtmlControl)e.Item.FindControl("QArep");
        HiddenField hdnimgprofile = (HiddenField)e.Item.FindControl("hdnimgprofile");
        HtmlImage   imgprofile    = (HtmlImage)e.Item.FindControl("imgprofile");
        Label       lblDate       = (Label)e.Item.FindControl("lblDate");
        LinkButton  lnkEdit       = (LinkButton)e.Item.FindControl("lnkEdit");
        LinkButton  lnkdelete     = (LinkButton)e.Item.FindControl("lnkdelete");

        if (Convert.ToInt32(ViewState["UserID"]) == Convert.ToInt32(hdnintAddedBy.Value))
        {
            lnkdelete.Visible = true;
            lnkEdit.Visible   = true;
        }

        if (lblDate.Text == DateTime.Today.ToString("dd MMM yyyy"))
        {
            lblDate.Text = "Today";
        }
        else if (lblDate.Text == DateTime.Today.AddDays(-1).ToString("dd MMM yyyy"))
        {
            lblDate.Text = "Yesterday";
        }

        if (imgprofile.Src == "/CroppedPhoto/")
        {
            imgprofile.Src = "images/comment-profile.jpg";
        }
        else
        {
            string imgPathPhysical = Server.MapPath("~/CroppedPhoto/" + hdnimgprofile.Value);
            if (File.Exists(imgPathPhysical))
            {
            }
            else
            {
                imgprofile.Src = "images/comment-profile.jpg";
            }
        }

        if (hdnintPrivateMessage.Value == "1")
        {
            if (Convert.ToString(ViewState["QAUserId"]) != Convert.ToString(ViewState["UserID"]))
            {
                QArep.Visible = false;
            }

            if (hdnintAddedBy.Value == ViewState["UserID"].ToString())
            {
                QArep.Visible = true;
            }
        }

        if (Convert.ToString(ViewState["ViewAll"]) == "Close")
        {
            lnkClose.Style.Add("display", "block");
            lnkClose.Text = "Close";
            if (lblAttachDocs.Text != "" && lblAttachDocs.Text != null)
            {
                pnlAttachFile.Style.Add("display", "block");
            }
            else
            {
                pnlAttachFile.Style.Add("display", "none");
            }
        }
    }
    private void DisplayGroupReportColorGraph()
    {
        goToPrintPage();//bipson 17-02-2011
        return;

        Table tblDisplay = new Table();
        TableCell tblCell = new TableCell();
        TableRow tblRow;
        Label label;
        int i = 0;
        int rowid = 0;
        int totalmarks = 0;
        int sectionid = 0;
        // code to draw section(variable)wise bargraph

        //tblDisplay.Width = 650;
        tblDisplay.CellPadding = 0;
        tblDisplay.CellSpacing = 0;
        tblDisplay.BorderWidth = 0;
        string mark = "0"; string benchmark = "";

        // lblMessage.Text += " bargrphParts= " + GridView1.Rows.Count.ToString() + " bargrphValues= ";

        //
        float totalmark_variablewise = 0;
        int GRADE = 0;
        int gradecount = 0;

        //GridView1.Sort("USERID", SortDirection.Ascending);// BIP 19-01-2011
        //GridView1.DataBind();

        //code to get all section(variable) list
        //sectionNAME=GridView1.Rows[j].Cells[1].Text
        DataTable dtSectionList = new DataTable();
        dtSectionList.Columns.Add("sectionid");
        dtSectionList.Columns.Add("sectionname");
        DataRow drSectionList;
        string secname = "", secid = "";
        for (int secIndex = 0; secIndex < GridView1.Rows.Count; secIndex++)
        {
            secid = GridView1.Rows[secIndex].Cells[0].Text;
            secname = GridView1.Rows[secIndex].Cells[1].Text;

            bool secexists = false;
            for (int secIndex1 = 0; secIndex1 < dtSectionList.Rows.Count; secIndex1++)
            {
                if (dtSectionList.Rows[secIndex1]["sectionname"].ToString() == secname)
                { secexists = true; break; }
            }
            if (secexists == false)
            {
                drSectionList = dtSectionList.NewRow();
                drSectionList["sectionid"] = secid;
                drSectionList["sectionname"] = secname;
                dtSectionList.Rows.Add(drSectionList);
            }
        }

        //code add first three headers(USERID,NAME.TESTDATE)

        tblRow = new TableRow();
        tblCell = new TableCell();
        label = new Label();
        label.Font.Size = 12;
        label.Font.Bold = true;
        label.Text = "USER ID";
        //label.Width = 30;
        tblCell.Controls.Add(label);
        tblCell.Style.Value = "border: 1px ridge #000000;text-align: center; vertical-align: middle";
        //tblCell.Text = "USER ID";
        tblRow.Cells.Add(tblCell);
        tblCell = new TableCell();
        label = new Label();
        label.Font.Size = 12;
        label.Font.Bold = true;
        label.Text = "NAME";
        //label.Width = 30;
        tblCell.Controls.Add(label);
        tblCell.Style.Value = "border: 1px ridge #000000;text-align: center; vertical-align: middle";
        tblRow.Cells.Add(tblCell);
        tblCell = new TableCell();
        label = new Label();
        label.Font.Size = 12;
        label.Font.Bold = true;
        label.Text = "TEST DATE";
        //label.Width = 30;
        tblCell.Controls.Add(label);
        tblCell.Style.Value = "border: 1px ridge #000000;text-align: center; vertical-align: middle;";//padding:10
        tblRow.Cells.Add(tblCell);

        //code to design table header(title and variable names on the top of the table cell)
        for (int titleIndex = 0; titleIndex < dtSectionList.Rows.Count; titleIndex++)
        {
            tblCell = new TableCell();

            label = new Label();
            label.Font.Size = 12;
            label.Font.Bold = true;
            label.Text = "V" + (titleIndex + 1).ToString();
            //label.Text = dtSectionList.Rows[titleIndex]["sectionname"].ToString();
            //label.Width = 50;
            tblCell.Controls.Add(label);
            tblCell.Style.Value = "border: 1px ridge #000000;text-align: center; vertical-align: middle;width:40px;";//padding:10px
            //tblCell.Text = dtSectionList.Rows[titleIndex]["sectionname"].ToString();
            tblRow.Cells.Add(tblCell);
        }

        tblDisplay.Rows.Add(tblRow);// bip 13-02-2011
        //

        string curUSERNAME = "";
        string curNAME = "";
        string curUSERID = "0";
        string testDATE = "";
        string querystring = "SELECT DISTINCT EvaluationResult.UserId, UserProfile.UserName, UserProfile.FirstName, UserProfile.MiddleName, UserProfile.LastName,UserProfile.FirstLoginDate " +
                                    " FROM EvaluationResult INNER JOIN UserProfile ON EvaluationResult.UserId = UserProfile.UserId ORDER BY UserProfile.UserName";

        DataSet dsEvaluationdetails = new DataSet();
        dsEvaluationdetails = clsClasses.GetValuesFromDB(querystring);
        if (dsEvaluationdetails != null)
            if (dsEvaluationdetails.Tables.Count > 0)
                if (dsEvaluationdetails.Tables[0].Rows.Count > 0)
                    for (int uindex = 0; uindex < dsEvaluationdetails.Tables[0].Rows.Count; uindex++)
                    {
                        curUSERID = dsEvaluationdetails.Tables[0].Rows[uindex]["UserId"].ToString();
                        curUSERNAME = dsEvaluationdetails.Tables[0].Rows[uindex]["UserName"].ToString();
                        curNAME = dsEvaluationdetails.Tables[0].Rows[uindex]["FirstName"].ToString();
                        if (!dsEvaluationdetails.Tables[0].Rows[uindex]["MiddleName"].Equals(""))
                            curNAME += " " + dsEvaluationdetails.Tables[0].Rows[uindex]["MiddleName"].ToString();
                        if (!dsEvaluationdetails.Tables[0].Rows[uindex]["LastName"].Equals(""))
                            curNAME += " " + dsEvaluationdetails.Tables[0].Rows[uindex]["LastName"].ToString();

                        testDATE = dsEvaluationdetails.Tables[0].Rows[uindex]["FirstLoginDate"].ToString();
                        DateTime dttest = DateTime.Parse(testDATE);//, "dd/MM/yyyy");
                        testDATE = dttest.ToString("dd/MM/yyyy");//.ToShortDateString();
                        // }

                        string cellstyle = "border: 1px ridge #000000;text-align: left; vertical-align: middle;padding-left:5px;padding-right:5px";
                        tblRow = new TableRow();
                        // add username,name(firstname+middlename+lastname),testdate;
                        tblCell = new TableCell();
                        label = new Label();
                        label.Font.Size = 12;
                        //label.Font.Bold = true;
                        label.Text = curUSERNAME;
                        tblCell.Controls.Add(label);
                        tblCell.Style.Value = cellstyle;
                        tblRow.Cells.Add(tblCell);
                        tblCell = new TableCell();
                        label = new Label();
                        label.Font.Size = 12;
                        //label.Font.Bold = true;
                        label.Text = curNAME;
                        tblCell.Controls.Add(label);
                        tblCell.Style.Value = cellstyle;
                        tblRow.Cells.Add(tblCell);
                        tblCell = new TableCell();
                        label = new Label();
                        label.Font.Size = 12;
                        //label.Font.Bold = true;
                        label.Text = testDATE;
                        tblCell.Controls.Add(label);
                        tblCell.Style.Value = cellstyle;
                        tblRow.Cells.Add(tblCell);
                        //

                        //
                        int currentINDEX = 0;

                        for (int j = 0; j < GridView1.Rows.Count; j++)
                        {
                            totalmark_variablewise = 0;
                            if (GridView1.Rows[j].Cells[6].Text != "&nbsp;")
                                if (GridView1.Rows[j].Cells[6].Text != curUSERID)
                                    continue;
                            currentINDEX++;
                            if (GridView1.Rows[j].Cells[1].Text != "&nbsp;")
                            {
                                string TESTSECTIONID = GridView1.Rows[j].Cells[2].Text;
                                mark = "0";
                                if (GridView1.Rows[j].Cells[4].Text != "0" && GridView1.Rows[j].Cells[4].Text != "&nbsp;")
                                    totalmark_variablewise = float.Parse(GridView1.Rows[j].Cells[4].Text);

                                string remarks = ""; string querystring1 = "";
                                benchmark = "";
                                int section_id = GetSectionId(GridView1.Rows[j].Cells[1].Text);

                                querystring1 = "SELECT TestID, BenchMark,DisplayName,MarkFrom,MarkTo FROM TestVariableResultBands WHERE TestID = " + testid + " AND TestSectionId = " + TESTSECTIONID;
                                querystring1 += " AND VariableId = " + section_id + "";

                                DataSet ds1 = new DataSet(); bool benchmarkexists = false;
                                ds1 = clsClasses.GetValuesFromDB(querystring1);
                                if (ds1 != null)
                                    if (ds1.Tables.Count > 0)
                                        if (ds1.Tables[0].Rows.Count > 0)
                                        {
                                            benchmarkexists = true;
                                            gradecount = ds1.Tables[0].Rows.Count;
                                            for (int g = 0; g < ds1.Tables[0].Rows.Count; g++)
                                            {
                                                if (totalmark_variablewise >= float.Parse(ds1.Tables[0].Rows[g]["MarkFrom"].ToString()) && totalmark_variablewise <= float.Parse(ds1.Tables[0].Rows[g]["MarkTo"].ToString()))
                                                { GRADE = g + 1; break; }

                                            }
                                        }

                                if (benchmarkexists == false)
                                {

                                    querystring1 = "SELECT TestID, BenchMark,DisplayName,MarkFrom,MarkTo FROM TestSectionResultBands WHERE TestID = " + testid;
                                    querystring1 += " AND SectionId = " + TESTSECTIONID;

                                    ds1 = new DataSet();
                                    ds1 = clsClasses.GetValuesFromDB(querystring1);
                                    if (ds1 != null)
                                        if (ds1.Tables.Count > 0)
                                            if (ds1.Tables[0].Rows.Count > 0)
                                            {
                                                gradecount = ds1.Tables[0].Rows.Count;
                                                for (int g = 0; g < ds1.Tables[0].Rows.Count; g++)
                                                {
                                                    if (totalmark_variablewise >= float.Parse(ds1.Tables[0].Rows[g]["MarkFrom"].ToString()) && totalmark_variablewise <= float.Parse(ds1.Tables[0].Rows[g]["MarkTo"].ToString()))
                                                    { GRADE = g + 1; break; }
                                                }
                                            }
                                }

                                //tblCell = new TableCell();
                                //label = new Label();
                                //label.Text = totalmark_variablewise.ToString();
                                //tblCell.Controls.Add(label);
                                //tblCell.Style.Value = "text-align: left; vertical-align: middle";
                                //tblCell.BackColor = Color.Red;
                                HtmlImage himage = new HtmlImage();
                               //tblRow = new TableRow();
                                string imgvalue = "width:40px;height:22px";
                                for (int n = 0; n < gradecount; n++)
                                {
                                    tblCell = new TableCell();
                                    himage = new HtmlImage(); himage.Style.Value = imgvalue;// "width: 100%; height: 100%";
                                    if (gradecount == 2)
                                    {
                                        //tblCell.Text=i+1;
                                        if (GRADE == n + 1)
                                        {
                                            if (GRADE == 1)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 2)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imggreen.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                        }
                                    }
                                    else if (gradecount == 3)
                                    {
                                        if (GRADE == n + 1)
                                        {
                                            if (GRADE == 1)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 2)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 3)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imggreen.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                        }
                                    }
                                    else if (gradecount == 4)
                                    {
                                        if (GRADE == n + 1)
                                        {
                                            if (GRADE == 1)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 2)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 3)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 4)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imggreen.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                        }
                                    }
                                    else if (gradecount == 5)
                                    {
                                        if (GRADE == n + 1)
                                        {
                                            if (GRADE == 1)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgred.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 2)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 3)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 4)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imgash.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }
                                            else if (GRADE == 5)
                                            {
                                                himage.Src = "~/QuestionAnswerFiles/ReportImages/imggreen.JPG";
                                                tblCell.Controls.Add(himage); break;
                                            }

                                        }
                                    }

                                }
                                 tblCell.Style.Value = "border: 1px ridge #000000";
                                    tblRow.Cells.Add(tblCell);
                            }
                            tblDisplay.Rows.Add(tblRow);
                            //break;
                        }
                        //tblDisplay.Rows.Add(tblRow);

                    }// end of for loop userdetails...

        //BIP 23-01-2011

        // tcellBarGraph.Width = "200";
        tcellBarGraph.Controls.Add(tblDisplay);
        // imgGraph.Visible = false;
    }
Beispiel #52
0
        protected virtual void LoadLocations(Location location)
        {
            // Create a new HtmlTable
            HtmlGenericControl LocationContainer = new HtmlGenericControl("div");

            LocationContainer.Attributes["class"] = "col-md-4";
            HtmlGenericControl LocationCard = new HtmlGenericControl("div");

            LocationCard.Attributes["class"] = "card";
            //LocationCard.Attributes["style"] = "width:20rem;";

            HtmlGenericControl LocationCardBody = new HtmlGenericControl("div");

            LocationCardBody.Attributes["class"] = "card-body";
            HtmlGenericControl LocationButtons = new HtmlGenericControl("div");

            // Create an UpdatePanel to update Favorites without refreshing page
            UpdatePanel ButtonPanel = new UpdatePanel()
            {
                ID = "btnPanel_" + location.Name,
            };

            // Add unload event to prevent exception with dynamically created UpdatePanels
            ButtonPanel.Unload += (sender, EventArgs) => { UpdatePanel_Unload(sender, EventArgs); };

            // Add More Info button to update panel
            HtmlButton moreInfo = new HtmlButton()
            {
                ID        = "btnMoreInfo_" + location.Name,
                InnerText = "More Info",
            };

            moreInfo.Attributes.Add("class", "btn btn-outline-primary");
            moreInfo.Attributes.Add("data-toggle", "modal");
            moreInfo.Attributes.Add("Data-target", "#cpMainContent_modal_" + location.Name);
            ButtonPanel.ContentTemplateContainer.Controls.Add(moreInfo);


            // Make sure location object is passed to PopulateLocations method
            if (location != null)
            {
                HtmlImage image = new HtmlImage()
                {
                    Src = location.ImageLink,
                    ID  = "img_" + location.Name
                };
                image.Attributes["class"] = "card-img-top";
                LocationCard.Controls.Add(image);

                // Limit description to 100 chars
                string locationDescription = location.Description.Substring(0, 100);
                int    breakIndex          = locationDescription.LastIndexOf(' ');
                locationDescription  = locationDescription.Substring(0, breakIndex);
                locationDescription += "...";

                string title       = "<h1 class='card-title'>" + location.Name + "</h1>";
                string description = "<p class='card-text'>" + locationDescription + "</p>";
                var    content     = title + description;
                LocationCardBody.InnerHtml = content;

                if (Session[AppData.LOGGEDIN] != null)
                {
                    bool loggedIn = (bool)Session[AppData.LOGGEDIN];

                    if (loggedIn == true)
                    {
                        // Check if location already exists in favorites
                        List <Favorite> TravellerFavorites = GetFavoriteList();
                        bool            contains           = TravellerFavorites.Any(f => f.LocationID == location.ID);
                        if (contains != true)
                        {
                            // Instantiate a new 'Add to Favorites' button
                            HtmlButton addFavorite = new HtmlButton
                            {
                                ID        = "btnAdd_" + location.Name,
                                InnerText = "Add to My Destinations",
                            };
                            addFavorite.Attributes.Add("class", "btn btn-outline-success");
                            // Specify click event and create/call new event handler
                            addFavorite.ServerClick += (sender, EventArgs) => { AddDestinationBtn_Click(sender, EventArgs, location); };

                            // Add button to UpdatePanel
                            ButtonPanel.ContentTemplateContainer.Controls.Add(addFavorite);
                        }
                        else
                        {
                            Label fv_exists = new Label
                            {
                                ID       = "fv_exists_" + location.Name,
                                Text     = "Saved in your destinations",
                                CssClass = "badge badge-success",
                            };
                            fv_exists.Style.Add("font-size", "12pt");
                            fv_exists.Style.Add("padding", "5pt");

                            ButtonPanel.ContentTemplateContainer.Controls.Add(fv_exists);
                        }
                    }
                }

                // Add UpdatePanel to buttons div and card-body
                LocationButtons.Controls.Add(ButtonPanel);
                LocationCardBody.Controls.Add(LocationButtons);

                // Construct location card DIV
                LocationCard.Controls.Add(LocationCardBody);
                LocationContainer.Controls.Add(LocationCard);

                // Add location to placeholder
                loc_Placeholder.Controls.Add(LocationContainer);
            }
        }
Beispiel #53
0
    /// <summary>
    /// Function that is always called to recreate the table and all the check boxes
    /// </summary>
    private void GetMemberList()
    {
        tblResults.Rows.Clear();
        lblEntryError.Text = String.Empty;
        if (txtEntry.Text != String.Empty)
        {
            int userSearchType = rdSearchType.SelectedIndex;

            int userID = 0;
            string userEmail = String.Empty;
            string userName = String.Empty;
            string userIPAddress = String.Empty;
            string userBBCUID = String.Empty;
            string loginName = String.Empty;

            if (userSearchType == 0)
            {
                try
                {
                    userID = Convert.ToInt32(txtEntry.Text);
                }
                catch (System.FormatException Ex)
                {
                    lblEntryError.Text = "Please enter a valid User ID";
                    System.Console.WriteLine(Ex.Message);
                    return;
                }
            }
            else if (userSearchType == 1)
            {
                userEmail = txtEntry.Text;
            }
            else if (userSearchType == 2)
            {
                userName = txtEntry.Text;
            }
            else if (userSearchType == 3)
            {
                userIPAddress = txtEntry.Text;
            }
            else if (userSearchType == 4)
            {
                userBBCUID = txtEntry.Text;

                try
                {
                    Guid tmpBBCUID = new Guid(userBBCUID);
                }
                catch (System.FormatException Ex)
                {
                    lblEntryError.Text = "Please enter a valid BBC UID";
                    System.Console.WriteLine(Ex.Message);
                    return;
                }
            }
            else if (userSearchType == 5)
            {
                loginName = txtEntry.Text;
            }

            bool checkAllSites = false;
            //Sets the get across all sites for the stored procedures
            if (ViewingUser.IsSuperUser)
            {
                checkAllSites = true;
            }
            else
            {
                checkAllSites = false;
            }

            MemberList memberList = new MemberList(_basePage);
            memberList.GenerateMemberListPageXml(userSearchType, 
                                        txtEntry.Text,
                                        checkAllSites);

            int count = 0;
            TableHeaderRow headerRow = new TableHeaderRow();
            headerRow.BackColor = Color.MistyRose;

            int previousUserID = 0;
            int accountCount = 0;

            foreach (XmlNode node in memberList.RootElement.SelectNodes(@"MEMBERLIST/USERACCOUNTS/USERACCOUNT"))
            {
                if (count == 0)
                {
                    //No header cell for the tickbox
                    TableHeaderCell headerfirstCheckBoxCell = new TableHeaderCell();
                    CheckBox checkBoxApplyAll = new CheckBox();
                    checkBoxApplyAll.ID = "ApplyToAll";
                    checkBoxApplyAll.Text = "Apply To All";
                    checkBoxApplyAll.Checked = ApplyToAllStatus;
                    checkBoxApplyAll.CheckedChanged += new EventHandler(ApplyToAll_CheckedChanged);
                    checkBoxApplyAll.AutoPostBack = true;
                    checkBoxApplyAll.EnableViewState = true;
                    checkBoxApplyAll.Attributes.Add("onfocus", "document.getElementById('__LASTFOCUS').value=this.id;");


                    headerfirstCheckBoxCell.Controls.Add(checkBoxApplyAll);
                    headerRow.Cells.Add(headerfirstCheckBoxCell);

                    TableHeaderCell headerFirstCell = new TableHeaderCell();
                    headerFirstCell.Text = "User ID";
                    headerFirstCell.Scope = TableHeaderScope.Column;
                    headerRow.Cells.Add(headerFirstCell);
                }

                TableRow row = new TableRow();
                TableCell firstCheckBoxCell = new TableCell();
                firstCheckBoxCell.HorizontalAlign = HorizontalAlign.Center;

                CheckBox checkBoxApply = new CheckBox();
                checkBoxApply.ID = "Check" + count.ToString();
                checkBoxApply.CheckedChanged += new EventHandler(ListApply_CheckedChanged);
                checkBoxApply.AutoPostBack = true;
                checkBoxApply.EnableViewState = true;
                checkBoxApply.Attributes.Add("onfocus", "document.getElementById('__LASTFOCUS').value=this.id;");
                firstCheckBoxCell.Controls.Add(checkBoxApply);
                row.Cells.Add(firstCheckBoxCell);

                TableCell firstCell = new TableCell();
                firstCell.HorizontalAlign = HorizontalAlign.Center;

                string userIDText = node.SelectSingleNode(@"@USERID").InnerText;
                firstCell.Text = userIDText;
                int currentUserID = Convert.ToInt32(userIDText);
                if (currentUserID != previousUserID)
                {
                    accountCount++;
                    previousUserID = currentUserID;
                }

                if (accountCount % 2 == 0)
                    row.BackColor = Color.LightGray;
                else
                    row.BackColor = Color.Linen;

                HyperLink link = new HyperLink();
                link.NavigateUrl = "/dna/moderation/MemberDetails?userid=" + userIDText;
                link.Text = "U" + userIDText;
                firstCell.Controls.Add(link);
                row.Cells.Add(firstCell);

                foreach (XmlNode data in node.ChildNodes)
                {
                    TableCell nextCell = new TableCell();

                    if (data.LocalName == "PREFSTATUS")
                    {
                        if (count == 0)
                        {
                            AddHeaderCell(headerRow, "STATUS");
                        }

                        HtmlImage img = new HtmlImage();
                        string path = @"/dnaimages/moderation/images/icons/status" + data.InnerText + ".gif";
                        //img.Src = String.Format("http://ops-dna2.national.core.bbc.co.uk/dnaimages/moderation/images/icons/status{0}.gif", data.InnerText);
                        img.Src = path;
                        img.Alt = data.ParentNode.SelectSingleNode("USERSTATUSDESCRIPTION").InnerText;
                        nextCell.HorizontalAlign = HorizontalAlign.Center;
                        nextCell.Controls.Add(img);
                        row.Cells.Add(nextCell);
                    }

                    else if (data.LocalName == "SITEID")
                    {
                        if (count == 0)
                        {
                            AddHeaderCell(headerRow, "SITEID");
                        }
                        nextCell.HorizontalAlign = HorizontalAlign.Center;
                        nextCell.Text = data.InnerText;
                        row.Cells.Add(nextCell);
                    }
                    else if (data.LocalName == "PREFSTATUSCHANGEDDATE")
                    {
                        if (count == 0)
                        {
                            AddHeaderCell(headerRow, "CHANGEDDATE");
                        }

                        nextCell.HorizontalAlign = HorizontalAlign.Center;

                        DateTime date = new DateTime();
                        string sortDate = String.Empty;

                        if (data.SelectSingleNode("DATE/@SORT") != null)
                        {
                            DateTimeFormatInfo UKDTFI = new CultureInfo("en-GB", false).DateTimeFormat;

                            sortDate = data.SelectSingleNode("DATE/@SORT").InnerText;
                            DateTime.TryParseExact(sortDate, "yyyyMMddHHmmss", UKDTFI, DateTimeStyles.NoCurrentDateDefault, out date);
                            nextCell.Text = date.ToString();
                        }
                        else
                        {
                            nextCell.Text = "";
                        }
                        row.Cells.Add(nextCell);
                    }
                    else if (data.LocalName == "PREFSTATUSDURATION")
                    {
                        if (count == 0)
                        {
                            AddHeaderCell(headerRow, "DURATION");
                        }
                        nextCell.HorizontalAlign = HorizontalAlign.Center;
                        nextCell.Text = memberList.GetPrefStatusDurationDisplayText(data.InnerText);
                        row.Cells.Add(nextCell);
                    }
                    else if (data.LocalName == "SHORTNAME")
                    {
                        if (count == 0)
                        {
                            AddHeaderCell(headerRow, "SITE");
                        }
                        nextCell.HorizontalAlign = HorizontalAlign.Center;
                        nextCell.Text = data.InnerText;
                        row.Cells.Add(nextCell);
                    }
                    else if ( data.LocalName != "USERSTATUSDESCRIPTION" &&
                        data.LocalName != "URLNAME")
                    {
                        if (count == 0)
                        {
                            AddHeaderCell(headerRow, data.LocalName);
                        }

                        nextCell.HorizontalAlign = HorizontalAlign.Center;
                        nextCell.Text = data.InnerText;
                        row.Cells.Add(nextCell);
                    }
                }
                tblResults.Rows.Add(row);
                count++;
            }

            if (count == 0)
            {
                TableRow nodatarow = new TableRow();
                TableCell nodataCell = new TableCell();
                nodataCell.ColumnSpan = 4;
                nodataCell.Text = @"No data for those details";
                nodatarow.Cells.Add(nodataCell);
                tblResults.Rows.Add(nodatarow);
                Count.Text = "";
            }
            else
            {
                Count.Text = String.Format(@"There are {0} entries.", count.ToString());
            }

            tblResults.Rows.AddAt(0, headerRow);

            tblResults.CellSpacing = 5;
            tblResults.BorderWidth = 2;
            tblResults.BorderStyle = BorderStyle.Outset;

        }
    }
 private void VerifyImageAttribute(HtmlImage image, string attName, string attValue)
 {
     var attr = image.Attributes.FirstOrDefault(a => a.Name == attName);
     if (attName == "title" || attName == "sfref")
     {
         Assert.IsNotNull(attr, "Unable to find attribute: " + attName);
         Assert.AreEqual(attValue, attr.Value.ToLower(), "Attribute " + attName + " value not as expected.");
     }
     else
     {
         Assert.IsNotNull(attr, "Unable to find attribute: " + attName);
         Assert.AreEqual(attValue, attr.Value, "Attribute " + attName + " value not as expected.");
     }
 }
Beispiel #55
0
    protected void ColorBind()
    {
        lbline.Text = "<script type=\"text/javascript\">function DrawLines(){";
       string ImgID = "";
       string  ImgID1 = "";
       string ImgID2 = "";
       string ImgID3 = "";

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[12].Text, 0) == 0)
                {
                    HtmlImage hi = new HtmlImage();
                    hi.Src ="../../../Images/4[1].jpg";
                    GridView1.Rows[i].Cells[12].Controls.Add(hi);                  
                }
            

            for (int j = 14; j < 24; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, 0) == 0)
                {
                    Label lb = new Label();
                    lb.Text = "<strong style='color:red;' id='" + "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString() + "'>" + (j - 14).ToString();

                    if (ImgID != null && ImgID != "")
                    {
                        lbline.Text +="DrawLine('" + ImgID + "','" + "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString() + "', '#A9A9A9');";
                    }

                    GridView1.Rows[i].Cells[j].Controls.Add(lb);

                    ImgID ="GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString();
                }
            }

            for (int j = 25; j < 35; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, 0) == 0)
                {
                    Label lb = new Label();
                    lb.Text = "<strong style='color:blue;' id='" + "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString() + "'>" + (j - 25).ToString();

                    if (ImgID1 != null && ImgID1 != "")
                    {
                        lbline.Text += "DrawLine('" + ImgID1 + "','" + "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString() + "', '#A9A9A9');";
                    }

                    GridView1.Rows[i].Cells[j].Controls.Add(lb);

                    ImgID1 = "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString();
                }
            }

            for (int j = 35; j < 45; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, 0) == 0)
                {
                    Label lb = new Label();
                    lb.Text = "<strong style='color:red;' id='" + "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString() + "'>" + (j - 35).ToString();

                    if (ImgID2 != null && ImgID2 != "")
                    {
                        lbline.Text += "DrawLine('" + ImgID2 + "','" + "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString() + "', '#A9A9A9');";
                    }

                    GridView1.Rows[i].Cells[j].Controls.Add(lb);

                    ImgID2 = "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString();
                }
            }

            for (int j = 45; j < 55; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, 0) == 0)
                {
                    Label lb = new Label();
                    lb.Text = "<strong style='color:red;' id='" + "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString() + "'>" + (j - 45).ToString();

                    if (ImgID3 != null && ImgID3 != "")
                    {
                        lbline.Text += "DrawLine('" + ImgID3 + "','" + "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString() + "', '#A9A9A9');";
                    }

                    GridView1.Rows[i].Cells[j].Controls.Add(lb);

                    ImgID3 = "GridView1_ctl" + (i + 2).ToString().PadLeft(2, '0') + "_" + i.ToString() + "_" + j.ToString();
                }
            }

            for (int j = 2; j < 12; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, 0) == -1)
                {
                    GridView1.Rows[i].Cells[j].Text = "&nbsp;";
                }
            }

            string str = GridView1.Rows[i].Cells[1].Text;
            int ii = int.Parse(str.Substring(0, 1));
            int jj = int.Parse(str.Substring(1, 1));
            int kk = int.Parse(str.Substring(2, 1));


            if (ii == jj || ii == kk)
            {
                int m = ii;
                if (m == 0)
                {
                    GridView1.Rows[i].Cells[2].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 1)
                {
                    GridView1.Rows[i].Cells[3].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 2)
                {
                    GridView1.Rows[i].Cells[4].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 3)
                {
                    GridView1.Rows[i].Cells[5].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 4)
                {
                    GridView1.Rows[i].Cells[6].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 5)
                {
                    GridView1.Rows[i].Cells[7].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 6)
                {
                    GridView1.Rows[i].Cells[8].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 7)
                {
                    GridView1.Rows[i].Cells[9].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 8)
                {
                    GridView1.Rows[i].Cells[10].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else
                {
                    GridView1.Rows[i].Cells[11].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
            }
            if (jj == kk)
            {
                int m = jj;
                if (m == 0)
                {
                    GridView1.Rows[i].Cells[2].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 1)
                {
                    GridView1.Rows[i].Cells[3].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 2)
                {
                    GridView1.Rows[i].Cells[4].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 3)
                {
                    GridView1.Rows[i].Cells[5].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 4)
                {
                    GridView1.Rows[i].Cells[6].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 5)
                {
                    GridView1.Rows[i].Cells[7].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 6)
                {
                    GridView1.Rows[i].Cells[8].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 7)
                {
                    GridView1.Rows[i].Cells[9].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else if (m == 8)
                {
                    GridView1.Rows[i].Cells[10].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
                else
                {
                    GridView1.Rows[i].Cells[11].ForeColor = System.Drawing.Color.FromArgb(255, 000, 000);
                }
            }
        }
        lbline.Text += "}</script>";
    }
    protected void ColorBind()
    {
        this.lbline.Text = "<script type=\"text/javascript\">function DrawLines(){";
        string str  = "";
        string str2 = "";
        string str3 = "";
        string str4 = "";

        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[12].Text, 0) == 0)
            {
                HtmlImage child = new HtmlImage
                {
                    Src = "../../../Images/4[1].jpg"
                };
                this.GridView1.Rows[i].Cells[12].Controls.Add(child);
            }
            for (int j = 14; j < 0x18; j++)
            {
                if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[j].Text, 0) == 0)
                {
                    Label    label    = new Label();
                    string[] strArray = new string[8];
                    strArray[0] = "<strong style='color:red;' id='GridView1_ctl";
                    int num3 = i + 2;
                    strArray[1] = num3.ToString().PadLeft(2, '0');
                    strArray[2] = "_";
                    strArray[3] = i.ToString();
                    strArray[4] = "_";
                    strArray[5] = j.ToString();
                    strArray[6] = "'>";
                    strArray[7] = (j - 14).ToString();
                    label.Text  = string.Concat(strArray);
                    if ((str != null) && (str != ""))
                    {
                        string   str5      = this.lbline.Text;
                        string[] strArray2 = new string[10];
                        strArray2[0] = str5;
                        strArray2[1] = "DrawLine('";
                        strArray2[2] = str;
                        strArray2[3] = "','GridView1_ctl";
                        int num5 = i + 2;
                        strArray2[4]     = num5.ToString().PadLeft(2, '0');
                        strArray2[5]     = "_";
                        strArray2[6]     = i.ToString();
                        strArray2[7]     = "_";
                        strArray2[8]     = j.ToString();
                        strArray2[9]     = "', '#A9A9A9');";
                        this.lbline.Text = string.Concat(strArray2);
                    }
                    this.GridView1.Rows[i].Cells[j].Controls.Add(label);
                    string[] strArray3 = new string[6];
                    strArray3[0] = "GridView1_ctl";
                    int num6 = i + 2;
                    strArray3[1] = num6.ToString().PadLeft(2, '0');
                    strArray3[2] = "_";
                    strArray3[3] = i.ToString();
                    strArray3[4] = "_";
                    strArray3[5] = j.ToString();
                    str          = string.Concat(strArray3);
                }
            }
            for (int k = 0x19; k < 0x23; k++)
            {
                if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[k].Text, 0) == 0)
                {
                    Label    label2    = new Label();
                    string[] strArray4 = new string[8];
                    strArray4[0] = "<strong style='color:blue;' id='GridView1_ctl";
                    int num8 = i + 2;
                    strArray4[1] = num8.ToString().PadLeft(2, '0');
                    strArray4[2] = "_";
                    strArray4[3] = i.ToString();
                    strArray4[4] = "_";
                    strArray4[5] = k.ToString();
                    strArray4[6] = "'>";
                    strArray4[7] = (k - 0x19).ToString();
                    label2.Text  = string.Concat(strArray4);
                    if ((str2 != null) && (str2 != ""))
                    {
                        string   str6      = this.lbline.Text;
                        string[] strArray5 = new string[10];
                        strArray5[0] = str6;
                        strArray5[1] = "DrawLine('";
                        strArray5[2] = str2;
                        strArray5[3] = "','GridView1_ctl";
                        int num10 = i + 2;
                        strArray5[4]     = num10.ToString().PadLeft(2, '0');
                        strArray5[5]     = "_";
                        strArray5[6]     = i.ToString();
                        strArray5[7]     = "_";
                        strArray5[8]     = k.ToString();
                        strArray5[9]     = "', '#A9A9A9');";
                        this.lbline.Text = string.Concat(strArray5);
                    }
                    this.GridView1.Rows[i].Cells[k].Controls.Add(label2);
                    string[] strArray6 = new string[6];
                    strArray6[0] = "GridView1_ctl";
                    int num11 = i + 2;
                    strArray6[1] = num11.ToString().PadLeft(2, '0');
                    strArray6[2] = "_";
                    strArray6[3] = i.ToString();
                    strArray6[4] = "_";
                    strArray6[5] = k.ToString();
                    str2         = string.Concat(strArray6);
                }
            }
            for (int m = 0x23; m < 0x2d; m++)
            {
                if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[m].Text, 0) == 0)
                {
                    Label    label3    = new Label();
                    string[] strArray7 = new string[8];
                    strArray7[0] = "<strong style='color:red;' id='GridView1_ctl";
                    int num13 = i + 2;
                    strArray7[1] = num13.ToString().PadLeft(2, '0');
                    strArray7[2] = "_";
                    strArray7[3] = i.ToString();
                    strArray7[4] = "_";
                    strArray7[5] = m.ToString();
                    strArray7[6] = "'>";
                    strArray7[7] = (m - 0x23).ToString();
                    label3.Text  = string.Concat(strArray7);
                    if ((str3 != null) && (str3 != ""))
                    {
                        string   str7      = this.lbline.Text;
                        string[] strArray8 = new string[10];
                        strArray8[0] = str7;
                        strArray8[1] = "DrawLine('";
                        strArray8[2] = str3;
                        strArray8[3] = "','GridView1_ctl";
                        int num15 = i + 2;
                        strArray8[4]     = num15.ToString().PadLeft(2, '0');
                        strArray8[5]     = "_";
                        strArray8[6]     = i.ToString();
                        strArray8[7]     = "_";
                        strArray8[8]     = m.ToString();
                        strArray8[9]     = "', '#A9A9A9');";
                        this.lbline.Text = string.Concat(strArray8);
                    }
                    this.GridView1.Rows[i].Cells[m].Controls.Add(label3);
                    string[] strArray9 = new string[6];
                    strArray9[0] = "GridView1_ctl";
                    int num16 = i + 2;
                    strArray9[1] = num16.ToString().PadLeft(2, '0');
                    strArray9[2] = "_";
                    strArray9[3] = i.ToString();
                    strArray9[4] = "_";
                    strArray9[5] = m.ToString();
                    str3         = string.Concat(strArray9);
                }
            }
            for (int n = 0x2d; n < 0x37; n++)
            {
                if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[n].Text, 0) == 0)
                {
                    Label    label4     = new Label();
                    string[] strArray10 = new string[8];
                    strArray10[0] = "<strong style='color:red;' id='GridView1_ctl";
                    int num18 = i + 2;
                    strArray10[1] = num18.ToString().PadLeft(2, '0');
                    strArray10[2] = "_";
                    strArray10[3] = i.ToString();
                    strArray10[4] = "_";
                    strArray10[5] = n.ToString();
                    strArray10[6] = "'>";
                    strArray10[7] = (n - 0x2d).ToString();
                    label4.Text   = string.Concat(strArray10);
                    if ((str4 != null) && (str4 != ""))
                    {
                        string   str8       = this.lbline.Text;
                        string[] strArray11 = new string[10];
                        strArray11[0] = str8;
                        strArray11[1] = "DrawLine('";
                        strArray11[2] = str4;
                        strArray11[3] = "','GridView1_ctl";
                        int num20 = i + 2;
                        strArray11[4]    = num20.ToString().PadLeft(2, '0');
                        strArray11[5]    = "_";
                        strArray11[6]    = i.ToString();
                        strArray11[7]    = "_";
                        strArray11[8]    = n.ToString();
                        strArray11[9]    = "', '#A9A9A9');";
                        this.lbline.Text = string.Concat(strArray11);
                    }
                    this.GridView1.Rows[i].Cells[n].Controls.Add(label4);
                    string[] strArray12 = new string[6];
                    strArray12[0] = "GridView1_ctl";
                    int num21 = i + 2;
                    strArray12[1] = num21.ToString().PadLeft(2, '0');
                    strArray12[2] = "_";
                    strArray12[3] = i.ToString();
                    strArray12[4] = "_";
                    strArray12[5] = n.ToString();
                    str4          = string.Concat(strArray12);
                }
            }
            for (int num22 = 2; num22 < 12; num22++)
            {
                if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[num22].Text, 0) == -1)
                {
                    this.GridView1.Rows[i].Cells[num22].Text = "&nbsp;";
                }
            }
            string text  = this.GridView1.Rows[i].Cells[1].Text;
            int    num23 = int.Parse(text.Substring(0, 1));
            int    num24 = int.Parse(text.Substring(1, 1));
            int    num25 = int.Parse(text.Substring(2, 1));
            if ((num23 == num24) || (num23 == num25))
            {
                switch (num23)
                {
                case 0:
                    this.GridView1.Rows[i].Cells[2].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;

                case 1:
                    this.GridView1.Rows[i].Cells[3].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;

                case 2:
                    this.GridView1.Rows[i].Cells[4].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;

                case 3:
                    this.GridView1.Rows[i].Cells[5].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;

                case 4:
                    this.GridView1.Rows[i].Cells[6].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;

                case 5:
                    this.GridView1.Rows[i].Cells[7].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;

                case 6:
                    this.GridView1.Rows[i].Cells[8].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;

                case 7:
                    this.GridView1.Rows[i].Cells[9].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;

                case 8:
                    this.GridView1.Rows[i].Cells[10].ForeColor = Color.FromArgb(0xff, 0, 0);
                    goto Label_0B67;
                }
                this.GridView1.Rows[i].Cells[11].ForeColor = Color.FromArgb(0xff, 0, 0);
            }
Label_0B67:
            if (num24 == num25)
            {
                switch (num24)
                {
                case 0:
                {
                    this.GridView1.Rows[i].Cells[2].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }

                case 1:
                {
                    this.GridView1.Rows[i].Cells[3].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }

                case 2:
                {
                    this.GridView1.Rows[i].Cells[4].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }

                case 3:
                {
                    this.GridView1.Rows[i].Cells[5].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }

                case 4:
                {
                    this.GridView1.Rows[i].Cells[6].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }

                case 5:
                {
                    this.GridView1.Rows[i].Cells[7].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }

                case 6:
                {
                    this.GridView1.Rows[i].Cells[8].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }

                case 7:
                {
                    this.GridView1.Rows[i].Cells[9].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }

                case 8:
                {
                    this.GridView1.Rows[i].Cells[10].ForeColor = Color.FromArgb(0xff, 0, 0);
                    continue;
                }
                }
                this.GridView1.Rows[i].Cells[11].ForeColor = Color.FromArgb(0xff, 0, 0);
            }
        }
        this.lbline.Text = this.lbline.Text + "}</script>";
    }
 protected void ColorBind()
 {
     for (int i = 0; i < this.GridView1.Rows.Count; i++)
     {
         if (this.GridView1.Rows[i].Cells[1].Text.Length == 5)
         {
             Label child = new Label
             {
                 Text = this.GridView1.Rows[i].Cells[1].Text.Substring(0, 1) + "<font color='red'>" + this.GridView1.Rows[i].Cells[1].Text.Substring(1, 4) + "</font>"
             };
             this.GridView1.Rows[i].Cells[1].Controls.Add(child);
         }
         if (this.GridView1.Rows[i].Cells[8].Text == "0")
         {
             HtmlImage image = new HtmlImage
             {
                 Src = "../Images/blue_kong.gif"
             };
             this.GridView1.Rows[i].Cells[8].Controls.Add(image);
         }
         if (this.GridView1.Rows[i].Cells[20].Text == "0")
         {
             HtmlImage image2 = new HtmlImage
             {
                 Src = "../Images/red_kong.gif"
             };
             this.GridView1.Rows[i].Cells[20].Controls.Add(image2);
         }
         if (this.GridView1.Rows[i].Cells[14].Text == "0")
         {
             HtmlImage image3 = new HtmlImage
             {
                 Src = "../Images/orange_kong.gif"
             };
             this.GridView1.Rows[i].Cells[14].Controls.Add(image3);
         }
         if (this.GridView1.Rows[i].Cells[0x1a].Text == "0")
         {
             HtmlImage image4 = new HtmlImage
             {
                 Src = "../Images/blue_kong.gif"
             };
             this.GridView1.Rows[i].Cells[0x1a].Controls.Add(image4);
         }
         int num2 = 9;
         for (int j = 1; num2 < 14; j += 2)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[num2].Text, -1) == 0)
             {
                 HtmlImage image5 = new HtmlImage
                 {
                     Src = "../Images/blue_" + j.ToString() + ".gif"
                 };
                 this.GridView1.Rows[i].Cells[num2].Controls.Add(image5);
             }
             num2++;
         }
         int num4 = 15;
         for (int k = 0; num4 < 20; k += 2)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[num4].Text, -1) == 0)
             {
                 HtmlImage image6 = new HtmlImage
                 {
                     Src = "../Images/orange_" + k.ToString() + ".gif"
                 };
                 this.GridView1.Rows[i].Cells[num4].Controls.Add(image6);
             }
             num4++;
         }
         int num6 = 0x15;
         for (int m = 1; num6 < 0x1a; m += 2)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[num6].Text, -1) == 0)
             {
                 HtmlImage image7 = new HtmlImage
                 {
                     Src = "../Images/red_" + m.ToString() + ".gif"
                 };
                 this.GridView1.Rows[i].Cells[num6].Controls.Add(image7);
             }
             num6++;
         }
         int num8 = 0x1b;
         for (int n = 0; num8 < 0x20; n += 2)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[num8].Text, -1) == 0)
             {
                 HtmlImage image8 = new HtmlImage
                 {
                     Src = "../Images/blue_" + n.ToString() + ".gif"
                 };
                 this.GridView1.Rows[i].Cells[num8].Controls.Add(image8);
             }
             num8++;
         }
         if (this.GridView1.Rows[i].Cells[3].Text.Length > 1)
         {
             string str = "";
             ArrayList list = new ArrayList();
             for (int num10 = 0; num10 < this.GridView1.Rows[i].Cells[3].Text.Length; num10++)
             {
                 list.Add(this.GridView1.Rows[i].Cells[3].Text.Substring(num10, 1));
             }
             list.Sort();
             for (int num11 = 0; num11 < list.Count; num11++)
             {
                 str = str + list[num11] + ",";
             }
             this.GridView1.Rows[i].Cells[3].Text = str.Substring(0, str.Length - 1);
         }
         if (this.GridView1.Rows[i].Cells[4].Text.Length > 1)
         {
             string str2 = "";
             ArrayList list2 = new ArrayList();
             for (int num12 = 0; num12 < this.GridView1.Rows[i].Cells[4].Text.Length; num12++)
             {
                 list2.Add(this.GridView1.Rows[i].Cells[4].Text.Substring(num12, 1));
             }
             list2.Sort();
             for (int num13 = 0; num13 < list2.Count; num13++)
             {
                 str2 = str2 + list2[num13] + ",";
             }
             this.GridView1.Rows[i].Cells[4].Text = str2.Substring(0, str2.Length - 1);
         }
     }
 }
    /// <summary>
    /// Cambio la clase para mostrar el orden.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="args"></param>
    protected void ItemDataBound_lvGeneric(object sender, ListViewItemEventArgs args)
    {
        ListView listView = (ListView)sender;

        //----------------------------------------------------
        //-- 1 - Actualizo la URL del link para MapQuest
        //-- 2 - Veo si muestro o no la LUPA
        //----------------------------------------------------
        if (args.Item.ItemType == ListViewItemType.DataItem && args.Item != null)
        {
            //--------------------------------------------------------------
            //-- Creo el objeto que tiene los datos de la ROW del Listview
            //--------------------------------------------------------------
            ListViewDataItem dataItem = (ListViewDataItem)args.Item;
            DataRowView      rowView  = (DataRowView)dataItem.DataItem;

            HtmlImage ImgXlsAlimentos = ((HtmlImage)dataItem.FindControl("ImgXlsAlimentos"));
            string    pagina          = string.Format("GenerarXls.aspx?EncuestaNro={0}&Listado=1", rowView["EncuestaNro"].ToString());
            string    onClick         = string.Format("window.open('{0}');return false;", Chenso.Utilities.Common.MySite.GetFullSiteName_FromAppConfig() + pagina);
            ImgXlsAlimentos.Attributes.Add("onClick", onClick);

            HtmlImage ImgXlsNutrientes = ((HtmlImage)dataItem.FindControl("ImgXlsNutrientes"));
            pagina  = string.Format("GenerarXls.aspx?EncuestaNro={0}&Listado=2", rowView["EncuestaNro"].ToString());
            onClick = string.Format("window.open('{0}');return false;", Chenso.Utilities.Common.MySite.GetFullSiteName_FromAppConfig() + pagina);
            ImgXlsNutrientes.Attributes.Add("onClick", onClick);

            HtmlImage ImgXlsNutrientesPorAlimentos = ((HtmlImage)dataItem.FindControl("ImgXlsNutrientesPorAlimentos"));
            pagina  = string.Format("GenerarXls.aspx?EncuestaNro={0}&Listado=3", rowView["EncuestaNro"].ToString());
            onClick = string.Format("window.open('{0}');return false;", Chenso.Utilities.Common.MySite.GetFullSiteName_FromAppConfig() + pagina);
            ImgXlsNutrientesPorAlimentos.Attributes.Add("onClick", onClick);
        }

        //--------------------------------------------------------------
        //  Se dio clik en un HEADER para ordenar
        //--------------------------------------------------------------
        if (listView.SortExpression.Length > 0)
        {
            //  if this is the first time ItemDataBound has fired, figure out what column
            //  is being sorted by
            if (!this._hasProcessedHeaderMain)
            {
                //-- Creo una referencia a la primera ROW = HEADERS de la
                //-- TABLA que se definio en el LAYOUT TEMPLATE !!!
                HtmlTableRow header = ((HtmlTable)listView.FindControl("tbGeneric")).Rows[0];

                //  Busco el LINKBUTTON que contenga en su CommandArgument el mismo
                //  valor que el SortExpression del ListView
                for (int i = 0; i < header.Cells.Count; i++)
                {
                    //-- Objeto Celda
                    HtmlTableCell th = header.Cells[i];

                    //  Busco el LINKBUTTON dentro de los
                    //  Controles de la Celda
                    foreach (Control c in th.Controls)
                    {
                        LinkButton linkButton = c as LinkButton;

                        if (linkButton != null)
                        {
                            string originalHeaderStyle = th.Attributes["class"] ?? string.Empty;
                            //  make sure the header doesn't have the sortasc or sortdesc classes
                            th.Attributes["class"] =
                                originalHeaderStyle.Replace("sortasc", string.Empty).Replace("sortdesc", string.Empty).Trim();

                            if (linkButton.CommandArgument == listView.SortExpression)
                            {
                                //  add the sort class to this item
                                th.Attributes["class"] =
                                    string.Format("{0} {1}", th.Attributes["class"] ?? string.Empty, listView.SortDirection == SortDirection.Ascending ? "sortasc" : "sortdesc").Trim();
                            }
                        }
                    }
                }

                this._hasProcessedHeaderMain = true;
            }
        }
    }
Beispiel #59
0
    protected void ColorBind()
    {
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            if (GridView1.Rows[i].Cells[8].Text == "0")
            {
                HtmlImage img = new HtmlImage();
                img.Src = "../Images/blue_kong.gif";
                GridView1.Rows[i].Cells[8].Controls.Add(img);
            }

            if (GridView1.Rows[i].Cells[20].Text == "0")
            {
                HtmlImage img = new HtmlImage();
                img.Src = "../Images/red_kong.gif";
                GridView1.Rows[i].Cells[20].Controls.Add(img);
            }

            if (GridView1.Rows[i].Cells[14].Text == "0")
            {
                HtmlImage img = new HtmlImage();
                img.Src = "../Images/orange_kong.gif";
                GridView1.Rows[i].Cells[14].Controls.Add(img);
            }

            if (GridView1.Rows[i].Cells[26].Text == "0")
            {
                HtmlImage img = new HtmlImage();
                img.Src = "../Images/blue_kong.gif";
                GridView1.Rows[i].Cells[26].Controls.Add(img);
            }

            for (int j = 9; j < 12; j++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    int k = j - 8;

                    HtmlImage img = new HtmlImage();

                    img.Src = "../Images/blue_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            for (int j = 12,k = 5; j < 14; j++,k +=2)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();

                    img.Src = "../Images/blue_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[15].Text, -1) == 0)
            {
                HtmlImage img = new HtmlImage();
                img.Src = "../Images/orange_0.gif";
                GridView1.Rows[i].Cells[15].Controls.Add(img);
            }

            for (int j = 16,k = 4; j < 19; j++,k +=2)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, -1) == 0)
                {
                    HtmlImage img = new HtmlImage();

                    img.Src = "../Images/orange_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[19].Text, 0) == 0)
            {
                HtmlImage img = new HtmlImage();
                img.Src = "../Images/orange_9.gif";
                GridView1.Rows[i].Cells[19].Controls.Add(img);
            }

            for (int j = 21,k = 1; j < 24; j++,k++)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, 0) == 0)
                {
                    HtmlImage img = new HtmlImage();

                    img.Src = "../Images/red_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            for (int j = 24, k = 5; j < 26; j++, k += 2)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, 0) == 0)
                {
                    HtmlImage img = new HtmlImage();

                    img.Src = "../Images/red_" + k.ToString() + ".gif";

                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[27].Text, 0) == 0)
            {
                HtmlImage img = new HtmlImage();

                img.Src = "../Images/blue_0.gif";

                GridView1.Rows[i].Cells[27].Controls.Add(img);
            }

            if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[31].Text, 0) == 0)
            {
                HtmlImage img = new HtmlImage();

                img.Src = "../Images/blue_9.gif";

                GridView1.Rows[i].Cells[31].Controls.Add(img);
            }

            for (int j = 28, k = 4; j < 31; j++, k += 2)
            {
                if (Shove._Convert.StrToInt(GridView1.Rows[i].Cells[j].Text, 0) == 0)
                {
                    HtmlImage img = new HtmlImage();

                    img.Src = "../Images/blue_" + k.ToString() + ".gif";
                    GridView1.Rows[i].Cells[j].Controls.Add(img);
                }
            }

            if (GridView1.Rows[i].Cells[3].Text.Length > 1)
            {
                string Celltext3 = "";

                ArrayList al = new ArrayList();

                for (int a = 0; a < GridView1.Rows[i].Cells[3].Text.Length; a++)
                {
                    al.Add(GridView1.Rows[i].Cells[3].Text.Substring(a, 1));
                }

                al.Sort();

                for (int a = 0; a < al.Count; a++)
                {
                    Celltext3 += al[a] + ",";
                }

                GridView1.Rows[i].Cells[3].Text = Celltext3.Substring(0, Celltext3.Length - 1);
            }

            if (GridView1.Rows[i].Cells[4].Text.Length > 1)
            {
                string Celltext4 = "";

                ArrayList al2 = new ArrayList();

                for (int a = 0; a < GridView1.Rows[i].Cells[4].Text.Length; a++)
                {
                    al2.Add(GridView1.Rows[i].Cells[4].Text.Substring(a, 1));
                }

                al2.Sort();

                for (int a = 0; a < al2.Count; a++)
                {
                    Celltext4 += al2[a] + ",";
                }

                GridView1.Rows[i].Cells[4].Text = Celltext4.Substring(0, Celltext4.Length - 1);
            }
        }
    }
 protected void ColorBind()
 {
     for (int i = 0; i < this.GridView1.Rows.Count; i++)
     {
         if (this.GridView1.Rows[i].Cells[1].Text.Length == 5)
         {
             Label child = new Label
             {
                 Text = this.GridView1.Rows[i].Cells[1].Text.Substring(0, 1) + "<font color='red'>" + this.GridView1.Rows[i].Cells[1].Text.Substring(1, 4) + "</font>"
             };
             this.GridView1.Rows[i].Cells[1].Controls.Add(child);
         }
         for (int j = 2; j < 12; j++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[j].Text, -1) == 0)
             {
                 HtmlImage image = new HtmlImage();
                 image.Src = "../Images/blue_" + ((j - 2)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[j].Controls.Add(image);
             }
         }
         for (int k = 12; k < 0x16; k++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[k].Text, -1) == 0)
             {
                 HtmlImage image2 = new HtmlImage();
                 image2.Src = "../Images/orange_" + ((k - 12)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[k].Controls.Add(image2);
             }
         }
         for (int m = 0x16; m < 0x20; m++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[m].Text, -1) == 0)
             {
                 HtmlImage image3 = new HtmlImage();
                 image3.Src = "../Images/red_" + ((m - 0x16)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[m].Controls.Add(image3);
             }
         }
         for (int n = 0x20; n < 0x2a; n++)
         {
             if (_Convert.StrToInt(this.GridView1.Rows[i].Cells[n].Text, -1) == 0)
             {
                 HtmlImage image4 = new HtmlImage();
                 image4.Src = "../Images/blue_" + ((n - 0x20)).ToString() + ".gif";
                 this.GridView1.Rows[i].Cells[n].Controls.Add(image4);
             }
         }
     }
 }