コード例 #1
0
        private void FillDays(QuarterHelper quarter, string startdate, string enddate, HtmlTextWriter writer, string blockcolor, string href, string blocktext)
        {
            int    endindex;
            int    startindex;
            string strHTML;
            int    imagewidth;

            writer.RenderBeginTag("tr");
            startindex = quarter.getColumnIndex(startdate);
            endindex   = quarter.getColumnIndex(enddate);
            for (int i = 0; i < startindex; i++)
            {
                writer.AddAttribute("width", m_cellWidth);
                writer.AddAttribute("height", m_cellHeight);
                writer.RenderBeginTag("td");
                writer.Write("&nbsp;");
                writer.RenderEndTag();
            }
            ;

            writer.AddAttribute("colspan", (endindex - startindex + 1).ToString());
            writer.AddAttribute("bgColor", blockcolor);
            writer.AddAttribute("width", m_cellWidth);
            writer.AddAttribute("height", m_cellHeight);
            writer.RenderBeginTag("td nowrap");
            if (href != string.Empty)
            {
                imagewidth = (endindex - startindex + 1) * int.Parse(m_cellWidth);

                strHTML =
                    @"<a href='" +
                    href +
                    @"'><img src='" + m_blankGifPath + "' border=0 width=" +
                    imagewidth +
                    @" height=" + m_cellHeight +
                    @" alt='" + blocktext +
                    @"'/></a>";

                writer.Write(strHTML);
            }
            else
            {
                writer.Write("&nbsp;");
            }
            writer.RenderEndTag();


            for (int i = endindex; i < quarter.Days - 1; i++)
            {
                writer.AddAttribute("width", m_cellWidth);
                writer.AddAttribute("height", m_cellHeight);
                writer.RenderBeginTag("td");
                writer.Write("&nbsp;");
                writer.RenderEndTag();
            }
            ;
            writer.RenderEndTag();
        }
コード例 #2
0
ファイル: Default.aspx.cs プロジェクト: deveshs22/HPPortal
 public IEnumerable <Quarter> GetQuarter()
 {
     return(QuarterHelper.GetNextnCurrentQuarter(DateTime.Now));
 }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="date"></param>
 /// <returns></returns>
 public static int GetQuarterNumber(this DateTime date)
 {
     return(QuarterHelper.GetQuarterNumber(date));
 }
コード例 #4
0
        private void RenderRightHandPane(HtmlTextWriter writer)
        {
            string        startdate, enddate, dayname, href, blocktext, blockcolor;
            int           month;
            bool          week    = false;
            QuarterHelper quarter = new QuarterHelper(m_year, m_quarter);

            writer.AddAttribute("style", "width:1px; overflow-x:scroll;");
            writer.AddAttribute("id", "divcal");
            writer.RenderBeginTag("div");

            writer.AddAttribute("border", "1");
            writer.AddAttribute("style", "FONT-SIZE: " + Font.Size + ";FONT-FAMILY: " + Font.Name + ";BORDER-COLLAPSE: collapse");
            writer.AddAttribute("borderColor", "#000000");
            writer.AddAttribute("cellSpacing", "0");
            writer.AddAttribute("cellPadding", "0");
            writer.RenderBeginTag("table");

            writer.RenderBeginTag("tr");
            for (int i = 1; i <= 3; i++)
            {
                month = i + (3 * (quarter.QuarterIndex - 1));
                writer.AddAttribute("align", "center");
                writer.AddAttribute("colspan", quarter.TotalDaysInMonth(month).ToString());
                writer.RenderBeginTag("td");
                writer.AddAttribute("height", m_cellHeight);
                writer.Write(quarter.GetMonthName(i));
                writer.RenderEndTag();
            }
            ;
            writer.RenderEndTag();

            writer.RenderBeginTag("tr");
            for (int i = (3 * quarter.QuarterIndex - 2); i <= (3 * quarter.QuarterIndex); i++)
            {
                for (int j = 1; j <= quarter.TotalDaysInMonth(i); j++)
                {
                    dayname = quarter.GetDayName(i, j);
                    if (dayname == "M")
                    {
                        week = !week;
                    }

                    writer.AddAttribute("align", "center");
                    writer.AddAttribute("width", m_cellWidth);
                    writer.AddAttribute("height", m_cellHeight);
                    if (week)
                    {
                        writer.AddAttribute("bgcolor", m_toggleColor);
                    }
                    writer.RenderBeginTag("td");
                    writer.Write(dayname);
                    writer.RenderEndTag();
                }
            }
            writer.RenderEndTag();

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(m_xmlData);

            XmlNodeList xmlRows = xmlDoc.SelectNodes("//group");
            int         crow    = 0;

            string[] colors = new string[] { "#ff0000", "#00ff00", "#0000ff" };
            foreach (XmlNode xmlRow in xmlRows)
            {
                writer.RenderBeginTag("tr");
                writer.AddAttribute("colspan", (quarter.Days).ToString());
                writer.AddAttribute("width", ((quarter.Days) * int.Parse(m_cellWidth)).ToString());
                writer.AddAttribute("height", m_cellHeight);
                writer.RenderBeginTag("td");
                writer.Write("<img src='" + m_blankGifPath + "' height=1 width=" + ((quarter.Days) * int.Parse(m_cellWidth)).ToString() + "/>&nbsp");
                writer.RenderEndTag();
                writer.RenderEndTag();

                XmlNode node = xmlRow.SelectSingleNode("blockcolor");
                if (node != null)
                {
                    blockcolor = node.InnerText;
                    if (blockcolor.Length == 0)
                    {
                        blockcolor = colors[crow++];
                    }
                }
                else
                {
                    blockcolor = m_blockColor;
                };


                XmlNodeList xmlBlocks = xmlRow.SelectNodes("block");
                if (xmlBlocks.Count == 0)
                {
                    startdate = xmlRow.SelectSingleNode("StartDate").InnerText;
                    node      = xmlRow.SelectSingleNode("EndDate");
                    if (node != null)
                    {
                        enddate = node.InnerText;
                    }
                    else
                    {
                        enddate = DateTime.Parse(startdate).AddYears(10).ToString();
                    }
                    href      = "";               //xmlRow.SelectSingleNode("href").InnerText;
                    blocktext = xmlRow.SelectSingleNode("name").InnerText;
                    FillDays(quarter, startdate, enddate, writer, blockcolor, href, blocktext);
                }
                else
                {
                    foreach (XmlNode xmlBlock in xmlBlocks)
                    {
                        startdate = xmlBlock.SelectSingleNode("StartDate").InnerText;
                        node      = xmlBlock.SelectSingleNode("EndDate");
                        if (node != null)
                        {
                            enddate = node.InnerText;
                        }
                        else
                        {
                            enddate = DateTime.Parse(startdate).AddYears(10).ToString();
                        }
                        href      = xmlBlock.SelectSingleNode("href").InnerText;
                        blocktext = xmlBlock.SelectSingleNode("name").InnerText;

                        FillDays(quarter, startdate, enddate, writer, blockcolor, href, blocktext);
                    }
                }
            }
            writer.RenderEndTag();             // close table tag
            writer.RenderEndTag();             // close div tag
        }
コード例 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="date"></param>
 /// <returns></returns>
 public static DateTime GetQuarterEnd(this DateTime date)
 {
     return(QuarterHelper.GetQuarterEnd(date));
 }