ref

     /// <summary>
        /// 公用的添加历史表页面
        /// </summary>
        /// <param name="his"></param>
        /// <param name="model"></param>
        /// <param name="sqls"></param>
        public void AddHis(M_Fina_ProofHis his, ref List<string> sqls)
        {
            sqls.Add(@" insert into Fina_Proof_His 
                        (ProofNewId, ProofId, UserId, TrueName, OrgCode, OrgName, AddTime, Remark, NodeCode, NodeName) 
                        values ( '" + his.ProofNewId + @"',(select top 1 id from Fina_Proof where proofid='" + his.ProofNewId + @"'),'" + his.UserId + @"', '" + his.TrueName + @"', '" + his.OrgCode + @"', '" + his.OrgName + @"',getdate(),'" + his.Remark + @"','" + his.NodeCode + @"',(select top 1 nodename from Fina_Flow_Node where nodecode='" + his.NodeCode + @"' and flag=0)) ");
        }

        /// <summary>
        /// 新增凭证
        /// </summary>
        /// <param name="model"></param>
        /// <param name="his"></param>
        /// <returns></returns>
        public bool AddProof(M_Fina_Proof model, M_Fina_ProofHis his)
        {
            List<string> sqls = new List<string>();
            sqls.Add(@" insert into Fina_Proof
                        ( ProofId, AddTime, UserId, TrueName, OrgCode, OrgName, Remark, ProofDate, ProofTypeCode, ProofTypeName, ProofNum, TotalMoney, Comment, NodeCode, State) 
                values ( '" + model.ProofId + @"',getdate(),'" + model.UserId + @"','" + model.TrueName + @"','" + model.OrgCode + @"','" + model.OrgName + @"','" + model.Remark + @"','" + model.ProofDate + @"','" + model.ProofTypeCode + @"','" + model.ProofTypeName + @"',(select count(1) from Fina_Proof_Img where ProofNewId='" + model.ProofId + @"'),'" + model.TotalMoney + @"','" + model.Comment + @"','" + model.NodeCode + @"','" + model.State + @"')  ");
            sqls.Add(" update Fina_Proof_Img set ProofId=(select top 1 Id from Fina_Proof where ProofId='" + model.ProofId + @"') where ProofNewId='" + model.ProofId + @"' ");
            AddHis(his, ref sqls);
            return DataHelper.ExecuteSqlTran(sqls);
        }
 
原文地址:https://www.cnblogs.com/yueyuepeng/p/5063345.html