Esempio n. 1
0
        /// <summary>
        /// 更新采购单
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public int UpdateSailBill(SailBillInfo saleBill, bool changebody, SqlTransaction trans)
        {
            string sql = @"UPDATE [SailBillHead]
                           SET [id] = @id
                              ,[WareHouseID] = @WareHouseID
                              ,[SailNO] = @SailNO
                              ,[SailDate] = @SailDate
                              ,[IsReview] = @IsReview
                              ,[ReviewUser] = @ReviewUser
                              ,[StuffID] = @StuffID
                              ,[Detail] = @Detail
                              ,[Define1] = @Define1
                              ,[Define2] = @Define2
                              ,[Define3] = @Define3
                              ,[UpdateDateTime] = @UpdateDateTime
                              ,[UpdateUser] = @UpdateUser
                         WHERE id=@id";

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

            if (changebody)
            {
                DeleteDetail(saleBill.id, trans);
                foreach (SailBillBody ckb in saleBill.SaleBillDetail)
                {
                    InsertDetail(ckb, trans);
                }
            }
            return(res);
        }
Esempio n. 2
0
        /// <summary>
        /// 增加采购单
        /// </summary>
        /// <param name="changeStock"></param>
        /// <param name="conn"></param>
        /// <returns></returns>
        public int InsertSailBill(SailBillInfo saleBill, SqlTransaction trans)
        {
            Guid g = Guid.NewGuid();

            saleBill.id = g;
            string sql = @"INSERT INTO [ProductBillHead]
                                   ([id]
                                   ,[BuyNO]
                                   ,[BatchNO]
                                   ,[BuyDate]
                                   ,[SupplyID]
                                   ,[IsReview]
                                   ,[ReviewUser]
                                   ,[WareHouseID]
                                   ,[Detail]
                                   ,[Define1]
                                   ,[Define2]
                                   ,[Define3]
                                   ,[InsertDateTime]
                                   ,[InsertUser])
                             VALUES
                                   (@id
                                   ,@BuyNO
                                   ,@BatchNO
                                   ,@BuyDate
                                   ,@SupplyID
                                   ,@IsReview
                                   ,@ReviewUser
                                   ,@WareHouseID
                                   ,@Detail
                                   ,@Define1
                                   ,@Define2
                                   ,@Define3
                                   ,@InsertDateTime
                                   ,@InsertUser)";

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

            foreach (SailBillBody ckb in saleBill.SaleBillDetail)
            {
                ckb.HeadId = g;
                InsertDetail(ckb, trans);
            }
            return(res);
        }