/// <summary> /// 添加对账记录 /// </summary> /// <param name="checking"></param> public static void AddAccountChecking(ClienterAccountChecking checking) { string sql = @"INSERT INTO ClienterAccountChecking(ClienterId, CreateDate, FlowStatMoney, ClienterTotalMoney, StartDate, EndDate,LastTotalMoney) VALUES (@ClienterId, @CreateDate, @FlowStatMoney, @ClienterTotalMoney, @StartDate, @EndDate,@LastTotalMoney)" ; using (var conn = GetConnection(WriteConnectionString)) { conn.Execute(sql, checking); } }
public static void SendEmail(string[] lines) { var stringbuilder = new StringBuilder(); stringbuilder.AppendLine(ClienterAccountChecking.Header() + "<br />"); if (lines != null && lines.Length > 0) { foreach (var item in lines) { stringbuilder.AppendLine(item + "<br />"); } } string[] emails = ConfigurationManager.AppSettings["receiveEmailList"].Split(';'); EmailService.SendEmail(emails, "对账数据分析", stringbuilder.ToString()); }
private static void Check(IDictionary <int, ClienterAccountBalance> clienters, IDictionary <int, ClienterFlowStat> flows, DateTime startDate, DateTime enddate) { foreach (KeyValuePair <int, ClienterAccountBalance> item in clienters) { Decimal flowTotalMoney = 0; if (flows.ContainsKey(item.Key)) { flowTotalMoney = flows[item.Key].Amcount; } ClienterAccountChecking lastChecking = RepositoryService.GetLastStat(item.Key); if (lastChecking != null) { var checking = new ClienterAccountChecking() { ClienterId = item.Key, CreateDate = DateTime.Now, LastTotalMoney = lastChecking.ClienterTotalMoney, ClienterTotalMoney = item.Value.AccountBalance, FlowStatMoney = flowTotalMoney, StartDate = startDate, EndDate = enddate, }; bool isEqual = item.Value.AccountBalance == lastChecking.LastTotalMoney + flowTotalMoney; if (!isEqual) { ErrorService.Add(checking.ToString()); } RepositoryService.AddAccountChecking(checking); } else { var checking = new ClienterAccountChecking() { ClienterId = item.Key, CreateDate = DateTime.Now, LastTotalMoney = item.Value.AccountBalance, ClienterTotalMoney = item.Value.AccountBalance, FlowStatMoney = flowTotalMoney, StartDate = startDate, EndDate = enddate, }; RepositoryService.AddAccountChecking(checking); System.Diagnostics.Debug.WriteLine(checking.ClienterId); } } }