public AssetCashflowHistory NewAssetCashflowHistory(AssetCashflowHistory assetCashflowHistory) { var tableObject = assetCashflowHistory.GetTableObject(); var assetCashflowHistoryId = m_db.Insert("AssetCashflowHistory", "asset_cashflow_history_id", true, tableObject); assetCashflowHistory.AssetCashflowHistoryId = (int)assetCashflowHistoryId; return(assetCashflowHistory); }
public ActionResult UpdatePaymentHistoryAssetCashflow(string projectGuid, string paymentDate, int assetId, decimal principal, decimal interest, string comment) { return(ActionUtils.Json(() => { CommUtils.Assert(!string.IsNullOrEmpty(comment), "[说明]不能为空"); CommUtils.Assert(DateUtils.IsDigitDate(paymentDate), "Parse payment date failed [" + paymentDate + "]."); var project = m_dbAdapter.Project.GetProjectByGuid(projectGuid); var assetPaymentInfo = m_dbAdapter.PaymentHistory.GetCurrentAssetPaymentInfo(project.ProjectId, DateUtils.ParseDigitDate(paymentDate), assetId); var now = DateTime.Now; var history = new AssetCashflowHistory(); history.ProjectId = project.ProjectId; history.PaymentDate = DateUtils.ParseDigitDate(paymentDate); history.AssetId = assetId; history.AssetName = assetPaymentInfo.AssetName; history.HandleType = AssetCashflowHandleType.UserEdit; history.Comment = comment; history.TimeStamp = now; history.TimeStampUserName = CurrentUserName; if (principal != assetPaymentInfo.Principal) { history.FieldType = AssetCashflowFieldType.Pricipal; history.FieldValue = principal.ToString(); m_dbAdapter.PaymentHistory.NewAssetCashflowHistory(history); } if (interest != assetPaymentInfo.Interest) { history.FieldType = AssetCashflowFieldType.Interest; history.FieldValue = interest.ToString(); m_dbAdapter.PaymentHistory.NewAssetCashflowHistory(history); } return ActionUtils.Success(""); })); }
public int UpdateAssetCashflowHistory(AssetCashflowHistory history) { var historyTable = history.GetTableObject(); return(m_db.Update("AssetCashflowHistory", "asset_cashflow_history_id", historyTable, history.AssetCashflowHistoryId)); }