Example #1
0
        private List <object> SetupDataSource(object data, IDataNavigator navigator)
        {
            navigator.Reset();
            List <object> list = new List <object>();

            while (navigator.MoveNext())
            {
                CurrentItemsCollection row         = navigator.GetDataRow();
                CurrentItem            currentItem = ExtractItemFromDataSet(row, data);

                if (currentItem != null)
                {
                    object s1 = Convert.ToString(currentItem.Value.ToString(), CultureInfo.CurrentCulture);

                    if (IsNumeric(s1))
                    {
                        list.Add(Convert.ToDouble(s1, System.Globalization.CultureInfo.CurrentCulture));
                    }
                    else
                    {
                        list.Add(true);
                    }
                }
                else
                {
                    string str = String.Format("<{0}> not found in AggregateFunction", data.ToString());
                    throw new FieldNotFoundException(str);
                }
            }
            return(list);
        }
Example #2
0
        public override CurrentItemsCollection FillDataRow(int pos)
        {
            CurrentItemsCollection ci = new CurrentItemsCollection();
            var obj = CurrentFromPosition(pos);

            if (obj != null)
            {
                CurrentItem currentItem = null;
                foreach (PropertyDescriptor pd in this.listProperties)
                {
                    currentItem = new CurrentItem(pd.Name, pd.PropertyType);
                    PropertyPath prop = obj.ParsePropertyPath(pd.Name);
                    if (prop != null)
                    {
                        var pp = prop.Evaluate(obj);
                        if (pp != null)
                        {
                            currentItem.Value = pp.ToString();
                        }
                    }
                    ci.Add(currentItem);
                }
            }
            return(ci);
        }
Example #3
0
        private static CurrentItem  ExtractItemFromDataSet(CurrentItemsCollection row, object data)
        {
            CurrentItem currentItem = null;

            if (data != null)
            {
                currentItem = row.Find(data.ToString());
            }
            else
            {
                currentItem = row.Find(row[0].ColumnName);
            }
            return(currentItem);
        }
        public void CreatePlainDataRow()
        {
            ReportSettings rs      = new ReportSettings();
            IDataManager   dm      = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.table, rs);
            DataNavigator  dataNav = dm.GetNavigator;

            while (dataNav.MoveNext())
            {
                CurrentItemsCollection c = dataNav.GetDataRow;
                Assert.AreEqual(typeof(string), c[0].DataType);
                Assert.AreEqual(typeof(string), c[1].DataType);
                Assert.AreEqual(typeof(string), c[2].DataType);
                Assert.AreEqual(typeof(int), c[4].DataType);
                Assert.AreEqual(typeof(DateTime), c[5].DataType);
            }
        }
        CurrentItemsCollection FillCurrentRow(DataRow row)
        {
            CurrentItemsCollection ci = new CurrentItemsCollection();

            if (row != null)
            {
                CurrentItem c = null;
                foreach (DataColumn dc in table.Columns)
                {
                    c       = new CurrentItem(dc.ColumnName, dc.DataType);
                    c.Value = row[dc.ColumnName];
                    ci.Add(c);
                }
            }
            return(ci);
        }
        public void DataRowCountEqualListCount()
        {
            ReportSettings rs      = new ReportSettings();
            IDataManager   dm      = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.table, rs);
            DataNavigator  dataNav = dm.GetNavigator;
            int            count   = 0;

            while (dataNav.MoveNext())
            {
                CurrentItemsCollection c = dataNav.GetDataRow;
                if (c != null)
                {
                    count++;
                }
            }
            Assert.AreEqual(this.table.Rows.Count, count);
        }
Example #7
0
        /*
         * public override CurrentItemsCollection FillDataRow(int pos)
         * {
         *  CurrentItemsCollection ci = new CurrentItemsCollection();
         *      var obj = CurrentFromPosition(pos);
         *  if (obj != null)
         *  {
         *      CurrentItem currentItem = null;
         *      foreach (PropertyDescriptor pd in this.listProperties)
         *      {
         *          currentItem = new CurrentItem();
         *          currentItem.ColumnName = pd.Name;
         *          currentItem.DataType = pd.PropertyType;
         *
         *          var propValue = FollowPropertyPath(obj,pd.Name);
         *          if (propValue != null)
         *          {
         *              currentItem.Value = propValue.ToString();
         *          }
         *          else
         *          {
         *              currentItem.Value = String.Empty;
         *          }
         *          ci.Add(currentItem);
         *      }
         *  }
         *  return ci;
         * }
         */


        public override CurrentItemsCollection FillDataRow()
        {
            CurrentItemsCollection ci = base.FillDataRow();

            if (current != null)
            {
                CurrentItem c = null;
                foreach (PropertyDescriptor pd in this.listProperties)
                {
                    c = new CurrentItem(pd.Name, pd.PropertyType);
                    var s = pd.GetValue(this.Current);
                    if (s != null)
                    {
                        c.Value = s.ToString();
                    }
                    else
                    {
                        c.Value = String.Empty;
                    }
                    ci.Add(c);
                }
            }
            return(ci);
        }
 public override CurrentItemsCollection FillDataRow(int pos)
 {
 	CurrentItemsCollection ci = new CurrentItemsCollection();
 	var obj = CurrentFromPosition(pos);
 	if (obj != null)
 	{
 		CurrentItem currentItem = null;
 		foreach (PropertyDescriptor pd in this.listProperties)
 		{
 		    currentItem = new CurrentItem(pd.Name, pd.PropertyType);
 			PropertyPath prop = obj.ParsePropertyPath(pd.Name);
 			if (prop != null)
 			{
 				var pp = prop.Evaluate(obj);
                 if (pp != null)
                 {
                    currentItem.Value = pp.ToString(); 
                 }
 			}
 			ci.Add(currentItem);
 		}
 	}
 	return ci;
 }
Example #9
0
		CurrentItemsCollection FillCurrentRow( DataRow row)
		{
			CurrentItemsCollection ci = new CurrentItemsCollection();
			if (row != null) {
				CurrentItem c = null;
				foreach (DataColumn dc in table.Columns) {
					c = new CurrentItem(dc.ColumnName,dc.DataType);
					c.Value = row[dc.ColumnName];
					ci.Add(c);
				}
			}
			return ci;
		}