Exemple #1
0
        public static void AddHeaderRow(this HtmlTable table, String headerStyle, ColumnHeaderInfo[] columns)
        {
            HtmlTableRow hRow = new HtmlTableRow();

            if (!String.IsNullOrEmpty(headerStyle))
            {
                hRow.SetRowStyle(headerStyle);
            }

            foreach (ColumnHeaderInfo ci in columns)
            {
                HtmlTableCell col = new HtmlTableCell();
                if (!String.IsNullOrEmpty(ci.Style))
                {
                    col.SetHeaderCellStyle(ci.Style);
                }
                if (!String.IsNullOrEmpty(ci.Label))
                {
                    col.Controls.Add(ci.ControlLiteral);
                }
                hRow.Cells.Add(col);
            }

            table.Rows.Add(hRow);
        }
Exemple #2
0
        public static HtmlTableCell AddDataCell(this HtmlTableRow row, Control control,
                                                String cellID = null, String colSpan = null, String headerStyle = null)
        {
            HtmlTableCell cell = new HtmlTableCell();

            if (!String.IsNullOrEmpty(headerStyle))
            {
                cell.SetHeaderCellStyle(headerStyle);
            }
            else
            {
                cell.SetDataCellStyle();
            }
            if (!String.IsNullOrEmpty(colSpan))
            {
                cell.ColSpan = Convert.ToInt32(colSpan);
            }
            cell.ID = cellID;
            cell.Controls.Add(control);

            row.Cells.Add(cell);
            return(cell);
        }
    public void CreatetSignatureTable()
    {
        HtmlTableCell cell;

        CssPostfix = WebConstants.GetCssPostfix(Page.Theme);
        tbSignature.Rows.Clear();
        tbSignature.SetTableStyle(CssPostfix);
        tbCtrl_Signature.SetTableControlStyle(CssPostfix);
        tbCtrl_Signature.Attributes["border"] = "1";
        int count = 0;

        if (PersonList != null)
        {
            count = PersonList.Count;
        }



        HtmlTableRow trHeader = null;

        if (showHeader)
        {
            cell = new HtmlTableCell()
            {
                InnerHtml = HeaderText
            };
            cell.SetHeaderCellStyle(CssPostfix);
            cell.Attributes["style"] = "text-align:center";
            trHeader = new HtmlTableRow();
            trHeader.SetRowStyle(CssPostfix);
            trHeader.Cells.Add(cell);
            tbSignature.Rows.Add(trHeader);
        }

        HtmlTableRow trSignature       = new HtmlTableRow();
        HtmlTableRow trPartyName       = new HtmlTableRow();
        HtmlTableRow trEffectivePeriod = null;
        HtmlTableRow trEditPerson      = new HtmlTableRow();

        trSignature.SetRowStyle(CssPostfix);
        trPartyName.SetRowStyle(CssPostfix);
        trEditPerson.SetRowStyle(CssPostfix);
        tbSignature.Rows.Add(trSignature);
        tbSignature.Rows.Add(trPartyName);
        tbSignature.Rows.Add(trEditPerson);

        if (count > 0)
        {
            ASPxBinaryImage signature;
            switch (DirectionAlign)
            {
            case TableDirection.Vertical:
                break;

            default:
                count = PersonList.Count;
                if (showHeaderLeft)
                {
                    cell = new HtmlTableCell()
                    {
                        Align = "Center", InnerHtml = Resource_Person.Signature
                    };
                    cell.SetHeaderCellStyle(CssPostfix);
                    trSignature.Cells.Add(cell);

                    cell = new HtmlTableCell()
                    {
                        Align = "Center", InnerHtml = Resource_Person.FullName
                    };
                    cell.SetHeaderCellStyle(CssPostfix);
                    trPartyName.Cells.Add(cell);

                    // Edit Person Button
                    cell = new HtmlTableCell()
                    {
                        Align = "Center", InnerHtml = "แก้ไขข้อมูล"
                    };
                    cell.SetHeaderCellStyle(CssPostfix);
                    trEditPerson.Cells.Add(cell);

                    if (showEffective)
                    {
                        trEffectivePeriod = new HtmlTableRow();
                        cell = new HtmlTableCell(TH_TAGNAME)
                        {
                            Align = "Center", InnerHtml = Resource_Global.EffectivePeriod
                        };
                        cell.SetHeaderCellStyle(CssPostfix);
                        trEffectivePeriod.Cells.Add(cell);
                    }
                }
                for (int i = 0; i < PersonList.Count; i++)
                {
                    // Signature Row
                    System.Drawing.Image sig = PersonList[i].GetSignature(DateTime.Now);
                    cell = new HtmlTableCell()
                    {
                        ID = string.Format("sig{0}", i), Align = "Center"
                    };
                    cell.SetDataCellStyle();
                    cell.NoWrap = true;
                    trSignature.Cells.Add(cell);
                    if (sig != null)
                    {
                        signature = new ASPxBinaryImage();
                        signature.ContentBytes = WebHelper.ImageUtil.ImageToBytes(sig);
                        cell.Controls.Add(signature);
                    }
                    else
                    {
                        cell.InnerHtml = "&nbsp;";
                    }
                    // Party Name Row
                    cell = new HtmlTableCell()
                    {
                        ID = string.Format("signame{0}", i), Align = "Center"
                    };
                    cell.SetDataCellStyle();
                    cell.NoWrap    = true;
                    cell.InnerHtml = PersonList[i].FullName;
                    trPartyName.Cells.Add(cell);

                    // Edit Person
                    cell = new HtmlTableCell()
                    {
                        ID = string.Format("editPers{0}", i), Align = "Center"
                    };
                    cell.SetDataCellStyle();
                    cell.NoWrap = true;

                    editPerson = new ASPxButton()
                    {
                        AutoPostBack = false
                    };
                    editPerson.SetEditButton();
                    editPerson.ClientInstanceName = this.ClientID + editPerson.ID;

                    editPerson.ClientSideEvents.Click = @"function(s, e)
                        {
                            cbpEditPerson.PerformCallback('" + PersonList[i].PartyID + @"');
                        }";

                    cbpEditPerson.ClientSideEvents.EndCallback = @"function(s, e)
		                {
		                    popupEditPerson.Show();
		                }"        ;

                    cell.Controls.Add(editPerson);
                    trEditPerson.Cells.Add(cell);

                    // Effective Period Row
                    if (showEffective)
                    {
                        cell = new HtmlTableCell()
                        {
                            ID = string.Format("sigeff{0}", i), Align = "Center"
                        };
                        cell.SetDataCellStyle();
                        cell.NoWrap = true;
                        TimeInterval effectivePeriod = PersonList[i].EffectivePeriod;
                        if (effectivePeriod != null)
                        {
                            cell.InnerHtml = PersonList[i].EffectivePeriod.ToString(base.DateOutputFormat, base.LanguageCode);
                        }
                        else
                        {
                            cell.InnerHtml = "N/A";
                        }
                        trEffectivePeriod.Cells.Add(cell);
                    }
                }
                break;
            }
            if (trEffectivePeriod != null)
            {
                trEffectivePeriod.SetRowStyle(CssPostfix);
                tbSignature.Rows.Add(trEffectivePeriod);
            }
        }
        else
        {
            HtmlTableRow trNoData = new HtmlTableRow();
            trNoData.SetRowStyle(CssPostfix);
            cell = new HtmlTableCell()
            {
                ID        = "sigNoData",
                Align     = "Center",
                InnerHtml = "No Person Data"
            };
            cell.SetDataCellStyle();
            trNoData.Cells.Add(cell);
            tbSignature.Rows.Add(trNoData);
        }
        if (trHeader != null)
        {
            if (trPartyName.Cells.Count > 1)
            {
                trHeader.Cells[0].ColSpan = trPartyName.Cells.Count;
            }
        }
    }