Exemple #1
0
        /// <summary>
        /// 审核补扣款
        /// </summary>
        /// <param name="info">扣补款对象</param>
        public static bool UpdateInfoTran(DeductModel info)
        {
            using (SqlConnection conn = new SqlConnection(DBHelper.connString))
            {
                conn.Open();
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    if (DeductDAL.UpdateDeduct(info, tran) <= 0)
                    {
                        tran.Rollback();
                        return(false);
                    }
                    if (!ReleaseDAL.UpdateDeductOut(tran, info.Number, info.IsDeduct, info.DeductMoney))
                    {
                        tran.Rollback();
                        return(false);
                    }
                    DirectionEnum de = DirectionEnum.AccountsIncreased;
                    if (info.IsDeduct == 0)
                    {
                        de = DirectionEnum.AccountReduced;
                    }
                    string remark = "";
                    if (info.IsDeduct == 0)
                    {
                        remark = "008021~【" + info.Number + "】~000153~" + info.ExpectNum + "~008022";
                        D_AccountDAL.AddAccountWithdraw1(info.Number, info.DeductMoney, D_AccountSftype.MemberType, D_Sftype.BounsAccount, D_AccountKmtype.AddMoneycut, de, remark, tran);
                    }
                    else
                    {
                        remark = "008021~【" + info.Number + "】~000153~" + info.ExpectNum + "~008023";
                        D_AccountDAL.AddAccountWithdraw1(info.Number, info.DeductMoney, D_AccountSftype.MemberType, D_Sftype.BounsAccount, D_AccountKmtype.AddMoneyget, de, remark, tran);
                    }

                    tran.Commit();
                    return(true);
                }
                catch
                {
                    tran.Rollback();
                    return(false);
                }
                finally
                {
                    conn.Close();
                    conn.Dispose();
                }
            }
        }