/// <summary> /// 删除预付 /// </summary> /// <param name="blockId"></param> /// <param name="userId"></param> /// <returns></returns> public bool DeletePurchase(long blockId, long userId) { ctt_contract_cost_dal costDal = new ctt_contract_cost_dal(); var list = costDal.FindByBlockId(blockId); foreach (var cost in list) { cost.delete_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); cost.delete_user_id = userId; costDal.Update(cost); OperLogBLL.OperLogDelete <ctt_contract_cost>(cost, cost.id, userId, OPER_LOG_OBJ_CATE.CONTRACT_COST, "删除合同预付"); } var block = dal.FindById(blockId); if (block == null) { return(false); } block.delete_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); block.delete_user_id = userId; dal.Update(block); OperLogBLL.OperLogDelete <ctt_contract_block>(block, block.id, userId, OPER_LOG_OBJ_CATE.CONTRACT_BLOCK, "删除合同预付"); return(true); }
/// <summary> /// 修改预付 /// </summary> /// <param name="blockEdit"></param> /// <param name="userId"></param> public void EditPurchase(ctt_contract_block blockEdit, long userId) { ctt_contract_block block = dal.FindById(blockEdit.id); ctt_contract_block blockOld = dal.FindById(blockEdit.id); block.start_date = blockEdit.start_date; block.end_date = blockEdit.end_date; block.rate = blockEdit.rate; block.quantity = blockEdit.quantity; block.status_id = blockEdit.status_id; block.date_purchased = blockEdit.date_purchased; block.payment_number = blockEdit.payment_number; block.payment_type_id = blockEdit.payment_type_id; block.description = blockEdit.description; block.update_time = EMT.Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); block.update_user_id = userId; dal.Update(block); OperLogBLL.OperLogUpdate <ctt_contract_block>(block, blockOld, block.id, userId, OPER_LOG_OBJ_CATE.CONTRACT_BLOCK, "修改预付"); ctt_contract_cost_dal costDal = new ctt_contract_cost_dal(); var list = costDal.FindByBlockId(block.id); foreach (var cost in list) { var costEdit = costDal.FindById(cost.id); costEdit.quantity = block.quantity; costEdit.unit_price = block.rate; costEdit.date_purchased = block.date_purchased; costEdit.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); costEdit.update_user_id = userId; costDal.Update(costEdit); OperLogBLL.OperLogUpdate <ctt_contract_cost>(costEdit, cost, costEdit.id, userId, OPER_LOG_OBJ_CATE.CONTRACT_COST, "修改成本"); } }