Ejemplo n.º 1
0
        /// <summary>
        /// 更新盘点单
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public int UpdateCheckBill(CheckBillInfo checkBill, bool changebody, SqlTransaction trans)
        {
            string sql = @"UPDATE [CheckBillHead]
                               SET [CheckNO] = @CheckNO
                                  ,[WarehouseID] = @WarehouseID
                                  ,[Cdate] = @Cdate
                                  ,[Cuser] = @Cuser
                                  ,[detail] = @detail
                                  ,[IsReview] = @IsReview
                                  ,[ReviewUser] = @ReviewUser
                                  ,[UpdateDateTime] = @UpdateDateTime
                                  ,[UpdateUser] = @UpdateUser
                             WHERE id=@id";

            SqlParameter[] spvalues = DBTool.GetSqlPm(checkBill);
            int            res      = SqlHelper.ExecuteNonQuery(trans, CommandType.Text, sql, spvalues);

            if (changebody)
            {
                DeleteDetail(checkBill.id, trans);
                foreach (CheckBillBody ckb in checkBill.checkBillDetail)
                {
                    insertCheckDetail(ckb, trans);
                }
            }
            return(res);
        }
Ejemplo n.º 2
0
        public int InsertCheckBill(CheckBillInfo checkBill)
        {
            SqlConnection conn;
            int           count = 0;

            using (conn = SqlHelper.CreateConntion())
            {
                conn.Open();
                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    count = DAL.InsertCheckBill(checkBill, trans);
                    trans.Commit();
                }
                catch (Exception)
                {
                    trans.Rollback();
                }
                conn.Close();
            }
            return(count);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加盘点单
        /// </summary>
        /// <param name="changeStock"></param>
        /// <param name="conn"></param>
        /// <returns></returns>
        public int InsertCheckBill(CheckBillInfo checkBill, SqlTransaction trans)
        {
            Guid g = Guid.NewGuid();

            checkBill.id = g;
            string sql = @"INSERT INTO [CheckBillHead]
                               ([id]
                               ,[CheckNO]
                               ,[WarehouseID]
                               ,[Cdate]
                               ,[Cuser]
                               ,[detail]
                               ,[IsReview]
                               ,[ReviewUser]
                               ,[InsertDateTime]
                               ,[InsertUser])
                         VALUES
                               (@id
                               ,@CheckNO
                               ,@WarehouseID
                               ,@Cdate
                               ,@Cuser
                               ,@detail
                               ,@IsReview
                               ,@ReviewUser
                               ,@InsertDateTime
                               ,@InsertUser)";

            SqlParameter[] spvalues = DBTool.GetSqlPm(checkBill);
            int            res      = SqlHelper.ExecuteNonQuery(trans, CommandType.Text, sql, spvalues);

            foreach (CheckBillBody ckb in checkBill.checkBillDetail)
            {
                ckb.HeadId = g;
                insertCheckDetail(ckb, trans);
            }
            return(res);
        }