コード例 #1
0
        void IBLL.ICashOrder.Add(Model.bank_t_cash_master ord, out string sheet_no)
        {
            IBLL.ICashOrder ins = this;
            ord.sheet_no = ins.MaxCode();
            //
            string sql = "select * from bank_t_cash_master where sheet_no='" + ord.sheet_no + "'";
            var    db  = new DB.DBByHandClose(Appsetting.conn);

            DB.IDB d = db;
            try
            {
                db.Open();

                db.BeginTran();
                //
                var tb = d.ExecuteToTable(sql, null);
                if (tb.Rows.Count != 0)
                {
                    throw new Exception("已存在单号" + ord.sheet_no);
                }
                d.Insert(ord);

                //
                db.CommitTran();
            }
            catch (Exception ex)
            {
                db.RollBackTran();
                LogHelper.writeLog("", ex.ToString());
                throw;
            }
            finally
            {
                db.Close();
            }
            sheet_no = ord.sheet_no;
        }