private DataRow GetFirstDataRow(DataTable dt) { if (dt == null) { return(null); } Int32Collection m_Rows = this.OneValueScFilter.Filter.GetFilteredRows(dt); if (this.ExControl.Report != null) { m_Rows = this.ExControl.Report.Filter.GetFilteredRows(dt, m_Rows); } m_Rows = this.RepeatFilter.Filter.GetFilteredRows(dt, m_Rows); m_Rows = this.Filter.GetFilteredRows(dt, m_Rows); GroupResultCollection results = this.SortingColumns.Sorting(dt, m_Rows); if (results != null && results.Count != 0) { m_Rows = results[0].RowIndicators; } if (this.IndexRow >= m_Rows.Count || IndexRow < 0) { return(null); } int getRow = m_Rows[IndexRow]; return(dt.Rows[getRow]); }
private void GetAllGroupResults(GroupInfo i_GroupInfo, ref GroupResultCollection results) { int m_Rows = i_GroupInfo.GetGroupedRows(); if (i_GroupInfo.GroupResults != null) { //sort group result if (!(i_GroupInfo is SectionGroupInfo)) { i_GroupInfo.GroupResults.Sort(i_GroupInfo.Sorting, i_GroupInfo.SortingBy); } } for (int m_row = 0; m_row < m_Rows; m_row++) //The last row is for the total value. { GroupResult m_GroupResult = i_GroupInfo.GroupResults[m_row]; if (m_GroupResult.Summaries != null && m_GroupResult.SubGroupInfos.Count == 0) { results.Add(m_GroupResult); } if (m_GroupResult.SubGroupInfos.Count > 0) { this.GetAllGroupResults(m_GroupResult.SubGroupInfos[0], ref results); } } }
private void DrawGroupedText(Graphics g, Rectangle rect) { GroupResultCollection results = new GroupResultCollection(); this.GetAllGroupResults(this._RootGroupInfo, ref results); int columns = this.GetColumns(); double width = 0; double offset = 0, space = 2; if (columns == 0) { width = 0; return; } else { width = (double)rect.Width / columns; } int count = Math.Min(columns, results.Count); for (int i = 0; i < count; i++) { RectangleF rectText = new RectangleF(new PointF((float)(rect.Left + offset), (float)(rect.Bottom + space)), new SizeF((float)width, 20)); g.DrawString(results[i].GroupValue.ToString(), this._Font, Brushes.Black, rectText, this._StringFormat); offset += width; } }
private string GetFieldValue(DataTable dt) //Modified at 2009-1-4 9:57:34@Scott { string strRet = string.Empty; if (dt == null || this.ExControl == null) { return("<NULLVALUES>"); } if (_Field == null || (this._Field == string.Empty) || _Field == "<None>" || !dt.Columns.Contains(_Field)) { return("<NULLVALUES>"); } Int32Collection m_Rows = this.OneValueScFilter.Filter.GetFilteredRows(dt); if (this.ExControl.Report != null) { m_Rows = this.ExControl.Report.Filter.GetFilteredRows(dt, m_Rows); } m_Rows = this.RepeatFilter.Filter.GetFilteredRows(dt, m_Rows); if (this.SortingColumns.Count > 0) { GroupResultCollection results = this.SortingColumns.Sorting(dt, m_Rows); if (results != null && results.Count != 0) { m_Rows = results[0].RowIndicators; } } if (m_Rows.Count == 0) { return("<NULLVALUES>"); } int firstRow = m_Rows[0]; if (dt.Rows[firstRow][_Field] is System.DBNull || dt.Rows[firstRow][_Field] == null) { return(string.Empty); } strRet = (string)dt.Rows[firstRow][_Field]; return(strRet); }
private string GetPlayBookImagePath(DataTable dt) //Modified at 2009-1-4 9:57:34@Scott { string strRet = string.Empty; if (dt == null || this.ExControl == null) { return(strRet); } if (!dt.Columns.Contains("ImagePath")) { return(string.Empty); } Int32Collection m_Rows = this.OneValueScFilter.Filter.GetFilteredRows(dt); if (this.ExControl.Report != null) { m_Rows = this.ExControl.Report.Filter.GetFilteredRows(dt, m_Rows); } m_Rows = this.RepeatFilter.Filter.GetFilteredRows(dt, m_Rows); if (this.SortingColumns.Count > 0) { GroupResultCollection results = this.SortingColumns.Sorting(dt, m_Rows); if (results != null && results.Count != 0) { m_Rows = results[0].RowIndicators; } } if (m_Rows.Count == 0) { return(string.Empty); } int firstRow = m_Rows[0]; strRet = (string)dt.Rows[firstRow]["ImagePath"]; return(strRet); }
internal static UCGroupResults Create(GroupResultCollection gpResults) { UCGroupResults r = new UCGroupResults(); foreach (GroupResult gr in gpResults) { UCPersonResults ucPrs = Create(gr); ucPrs.Dock = DockStyle.Fill; string gpName = gr.TblGroup.GroupName; TabPage page = new TabPage(gpName); page.Controls.Add(ucPrs); r.TabC.TabPages.Add(page); } return r; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGenerate_Click(object sender, EventArgs e) { // clear panel // this.panel1.Controls.Clear(); DateTime month = new DateTime( this.dtpMonth.Value.Year, this.dtpMonth.Value.Month, 1); DB db = DBFactory.GetDB(); KResultGenerator gen = new KResultGenerator(db, month); GroupResultCollection grs = gen.Generate(); _groupResults = grs; Control c = UIHelper.Create(grs); c.Dock = DockStyle.Fill; this.panel1.Controls.Add(c); }
internal void Export(GroupResultCollection grs) { _grs = grs; string file = Path.GetTempFileName("xls"); XlsFile xls = new XlsFile(); xls.NewFile(GetPersonCount()); int n = 0; foreach (GroupResult gr in grs) { foreach (PersonResult pr in gr.PersonResults) { n++; xls.ActiveSheet = n; xls.SheetName = GetSheetName(gr, pr); DataTable tbl = ResultDataTableConverter.ToPersonResultDataTable(pr); Write(xls, tbl, pr.CalcSumOfWorkTimeSpan()); } } xls.Save(file); Open(file); }
public void AddTotalAndOthers(System.Data.DataTable i_Table, Int32Collection outerRows, Int32Collection innerRows) { if (this.RootGroupInfo == null) { return; } GroupResultCollection m_newResults = new GroupResultCollection(); GroupResult m_TotalGroupResult = new GroupResult(); m_TotalGroupResult.Summaries = new GroupSummaryCollection(); GroupResult m_OtherGroupResult = new GroupResult(); m_OtherGroupResult.Summaries = new GroupSummaryCollection(); if (this.TotalPosition != TotalType.None) { #region Caclculate Result for Total m_TotalGroupResult.GroupValue = this.RootGroupInfo.TotalTitle; m_TotalGroupResult.RowIndicators = new Int32Collection(); m_TotalGroupResult.ParentGroupInfo = this.RootGroupInfo; //Add at 2009-2-19 14:23:47@Simon innerRows.CopyTo(m_TotalGroupResult.RowIndicators); if (this.RootGroupInfo.Summaries.Count > 0) { GroupSummary summaryTotal = this.SummaryForTotalGroup.Copy(); m_TotalGroupResult.Summaries.Add(summaryTotal); m_TotalGroupResult.CalculateSummaryResult(i_Table, innerRows, innerRows); } m_TotalGroupResult.SubGroupInfos = RootGroupInfo.SubGroupInfos.Copy(); foreach (GroupInfo subGroupInfo in m_TotalGroupResult.SubGroupInfos) { subGroupInfo.CalculateGroupResult(i_Table, outerRows, outerRows, innerRows, subGroupInfo); } #endregion } if (this.TotalPosition == TotalType.AllBefore) { m_newResults.Add(m_TotalGroupResult); } if (this.TotalOthersPosition == TotalType.AllBefore) { m_newResults.Add(m_OtherGroupResult); } Int32Collection m_OtherRowsTotal = new Int32Collection(); for (int i = 0; i < this.RootGroupInfo.GroupResults.Count; i++) { if (i >= this.HorizonTopCount && HorizonTopCount > 0) { m_OtherRowsTotal = m_OtherRowsTotal.Combine(this.RootGroupInfo.GroupResults[i].RowIndicators, m_OtherRowsTotal); } else { m_newResults.Add(this.RootGroupInfo.GroupResults[i]); } } if (this.TotalOthersPosition != TotalType.None) { #region calculate Other results m_OtherGroupResult.GroupValue = this.TotalOthersName; m_OtherGroupResult.RowIndicators = new Int32Collection(); m_OtherGroupResult.ParentGroupInfo = this.RootGroupInfo; //Add at 2009-2-19 14:23:47@Simon m_OtherRowsTotal.CopyTo(m_OtherGroupResult.RowIndicators); if (this.RootGroupInfo.Summaries.Count > 0) { GroupSummary summaryTotal = this.SummaryForOthers.Copy(); m_OtherGroupResult.Summaries.Add(summaryTotal); m_OtherGroupResult.CalculateSummaryResult(i_Table, outerRows, m_OtherRowsTotal); } m_OtherGroupResult.SubGroupInfos = this.RootGroupInfo.SubGroupInfos.Copy(); foreach (GroupInfo subGroupInfo in m_OtherGroupResult.SubGroupInfos) { subGroupInfo.CalculateGroupResult(i_Table, m_OtherRowsTotal, outerRows, m_OtherRowsTotal, subGroupInfo); } #endregion } if (this.TotalOthersPosition == TotalType.AllAfter) { m_newResults.Add(m_OtherGroupResult); } if (this.TotalPosition == TotalType.AllAfter) { m_newResults.Add(m_TotalGroupResult); } this.RootGroupInfo.ResetGroupResults(m_newResults); }