Ejemplo n.º 1
0
        public static DsRow BinaryMathOperate(DsRow l, DsRow r, Func <decimal, decimal, decimal> func)
        {
            var dsRow = new DsRow();

            for (int i = 2; i < l.m_items.Count && i < r.m_items.Count; i++)
            {
                if (string.IsNullOrWhiteSpace(l.m_items[i]) ||
                    string.IsNullOrWhiteSpace(r.m_items[i]))
                {
                    dsRow.m_items.Add(string.Empty);
                }
                else
                {
                    decimal lValue = 0;
                    decimal rValue = 0;
                    CommUtils.Assert(decimal.TryParse(l.m_items[i], out lValue), "处理DatasetRow过程中,无法将{0}转换为数值", l.m_items[i]);
                    CommUtils.Assert(decimal.TryParse(r.m_items[i], out rValue), "处理DatasetRow过程中,无法将{0}转换为数值", r.m_items[i]);

                    var result = func(lValue, rValue);
                    dsRow.m_items.Add(result.ToString("n2"));
                }
            }

            return(dsRow);
        }
Ejemplo n.º 2
0
 public void RemoveRow(DsRow row)
 {
     if (row != null)
     {
         Rows.RemoveAll(x => x.Name.Equals(row.Name, StringComparison.CurrentCultureIgnoreCase) &&
                        x.Description.Equals(row.Description, StringComparison.CurrentCultureIgnoreCase));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 复制指定行除 Name,Description 外的字段
        /// </summary>
        /// <param name="dsRow"></param>
        public void CopyValueFrom(DsRow dsRow)
        {
            var name        = Name;
            var description = Description;

            m_items.Clear();
            m_items.Add(name);
            m_items.Add(description);
            for (int i = 2; i < dsRow.m_items.Count; i++)
            {
                m_items.Add(dsRow.m_items[i]);
            }
        }
Ejemplo n.º 4
0
        private void ParseDataTable(DataTable table)
        {
            ColumnCount = table.Columns.Count;

            var principalReceivedKey = ".Principal Received";

            Notes = new List <string>();
            Rows  = new List <DsRow>();
            for (int i = 0; i < table.Rows.Count; ++i)
            {
                var row   = table.Rows[i];
                var dsRow = new DsRow(row);
                Rows.Add(dsRow);

                if (dsRow.Description.EndsWith(principalReceivedKey, StringComparison.CurrentCultureIgnoreCase))
                {
                    var noteName = dsRow.Description.Substring(0, dsRow.Description.Length - principalReceivedKey.Length);
                    Notes.Add(noteName);
                }
            }
        }