示例#1
0
        public void Save(Verification verification)
        {
            using (var core = new StandardBusinessLayer(this))
            {
                core.Connect();

                bool newVerification = verification.No == 0;
                core.Save(verification);

                FillVerification(verification);

                if (newVerification)
                {
                    Verifications.Add(verification);
                }
                else
                {
                    for (int i = 0; i < Verifications.Count(); i++)
                    {
                        if (Verifications[i].No == verification.No)
                        {
                            Verifications[i] = verification;
                            break;
                        }
                    }

                    for (int i = 0; i < AccountTransactions.Count(); i++)
                    {
                        if (AccountTransactions[i].VerificationNo == verification.No)
                        {
                            AccountTransactions[i].SetTransactionTime(verification.Date);
                            AccountTransactions[i].SetAccountingDate(verification.AccountingDate);
                            break;
                        }
                    }
                    for (int i = 0; i < CashBookTransactions.Count(); i++)
                    {
                        if (CashBookTransactions[i].VerificationNo == verification.No)
                        {
                            CashBookTransactions[i].SetTransactionTime(verification.Date);
                            CashBookTransactions[i].SetAccountingDate(verification.AccountingDate);
                            break;
                        }
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// 添加范围的判断, 用于如数据存在内存中
 /// </summary>
 /// <param name="name">规则名称</param>
 /// <param name="actual">真实值</param>
 /// <param name="minValue">期望的最小值</param>
 /// <param name="maxValue">期望的最大值</param>
 public void AddValueRange(string name, dynamic actual, dynamic minValue, dynamic maxValue)
 {
     Verifications.Add(new ValueRange(name, actual, minValue, maxValue));
 }
示例#3
0
 /// <summary>
 /// 添加小于的判断, 用于如数据存在内存中
 /// </summary>
 /// <param name="name">规则名称</param>
 /// <param name="actual">真实值</param>
 /// <param name="value">期望小于的值</param>
 public void AddValueLess(string name, dynamic actual, dynamic value)
 {
     Verifications.Add(new ValueLess(name, actual, value));
 }
示例#4
0
 /// <summary>
 /// 添加相等的判断, 用于如数据存在内存中
 /// </summary>
 /// <param name="name">规则名称</param>
 /// <param name="actual">真实值</param>
 /// <param name="expected">期望值</param>
 public void AddValueEqual(string name, dynamic actual, dynamic expected)
 {
     Verifications.Add(new ValueEqual(name, actual, expected));
 }
示例#5
0
 /// <summary>
 /// 添加范围的判断
 /// </summary>
 /// <param name="name">规则名称</param>
 /// <param name="sql">SQL语句, 必须包含Result结果, 如: SELECT COUNT(*) AS Result FROM db.table1</param>
 /// <param name="minValue">期望的最小值</param>
 /// <param name="maxValue">期望的最大值</param>
 public void AddSqlRange(string name, string sql, dynamic minValue, dynamic maxValue)
 {
     Verifications.Add(new SqlRange(name, sql, minValue, maxValue));
 }
示例#6
0
 /// <summary>
 /// 添加小于的判断
 /// </summary>
 /// <param name="name">规则名称</param>
 /// <param name="sql">SQL语句, 必须包含Result结果, 如: SELECT COUNT(*) AS Result FROM db.table1</param>
 /// <param name="value">期望小于的值</param>
 public void AddSqlLess(string name, string sql, dynamic value)
 {
     Verifications.Add(new SqlLess(name, sql, value));
 }