/// <summary> /// 保存账单科目信息到数据库 /// <param name="guid"></param> /// <param name="lstBillItems"></param> public static void SaveBillItemTempDataBase(string guid, List <BillItem> lstBillItems) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("BillID", typeof(long))); dt.Columns.Add(new DataColumn("Subject", typeof(byte))); dt.Columns.Add(new DataColumn("DueDate", typeof(DateTime))); dt.Columns.Add(new DataColumn("Amount", typeof(decimal))); dt.Columns.Add(new DataColumn("DueAmt", typeof(decimal))); dt.Columns.Add(new DataColumn("ReceivedAmt", typeof(decimal))); dt.Columns.Add(new DataColumn("CreateTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("FullPaidTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("Overdue", typeof(int))); dt.Columns.Add(new DataColumn("SubjectType", typeof(byte))); dt.Columns.Add(new DataColumn("OperatorID", typeof(int))); dt.Columns.Add(new DataColumn("IsCurrent", typeof(bool))); dt.Columns.Add(new DataColumn("IsShelve", typeof(bool))); dt.Columns.Add(new DataColumn("BusinessID", typeof(byte))); dt.Columns.Add(new DataColumn("PenaltyIntAmt", typeof(decimal))); dt.Columns.Add(new DataColumn("Guid", typeof(string))); DataRow dr = null; foreach (BillItem receive in lstBillItems) { dr = dt.NewRow(); dr["BillID"] = receive.BillID; dr["Subject"] = receive.Subject; //dr["DueDate"] = receive.DueDate; dr["Amount"] = receive.Amount; dr["DueAmt"] = receive.DueAmt; dr["ReceivedAmt"] = receive.ReceivedAmt; dr["CreateTime"] = receive.CreateTime; dr["FullPaidTime"] = receive.FullPaidTime; //dr["Overdue"] = receive.Overdue; dr["SubjectType"] = receive.SubjectType; dr["OperatorID"] = receive.OperatorID; dr["IsCurrent"] = receive.IsCurrent; dr["IsShelve"] = receive.IsShelve; dr["BusinessID"] = receive.BusinessID; dr["PenaltyIntAmt"] = receive.PenaltyIntAmt; dr["Guid"] = guid; dt.Rows.Add(dr); } dt.TableName = "BillItemTemp"; SqlBulkHelper.ExecuteBulkImport("BillItemTemp", dt, "PostLoanDB", 1); }
/// <summary> /// 保存账单信息到数据库 /// </summary> /// <param name="guid"></param> /// <param name="bill"></param> private void SaveBillToDataBase(string guid, Bill bill) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("BillType", typeof(byte))); dt.Columns.Add(new DataColumn("BillStatus", typeof(byte))); dt.Columns.Add(new DataColumn("BillMonth", typeof(string))); dt.Columns.Add(new DataColumn("BeginTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("EndTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("LimitTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("CreateTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("Guid", typeof(string))); DataRow dr = dt.NewRow(); dr["BillType"] = bill.BillType; dr["BillStatus"] = bill.BillStatus; dr["BillMonth"] = bill.BillMonth; dr["BeginTime"] = bill.BeginTime; dr["EndTime"] = bill.EndTime; dr["LimitTime"] = bill.LimitTime; dr["CreateTime"] = bill.CreateTime; dr["Guid"] = guid; dt.Rows.Add(dr); dt.TableName = "BillTemp"; try { SqlBulkHelper.ExecuteBulkImport("BillTemp", dt, "PostLoanDB", 1); } catch (Exception ex) { m_Logger.Error("保存账单信息到数据库异常:" + ex.Message); m_Logger.Error("保存账单信息到数据库异常:" + ex.StackTrace); } finally { } }
/// <summary> /// 保存业务号列表到数据库 /// </summary> /// <param name="guid"></param> /// <param name="businessIds"></param> private void SaveBusinessIDsListToDataBase(string guid, string businessIds) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("BusinessId", typeof(string))); dt.Columns.Add(new DataColumn("GuiId", typeof(string))); string[] businessIdArray = businessIds.Split( WebServiceConst.Separater_Comma.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (businessIdArray == null || businessIdArray.Length == 0) { return; } DataRow dr = null; foreach (string mobile in businessIdArray) { dr = dt.NewRow(); dr["BusinessId"] = mobile; dr["GuiId"] = guid; dt.Rows.Add(dr); } dt.TableName = "SaveBusinessId"; try { SqlBulkHelper.ExecuteBulkImport("SaveBusinessId", dt, "PostLoanDB", businessIdArray.Length); } catch (Exception ex) { m_Logger.Error("审核员贷后客户逾期情况日报表查询异常:" + ex.Message); m_Logger.Error("审核员贷后客户逾期情况日报表查询异常:" + ex.StackTrace); } finally { } }
/// <summary> /// 保存账单明细到数据库 /// </summary> /// <param name="guid"></param> /// <param name="lstBillItems"></param> private void SaveBillItemToDataBase(string guid, List <BillItem> lstBillItems) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Subject", typeof(byte))); dt.Columns.Add(new DataColumn("Amount", typeof(decimal))); dt.Columns.Add(new DataColumn("DueAmt", typeof(decimal))); dt.Columns.Add(new DataColumn("CreateTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("Guid", typeof(string))); DataRow dr = null; foreach (var bill in lstBillItems) { dr = dt.NewRow(); dr["Subject"] = bill.Subject; dr["Amount"] = bill.Amount; dr["DueAmt"] = bill.DueAmt; dr["CreateTime"] = bill.CreateTime; dr["Guid"] = guid; dt.Rows.Add(dr); } dt.TableName = "BillItemTemp"; try { SqlBulkHelper.ExecuteBulkImport("BillItemTemp", dt, "PostLoanDB", lstBillItems.Count); } catch (Exception ex) { m_Logger.Error("保存账单明细到数据库异常:" + ex.Message); m_Logger.Error("保存账单明细到数据库异常:" + ex.StackTrace); } finally { } }
/// <summary> /// 保存更新条目信息到数据库 /// <param name="guid"></param> /// <param name="lstUpdateItems"></param> public static void SaveUpdateItemTempDataBase(string guid, List <UpdateItem> lstUpdateItems) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Id", typeof(long))); dt.Columns.Add(new DataColumn("Amount", typeof(decimal))); dt.Columns.Add(new DataColumn("ReceivedAmt", typeof(decimal))); dt.Columns.Add(new DataColumn("FullPaidTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("Type", typeof(byte))); dt.Columns.Add(new DataColumn("Guid", typeof(string))); DataRow dr = null; foreach (UpdateItem receive in lstUpdateItems) { dr = dt.NewRow(); dr["Id"] = receive.Id; dr["Amount"] = receive.Amount; dr["ReceivedAmt"] = receive.ReceivedAmt; if (receive.FullPaidTime.HasValue) { dr["FullPaidTime"] = receive.FullPaidTime; } else { dr["FullPaidTime"] = DBNull.Value; } dr["Type"] = receive.Type; dr["Guid"] = guid; dt.Rows.Add(dr); } dt.TableName = "UpdateItemTemp"; SqlBulkHelper.ExecuteBulkImport("UpdateItemTemp", dt, "PostLoanDB", 1); }
/// <summary> /// 保存实收信息到数据库 /// </summary> /// <param name="receive"></param> public static void SaveReceivedDataBase(List <Received> lstReceiveds) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("BillID", typeof(long))); dt.Columns.Add(new DataColumn("BillItemID", typeof(long))); dt.Columns.Add(new DataColumn("Amount", typeof(decimal))); dt.Columns.Add(new DataColumn("ReceivedType", typeof(byte))); dt.Columns.Add(new DataColumn("PayID", typeof(int))); dt.Columns.Add(new DataColumn("ReceivedTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("CreateTime", typeof(DateTime))); dt.Columns.Add(new DataColumn("OperatorID", typeof(int))); dt.Columns.Add(new DataColumn("Explain", typeof(string))); dt.Columns.Add(new DataColumn("DeductionID", typeof(int))); dt.Columns.Add(new DataColumn("ToAccountID", typeof(int))); dt.Columns.Add(new DataColumn("ToAcountTime", typeof(DateTime))); DataRow dr = null; foreach (Received receive in lstReceiveds) { dr = dt.NewRow(); dr["BillID"] = receive.BillID; dr["BillItemID"] = receive.BillItemID; dr["Amount"] = receive.Amount; dr["ReceivedType"] = receive.ReceivedType; dr["PayID"] = receive.PayID; if (receive.ReceivedTime.HasValue) { dr["ReceivedTime"] = receive.ReceivedTime; } else { dr["ReceivedTime"] = DBNull.Value; } dr["CreateTime"] = receive.CreateTime; dr["OperatorID"] = receive.OperatorID; dr["Explain"] = receive.Explain; dr["DeductionID"] = receive.DeductionID; if (receive.ToAccountID.HasValue) { dr["ToAccountID"] = receive.ToAccountID; } else { dr["ToAccountID"] = DBNull.Value; } if (receive.ToAcountTime.HasValue) { dr["ToAcountTime"] = receive.ToAcountTime; } else { dr["ToAcountTime"] = DBNull.Value; } dt.Rows.Add(dr); } dt.TableName = "Received"; SqlBulkHelper.ExecuteBulkImport("Received", dt, "PostLoanDB", 1); }